简体   繁体   中英

Discord.js v12 How to make commands only work in a certain server?

I am trying to make some "commands" work only for a specific server, so when used in a different server it would say something like This command can only be used in [GUILD] server. Let me know if anyone has any solutions. Thanks!

Before executing your command's function, you can check this:

if (message.guild.id !== 'TheIdOfYourGuild') return message.reply('This command can only be used in another server.');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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