我正在使用discord.js库和node.js创建一个不和谐的机器人。现在,我需要对bot进行编码,以便当您发送消息(即:“发送@ hello”)时,它将向消息中提到的用户发送DM,在这种情况下,字符串是:"hello“。
现在,我正试图通过执行以下操作来做到这一点(代码是有缺陷的,肯定不会工作,但我希望您能够理解我想要完成的任务):
//get the user mentioned in the message
user = message.mentions[0]
//sending the message to said user
user.send("message
我有一个窗口应用程序,接收、http请求、。例如,向用户发送消息或向聊天频道发送消息。但我不能通过Discord.js在服务器上创建语音或文本频道。我从绝望中转向论坛。请帮帮忙
因此实现了该系统:
Windows App (for Users) <==> Windows Server for App <==> Discord Bot (Server) <==> MYSQL
例如,发送一条消息:
if (req.params.type === 'sendMessage')
{
channelName = req.params.cha
在我的Discord.js机器人中,我试图创建一个垃圾邮件命令,它将每隔3/4秒钟(750 my )发送一条消息。然而,在发送第一条消息之前,它将等待3/4秒钟,但它将停止等待其余的消息;实际上,它会疯狂地发出消息。我怎样才能解决这个问题?
function doSetTimeout(){
setTimeout(function(){
message.channel.send(msg);
}, 750);
}
for (i = 0; i < times; i++) {
message.channel.startTyping();
doSet
尝试使用discord.js将不一致消息编辑为RichEmbedded消息时,出现错误
(node:10860) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.timestamp: Could not parse 1581492006141. Should be ISO8601.
at item.request.gen.end (/rbd/pnpm-volume/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/node_modules/.registry.n
我有这个问题,我无法发送消息到特定的通道,我可以使用此代码发送消息:
let Channel = message.guild.channels.cache.get("749002989255131227");
Channel.send("Hello!")
但当我尝试发送它时,出现了错误:
(node:13580) UnhandledPromiseRejectionWarning: TypeError: Channel.send is not a function
at Client.<anonymous> (C:\Users\alier\De