counters last person is not next person

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

View file

@ -11,6 +11,17 @@ export default {
if (author.bot) return;
if (channel?.type !== "GUILD_TEXT") return;
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;