SleeplessOne1917 / lemmy-bot

A bot library for Lemmy, the fediverse link aggregator.
https://www.npmjs.com/package/lemmy-bot
GNU Affero General Public License v3.0
89 stars 10 forks source link

getUserId and getCommunityId dont always find the user/community #116

Open Ategon opened 6 months ago

Ategon commented 6 months ago

Due to how getUserId and getCommunityId try to find the id (using the search), if the actual user or community doesnt show up in that then it cant be found by the query

For example if you try to look for the id of the community git@programming.dev. Doing a call to getCommunityId("git") then does an api call to https://programming.dev/api/v3/search?q=git&type_=Communities which does not have git as one of the options (instead its populated by other things that have git in the name)

Ategon commented 6 months ago

One way to solve it would be adding in functionality to check other pages of the search results rather than just the first

SleeplessOne1917 commented 5 months ago

I've switched to making the bot actions closer to what lemmy-js-client does. getCommunityId and getUserId should be able to take names now in addition to ids. Try updating to 0.6.0 and seeing if the new functions help you resolve your issue.