简体   繁体   English

我怎样才能实现!leaveguild<guildid> 命令(离开指定的公会)进入我的 Discord (discord.js) 机器人?</guildid>

[英]How can I implement a !leaveguild <guildID> command (that leaves the specified guild) into my Discord (discord.js) bot?

I want to implement a.leaveguild command that leaves the Discord guild with the specified ID.我想实现 a.leaveguild 命令,使 Discord 公会具有指定的 ID。 I'm quite new to discord.js and StackOverflow so any help would be appreciated!我对 discord.js 和 StackOverflow 很陌生,所以任何帮助将不胜感激!

You can use guild.leave() for that您可以为此使用guild.leave()

if (!args[0]) return message.reply('enter a guild ID')
const guild = client.guilds.cache.get(args[0])
if (!guild) return message.reply('that is not a valid guild ID')
guild.leave()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM