Add per-guild moderation settings and records

This commit is contained in:
2026-01-27 11:46:43 +01:00
parent b6a7d35ce3
commit f743262991
10 changed files with 298 additions and 19 deletions
+13 -15
View File
@@ -14,22 +14,20 @@ module.exports = {
}
try {
if (command.permissionGroup) {
const allowed = await isCommandAllowed({
guildId: interaction.guildId,
userId: interaction.user.id,
member: interaction.member,
commandName: interaction.commandName,
permissionGroup: command.permissionGroup,
});
const allowed = await isCommandAllowed({
guildId: interaction.guildId,
userId: interaction.user.id,
member: interaction.member,
commandName: interaction.commandName,
permissionGroup: command.permissionGroup,
});
if (!allowed) {
await interaction.reply({
content: 'You do not have permission to use this command.',
flags: MessageFlags.Ephemeral,
});
return;
}
if (!allowed) {
await interaction.reply({
content: 'You do not have permission to use this command.',
flags: MessageFlags.Ephemeral,
});
return;
}
await command.execute(interaction);
+5
View File
@@ -1,5 +1,6 @@
const { Events } = require('discord.js');
const { connectToDatabase } = require('../db.js');
const { clearBanStatus } = require('../services/moderationRecords');
module.exports = {
name: Events.ClientReady,
@@ -30,6 +31,10 @@ module.exports = {
await guild.bans.remove(banData.userId);
await tempBanCollection.deleteOne({ _id: banData._id });
await clearBanStatus({
guildId: banData.guildId,
userId: banData.userId,
});
} catch (err) {
console.error('Error unbanning member:', err);
} finally {