// ASSUMPTIONS:
// channel = your channel as a TextChannel
// prefix = your prefix as a string
// owner = you as a User
client.on('message', msg => {
if (msg.channel != channel || msg.author.bot || msg.content.startsWith(prefix)) return;
else msg.delete();
});
// if you want your messages to be ignored too:
client.on('message', msg => {
if (msg.channel != channel || msg.author.bot || msg.content.startsWith(prefix) || msg.author == owner) return;
else msg.delete();
});
1 回答
那么,您可以检查消息是以您的前缀开头还是由机器人发送:如果没有,则表示它不是命令也不是命令响应 . 假设消息在该通道中的所有这些 .