有没有办法使不和谐的bot回复某人的dm,即禁止发送私人消息?

时间:2020-05-28 21:37:34

标签: node.js discord discord.js

我希望我的不和谐机器人每当有DM时发送类似“您不允许在此处发送消息”之类的信息

这是我到目前为止所拥有的:

if(message.channel instanceof Discord.DMChannel){
   return;
}

任何帮助将不胜感激:)

1 个答案:

答案 0 :(得分:0)

您可以回复消息,也可以在与消息相同的通道(DM通道)中发送消息

if(message.channel instanceof Discord.DMChannel && !message.author.bot) {
  return message.reply('You can not message me through DMs')
}

if(message.channel instanceof Discord.DMChannel && !message.author.bot) {
  return message.channel.send('You can not message me through DMs')
}