🚑 bot delete in all channel counter word

This commit is contained in:
Axel Olausson Holtenäs 2022-04-17 22:04:20 +02:00
parent 8877d5dacd
commit 15646f4ea0
No known key found for this signature in database
GPG key ID: 7BF6826B76382CBA

View file

@ -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;
}