我正在尝试检测来自另一个不和谐机器人的消息。例如,如果另一个不和谐的bot说出“ captcha”一词,我的不和谐的bot将检测到它并ping通我。希望有一种方法也可以检测到另一个僵尸程序的嵌入,而不仅仅是消息。
答案 0 :(得分:1)
// create a message event
client.on('message', (message) => {
if (message.author.bot) {
// if the message is a bot
console.log(`${message.author.username} sent: '${message.content}'`); // you can fetch the message text through `message.content`
if (message.embeds[0])
// if the message includes an embed
console.log(
`${message.author.username} sent an embed with the title ${message.embeds[0].title}`
); // you can fetch the embed content through `message.embeds[0]`
}
});
答案 1 :(得分:0)
您可以从bot
(用户对象)获得author
属性
message.author.bot
将返回true
,否则返回false
。
对于“验证码”检测,您只需检查
message.content