Leave (NOT COMMAND)

How do I leave a server through my VSCode if i don't own the server (i have no permissions to kick the bot) and I want my bot to leave their server. Please help
19 Replies
d.js toolkit
d.js toolkit3w 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! - Marked as resolved by OP
d.js docs
d.js docs3w ago
:method: Guild#leave() @14.16.3 Leaves the guild.
// Leave a guild
guild.leave()
.then(guild => console.log(`Left the guild: ${guild.name}`))
.catch(console.error);
// Leave a guild
guild.leave()
.then(guild => console.log(`Left the guild: ${guild.name}`))
.catch(console.error);
Invisible
InvisibleOP3w ago
and where should i input this into my main index file ?
Syjalo
Syjalo3w ago
Where your client is ready Eg in ready event
Invisible
InvisibleOP3w ago
okay ill try it now and where do i input which guild to leave @Syjalo
chewie
chewie3w ago
client.guilds.cache.get('id') that returns the guild on which you can call .leave()
Invisible
InvisibleOP3w ago
okay perfect time to test it Sorry, still not quite exactly sure where to plug this in?
chewie
chewie3w ago
in your ready event
Invisible
InvisibleOP3w ago
im a noob at coding 😭 what is the ready event
chewie
chewie3w ago
if you dont have an events folder, probably somewhere in the index.js
Invisible
InvisibleOP3w ago
okay
chewie
chewie3w ago
client.on('ready', () => {...})
Invisible
InvisibleOP3w ago
OH IN THAT JON @chewie here is my code where should i put it in
chewie
chewie3w ago
not there thats your message event
Invisible
InvisibleOP3w ago
wait what im so confused
chewie
chewie3w ago
messageCreate !== ready
Invisible
InvisibleOP3w ago
in here?
chewie
chewie3w ago
please... just search for ready :pepe_clap:
Invisible
InvisibleOP3w ago
okay in that let me try the console.log("Left Server") @chewie holy shit am i dumb i did it thank you
Want results from more Discord servers?
Add your server