简体   繁体   中英

Discord Bot Server Deafen

I'm trying to mess with my friend so whenever he tries to user another discord bot command starting with "-", it deafens him so he can't hear it. I've been searching everywhere trying to find a solution but I wasn't able to find one that worked. I tried using the guild.fetchMember() function, but I'm not sure if I did it correctly so it didn't work. This is what I have so far (only the last function is in question):

My code

Friend, You can do this by

bot.on("message", message =>{
// confirming that its your friend who is using the command.
  if(message.author.id != "your friend's id") return;
  if(message.content.startsWith("-")){
        message.guild.members.cache.find(member => member.id == "your friend's id").voice.serverDeaf;
  };
});

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