Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with guilds #29

Open
Fluffik3666 opened this issue Oct 21, 2023 · 4 comments
Open

Help with guilds #29

Fluffik3666 opened this issue Oct 21, 2023 · 4 comments

Comments

@Fluffik3666
Copy link

Hello,

I need to get the guilds the user has and then see if the bot is in them. For now my website only shows the guilds the bot is in which is not optimal for obvious reasons.

@Fluffik3666
Copy link
Author

I can do bearer_client.users.get_my_guilds() to get the users guild but how do I check if my bot is in those guilds

@ahnaf-zamil
Copy link
Owner

This has to be done on the bot's side. Pass the guild ID to the bot somehow, and let the bot check if the guild IDs exist in its own list of joined guild IDs.

In my case, I created an asynchronous RPC endpoint on the bot which I queried from the API to run the checks. This method isn't scalable but you can do it for small bots.

Another way to do it would be to store all of the joined guild IDs of the bot in a fast caching service like Redis. The API can just query Redis to get a list of the bot's joined guilds and match them.

@Fluffik3666
Copy link
Author

Is there a way to get the users guilds? I can't seem to find a way.

Thanks

@ejk9
Copy link

ejk9 commented Jan 20, 2024

Does def get_my_guilds()
do what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants