回复发送 DM 的任何人
Reply to anyone who sent a DM
编辑: 另一个有更好答案的问题:
是否可以回复向我的 Discord.js 机器人发送消息的人?
例如,当有人向我的机器人的 DM 发送 hi
时,机器人应该回复 Please use !help for the commands' list.
我已经尝试了很多尝试来使用 MessageCollector
但我没有成功。
如有任何帮助,我们将不胜感激。
谢谢!
您可以使用 client.on('message')
告诉机器人这样做。
试试这个:
client.on('msg', () => {
if (msg.channel.type == 'dm' && msg.content.toLowerCase() == 'hi')
msg.channel.send('Please use !help for the commands' list.')
})
这只是一个简单的示例,但您还可以添加检查命令以及您在普通公会频道上执行的所有其他操作。检查消息是否来自 DMChannel is to check Channel.type
编辑: 另一个有更好答案的问题:
是否可以回复向我的 Discord.js 机器人发送消息的人?
例如,当有人向我的机器人的 DM 发送 hi
时,机器人应该回复 Please use !help for the commands' list.
我已经尝试了很多尝试来使用 MessageCollector
但我没有成功。
如有任何帮助,我们将不胜感激。
谢谢!
您可以使用 client.on('message')
告诉机器人这样做。
试试这个:
client.on('msg', () => {
if (msg.channel.type == 'dm' && msg.content.toLowerCase() == 'hi')
msg.channel.send('Please use !help for the commands' list.')
})
这只是一个简单的示例,但您还可以添加检查命令以及您在普通公会频道上执行的所有其他操作。检查消息是否来自 DMChannel is to check Channel.type