【发布时间】:2021-05-20 06:32:15
【问题描述】:
所以基本上,我希望我的机器人回复为其他机器人输入命令的人,例如当他们输入 -p(play) 时(在此处插入歌曲) 我不希望我的机器人播放歌曲,而是希望它回复他们,就像人们喜欢通过各种答案对某人的意见发表想法一样。 我已经输入了一个命令,当人们写 $w 时它会回复他们,但我希望我的机器人在他们在 $w 之后添加其他内容时回复。
const replies = [
"nice", "I like it", "We have the same tastes", "lucky!", "I wish I were you",
]
client.on("message", gotMessage);
async function gotMessage(msg) {
if (msg.content === "$w"){
const index = Math.floor(Math.random() * replies.length);
msg.channel.send(replies[index]);
}
}
【问题讨论】:
标签: javascript node.js discord discord.js bots