【发布时间】:2020-11-28 02:30:36
【问题描述】:
我正在尝试制作一个 js Discord 机器人,它可以对我在服务器中提到的人的最后一条消息做出自定义反应。过去一天我只尝试过使用javascript,所以我为菜鸟道歉。我尝试寻找类似的解决方案并应用逻辑无济于事。就是这个思路
Example:
> User1: I just ran a marathon!
> User2: !goodjob @User1
> (Bot reacts to 'I just ran a marathon' with multiple reactions like :happy: :1thumbsup: and/or a custom react)
这是我到目前为止所拥有的,但这只会使机器人对启动命令的人做出反应(没有我现在在示例中以 # 开头的 3 行)
if (cmdName === 'goodjob') {
let mention = message.mentions.users.first();
#function getUserFromMention(mention){
#const matches = mention.match(/^<@!?(\d+)>$/);
#const id = matches[1];
message.react('<:emoji:ID>');
message.react('<:emoji:ID>');
message.react('<:emoji:ID>');
}
})
});
我不是很熟练,所以我可能在某个地方搞砸了逻辑。如果解决方案在其他地方,我很抱歉!感谢您提供任何和所有指导!
【问题讨论】:
标签: javascript discord discord.js