add console.log() in various places

This commit is contained in:
ShuriZma 2024-03-30 20:47:44 +01:00
parent 1dc2d503b3
commit 623d18fb81
Signed by: ShuriZma
GPG Key ID: 8D289758EE9B8074
7 changed files with 21 additions and 7 deletions

View File

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

View File

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

View File

@ -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!');
},
};

View File

@ -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!');
},
};

View File

@ -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!');
},
};

View File

@ -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!');
},
};

View File

@ -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!');
},
};