Removing bot from servers

Hey y'all, I'm trying to remove my bot from quite a few servers. I'm running a script from my computer that logs into the bot and finds the cache, then leaves them. It seemed to have temp banned my personal IP (and not my bot), due to rate limiting I'm sure. What's the best way to go about getting this bot out of many differnet servers?
2 Replies
d.js toolkit
d.js toolkit•10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
rhh4x0R
rhh4x0R•10mo ago
Gotcha. How can I check for those 400 errors in code -- there an endpoint in djs, or maybe a try catch?
client.guilds.cache.forEach(guild => {
if (!allowedServers.includes(guild.id)) {
// do something
console.log(`Remove from guild: ${guild.name} (id: ${guild.id})`)
guild.leave()
}
console.log(`The bot is in: ${guild.name} (id: ${guild.id})`)
})
client.guilds.cache.forEach(guild => {
if (!allowedServers.includes(guild.id)) {
// do something
console.log(`Remove from guild: ${guild.name} (id: ${guild.id})`)
guild.leave()
}
console.log(`The bot is in: ${guild.name} (id: ${guild.id})`)
})
Gotta shut it down, unfortunately. Not completely, just publicly. Want to leave it in like 4 servers, but it's gonna kick itself from like 10k servers. I'm not sure why it'd have 400 errors if I'm using guilds.cache. Well, it'd require whole new infrastructure to do that based on how setup works. I'd rather not do that. If possible. Nah, that parts easy but the way setup works it's a bitch to re-add the bots to servers and re-setup the discords there. It'd have to resetup in the discords themselves. Not the infra on the backend. Anyways, besides that, any other suggestions? 5 guilds every hour is the rate limit? Dayumn. Basically it creates channels on join that link into the bot, so it'll throw errors and require new channel setups for each guild that I do it for. So not the most ideal if I can get these bots to leave. When a bot joins, it creates new channels w/ new embeds that users use. So, if I have a new bot that creates new channels I'll lose those current channels, reactions on emojis, etc. If It was just commands that hooked into the DB I wouldn't give a F. Lol. Hmm. Well, the embeds created by the old bot would have to be re-created. I guess cloning is possible. I'd just have to write a bunch of migration code. They have buttons/menus. I can just throw pre-conditions on interactions and if an interaction happens that's not in one of my approved servers I can have it leave, I guess. Unless a rate limit would still apply? Is it really 5 per hour? Ok, thanks. I'll try some more things. Any reason you're using guild.cache.values instead of what I had before? I see, thank you.
Want results from more Discord servers?
Add your server