🚑 bot delete in all channel counter word
This commit is contained in:
parent
8877d5dacd
commit
15646f4ea0
1 changed files with 12 additions and 10 deletions
|
@ -14,14 +14,6 @@ export default {
|
|||
const messages = await message.channel.messages.fetch({ limit: 2 });
|
||||
const lastMessage = messages.last();
|
||||
|
||||
if (lastMessage?.author.id === author.id) {
|
||||
logger.verbose(
|
||||
`${author.username} sent the last message therefor not allowing again.`
|
||||
);
|
||||
await message.delete();
|
||||
return;
|
||||
}
|
||||
|
||||
const { id: guildId } = guild;
|
||||
const { id: channelId } = channel;
|
||||
|
||||
|
@ -30,20 +22,30 @@ export default {
|
|||
channelId,
|
||||
});
|
||||
|
||||
if (!counter) {
|
||||
if (counter === null) {
|
||||
logger.verbose(
|
||||
`No counter found for guild ${guildId} and channel ${channelId}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
lastMessage?.author.id === author.id &&
|
||||
channel.id === counter.channelId
|
||||
) {
|
||||
logger.verbose(
|
||||
`${author.username} sent the last message therefor not allowing again.`
|
||||
);
|
||||
await message.delete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (content !== counter.word) {
|
||||
logger.verbose(
|
||||
`Counter word ${counter.word} does not match message ${content}`
|
||||
);
|
||||
|
||||
await message.delete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue