diff --git a/src/bot.ts b/src/bot.ts index fdc3ceb..0021494 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -78,12 +78,15 @@ export class Bot { && !msg.content.startsWith(this.ignorePrefix) && !msg.author.bot ) { + console.log('received message'); if ( - this.lastUser === msg.author.id + this.lastUser + && this.lastUser === msg.author.id && this.modRole ? msg.member.roles.highest.comparePositionTo(this.modRole) < 0 : !msg.member.permissions.has(PermissionsBitField.Flags.Administrator) ) { - await msg.delete(); - return; + console.log('2 messages in a row detected', this.lastUser, msg.author.id, this.modRole ? msg.member.roles.highest.comparePositionTo(this.modRole) < 0 : !msg.member.permissions.has(PermissionsBitField.Flags.Administrator)) + // await msg.delete(); + // return; } this.counter++; @@ -96,11 +99,10 @@ export class Bot { msg.content, ] ); + console.log('added word to library, set lastUser and increased counter') } if (this.counter === this.autoEmbedMessages) { - this.counter = 0; - this.sendEmbed(msg); } }); @@ -174,6 +176,9 @@ export class Bot { .setColor(0xffe600) .setFields(fields); await msg.reply({embeds: [embed]}); + + this.counter = 0; + console.log('sendEmbed: sent library embed and set counter to 0'); } } ); diff --git a/src/commands/library.ts b/src/commands/library.ts index 7d3f55d..17bf8fc 100644 --- a/src/commands/library.ts +++ b/src/commands/library.ts @@ -11,8 +11,6 @@ export default { .setDescription('Get an embed of the most used words!'), async execute(interaction: ChatInputCommandInteraction) { const bot = Bot.getInstance(); - bot.setCounter(0); - return bot.sendEmbed(interaction); }, }; \ No newline at end of file diff --git a/src/commands/reset.ts b/src/commands/reset.ts index 96769d9..5d1a534 100644 --- a/src/commands/reset.ts +++ b/src/commands/reset.ts @@ -20,10 +20,13 @@ export default { const bot = Bot.getInstance(); if (interaction.options.data.at(0)) { bot.getDB().run('DELETE FROM library WHERE word = ?', [interaction.options.data.at(0).value]); + console.log('deleted "' + interaction.options.data.at(0).value + '" from the library') + return await interaction.reply('Done!'); } bot.getDB().run('DELETE FROM library WHERE TRUE'); bot.setCounter(0); + console.log('completely cleared library') return await interaction.reply('Done!'); }, }; \ No newline at end of file diff --git a/src/commands/setAutoEmbedMessages.ts b/src/commands/setAutoEmbedMessages.ts index 84042eb..0516672 100644 --- a/src/commands/setAutoEmbedMessages.ts +++ b/src/commands/setAutoEmbedMessages.ts @@ -28,6 +28,8 @@ export default { ); bot.setAutoEmbedMessages(parseInt(interaction.options.data.at(0).value.toString())); + console.log('set auto embed messages to ' + interaction.options.data.at(0).value); + return await interaction.reply('Done!'); }, }; \ No newline at end of file diff --git a/src/commands/setChannel.ts b/src/commands/setChannel.ts index c736071..2820f38 100644 --- a/src/commands/setChannel.ts +++ b/src/commands/setChannel.ts @@ -30,6 +30,8 @@ export default { ); bot.setChannel(interaction.options.data.at(0).value.toString()); + console.log('set channel to ' + interaction.options.data.at(0).value); + return await interaction.reply('Done!'); }, }; \ No newline at end of file diff --git a/src/commands/setIgnorePrefix.ts b/src/commands/setIgnorePrefix.ts index 97d9cd6..6c59c1f 100644 --- a/src/commands/setIgnorePrefix.ts +++ b/src/commands/setIgnorePrefix.ts @@ -28,6 +28,8 @@ export default { ); bot.setIgnorePrefix(interaction.options.data.at(0).value.toString()); + console.log('set ignore prefix to ' + interaction.options.data.at(0).value); + return await interaction.reply('Done!'); }, }; \ No newline at end of file diff --git a/src/commands/setModRole.ts b/src/commands/setModRole.ts index 7f1a053..ecf40a9 100644 --- a/src/commands/setModRole.ts +++ b/src/commands/setModRole.ts @@ -28,6 +28,8 @@ export default { ); bot.setModRole(interaction.options.data.at(0).value.toString()); + console.log('set mod role to ' + interaction.options.data.at(0).value); + return await interaction.reply('Done!'); }, }; \ No newline at end of file