Sending private messages to user

后端 未结 8 1521
清歌不尽
清歌不尽 2020-12-14 18:39

I\'m using the discord.js library and node.js to create a Discord bot that facilitates poker. It is functional except the hands are shown to everyone, and I need to loop thr

8条回答
  •  攒了一身酷
    2020-12-14 19:30

    This is pretty simple here is an example

    Add your command code here like:

    if (cmd === `!dm`) {
     let dUser =
      message.guild.member(message.mentions.users.first()) ||
      message.guild.members.get(args[0]);
     if (!dUser) return message.channel.send("Can't find user!");
     if (!message.member.hasPermission('ADMINISTRATOR'))
      return message.reply("You can't you that command!");
     let dMessage = args.join(' ').slice(22);
     if (dMessage.length < 1) return message.reply('You must supply a message!');
    
     dUser.send(`${dUser} A moderator from WP Coding Club sent you: ${dMessage}`);
    
     message.author.send(
      `${message.author} You have sent your message to ${dUser}`
     );
    }
    

提交回复
热议问题