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 toolkit2d 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 docs2d 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
InvisibleOP2d ago
and where should i input this into my main index file ?
Syjalo
Syjalo2d ago
Where your client is ready Eg in ready event
Invisible
InvisibleOP2d ago
okay ill try it now and where do i input which guild to leave @Syjalo
chewie
chewie2d ago
client.guilds.cache.get('id') that returns the guild on which you can call .leave()
Invisible
InvisibleOP2d ago
okay perfect time to test it Sorry, still not quite exactly sure where to plug this in?
chewie
chewie2d ago
in your ready event
Invisible
InvisibleOP2d ago
im a noob at coding 😭 what is the ready event
chewie
chewie2d ago
if you dont have an events folder, probably somewhere in the index.js
Invisible
InvisibleOP2d ago
okay
chewie
chewie2d ago
client.on('ready', () => {...})
Invisible
InvisibleOP2d ago
OH IN THAT JON @chewie here is my code where should i put it in
chewie
chewie2d ago
not there thats your message event
Invisible
InvisibleOP2d ago
wait what im so confused
chewie
chewie2d ago
messageCreate !== ready
Invisible
InvisibleOP2d ago
in here?
chewie
chewie2d ago
please... just search for ready :pepe_clap:
Invisible
InvisibleOP2d 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