所以我是机器人制造的初学者,在这个领域我有点不舒服,我现在只在Discord.js闲逛,但遇到了一个我看不到的问题继续前进。
我有一个玩笑机器人,可以检测某人是否发送了图像或链接,输出回复,然后删除图像(或链接)。 (实际上,我希望删除不是文本的任何内容,但是我需要在响应中确切说明它是哪种媒体,所以我不在乎它是否特别受限制...)
这就是我所拥有的:
//remove instances of images
if (message.attachments.length > 0) {
message.channel.send(`${message.author} sent an image!`);
message.channel.send('This constitutes revelry and merriment and is strictly outlawed!')
message.delete();
}
//remove instances of links
if (message.embeds.length > 0) {
message.channel.send(`${message.author} sent an link!`);
message.channel.send('This constitutes revelry and merriment and is strictly outlawed!')
message.delete();
}
但是,如果我发送图像,它什么也不做。
谢谢!
编辑:我也想说的是,该机器人还有其他功能可以很好地发挥作用(反应,删除,回复某些单词的提述),因此希望唯一相关的代码应该在上面。