【问题标题】:Private Message Bot Discord私人消息机器人不和谐
【发布时间】:2018-11-19 07:50:07
【问题描述】:

我想给机器人添加一个功能,用参数中的 id 私下联系用户。

我已经试过了:

sendMessage(idUser, "mesage")

但它不起作用。

我有这个错误:

"sendMessage 未定义"

【问题讨论】:

  • 您需要提供更多详细信息,您到目前为止已经尝试过什么
  • 我试过这个:bot.sendMessage(user, "my message"); bot.message(用户,“我的消息”);我想知道是否可以使用此 ID 在私信中联系用户,因为我没有找到有关 userId 私信的任何信息
  • 您需要添加更多代码,以便我们了解问题所在
  • const Discord = require('discord.js') const bot = new Discord.Client() bot.on('message' function(message)){ sendMessage( auserid , "HELLO WORLD")您不需要其余的代码。

标签: javascript bots discord.js private-messaging


【解决方案1】:

试试message.author.send("Your message here"); 这会获取已发送消息的作者并向他们发送消息。

但请注意,discord.js 中的 sendMessage 已被贬低。相反,只需使用发送。

【讨论】:

    【解决方案2】:

    是的 message.author.send("MESSAGE") 应该可以工作

    还有一个小贴士\n 会在您制作文本行时换行:D

    【讨论】:

      猜你喜欢
      • 2020-04-21
      • 1970-01-01
      • 2018-12-15
      • 2018-05-02
      • 1970-01-01
      • 2020-05-31
      • 2020-09-03
      • 2021-05-09
      • 2021-02-19
      相关资源
      最近更新 更多