#How do I get all of the guilds created by the OAuth2 user?
35 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
@discordjs/rest
Sure, if you got their OAuth2 token to do it…
So I'd have to setup a HTTP client for each request I want to make?
I looked at mee6 requests, and they make a call to their internal API which returns this:
{
"guilds": [
{
"bot": false,
"bot_master": true,
"buffs": [],
"icon": "795bdeeffb0ea2cf4819f2ef833c4b9f",
"id": "314079160437964801",
"name": "Polis",
"owner": false,
"permissions": 4398046511103
},
]
}
So they must be making the request to get the user's guilds somehow
but as u can see, they return the "bot" above too
how would they get that info? they must be merging the data from their internal DB
Not from their DB but from the actual bot user probably. Checking if the bot is in that guild
ye, they probly filter the guilds returned from what i said above and modify that data

I don't think it would make sense to do that though right? if the bot is in say 19m guilds, they're not going to go through all that data to check if the bot is in a few guilds surely?
The best approach imo is to store in DB the guild when guildCreate is fired from bot
then remove guild when guildLeave is fired from bot
Umm, that’s the same thing. As in go through all that data is exactly what a DB does too
you can't get the guilds created reliably afaik, only guilds owned
well it wouldn't be really, because all you'd have to do is get the owned guilds, map to array of guild IDs, get guilds from DB where ID exists. SELECT * FROM guilds WHERE id IN ...
… which makes the DB go through all data and only return those that match your WHERE clause…
yeah but it would be more efficient going through the DB than make a filtering through the json data right?
Why JSON? you have your bot’s guilds as a Collection in djs already
not a bot, using REST API
Then why did you ask about how MEE6 could add the bot fields on it, if it‘s totally irrelevant for your use-case?
wtf
dw bro ill figure it out myself...
I'm not particularly a fan of your attitude
It is relevant. I was wondering if there was a REST route the bot could call to get user guilds and see if the bot is in them without having to actually filter through the data myself
mee6 has a dashboard interface where they do the exact same thing
their bot is managed by their dashboard
that is what i am building
So you do have a bot… Mee6 has communication between their bot process and the process the dashboard runs on. So they send the guildIds of the user owned guilds to bot process, that then replies with what guilds of those the bot is in.