-
Notifications
You must be signed in to change notification settings - Fork 2
feat: per-guild configuration (multi-tenancy) #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c355e53
57d78a6
8e6fccb
f0f3b45
315fda7
46ad327
997a5cd
ea38be2
2e79b6b
adce7dd
57f643b
eecf123
0e4bce1
ef56576
9aae5e1
0f53822
41fa503
b73267f
214cfdf
244598c
cea74f6
4c62040
a247577
45ebc00
240d1de
b950452
8b9510c
763aa1c
cb7ae74
f5f4dd0
31948cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,8 +135,16 @@ async function handleSetup(interaction) { | |
|
|
||
| if (i.customId === 'modlog_channel' && selectedCategory) { | ||
| const channelId = i.values[0]; | ||
| await setConfigValue(`moderation.logging.channels.${selectedCategory}`, channelId); | ||
| info('Modlog channel configured', { category: selectedCategory, channelId }); | ||
| await setConfigValue( | ||
| `moderation.logging.channels.${selectedCategory}`, | ||
| channelId, | ||
| interaction.guildId, | ||
| ); | ||
| info('Modlog channel configured', { | ||
| category: selectedCategory, | ||
| channelId, | ||
| guildId: interaction.guildId, | ||
| }); | ||
| await i.update({ | ||
| embeds: [ | ||
| embed.setDescription( | ||
|
|
@@ -176,7 +184,7 @@ async function handleSetup(interaction) { | |
| */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug (same pattern as config.js): The permission check at the top of If a guild has customized The fix is the same as what needs to happen in const config = getConfig(interaction.guildId); |
||
| async function handleView(interaction) { | ||
| try { | ||
| const config = getConfig(); | ||
| const config = getConfig(interaction.guildId); | ||
| const channels = config.moderation?.logging?.channels || {}; | ||
|
|
||
| const embed = new EmbedBuilder() | ||
|
|
@@ -209,10 +217,10 @@ async function handleDisable(interaction) { | |
| try { | ||
| const keys = ['default', 'warns', 'bans', 'kicks', 'timeouts', 'purges', 'locks']; | ||
| for (const key of keys) { | ||
| await setConfigValue(`moderation.logging.channels.${key}`, null); | ||
| await setConfigValue(`moderation.logging.channels.${key}`, null, interaction.guildId); | ||
| } | ||
|
|
||
| info('Mod logging disabled', { moderator: interaction.user.tag }); | ||
| info('Mod logging disabled', { moderator: interaction.user.tag, guildId: interaction.guildId }); | ||
| await safeEditReply( | ||
| interaction, | ||
| '✅ Mod logging has been disabled. All log channels have been cleared.', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The
autocompletehandler was correctly updated to usegetConfig(interaction.guildId)here, but theexecute()function's permission check at line 161 was not updated — it still callsgetConfig()(no guildId). This means the permission gate always evaluates against global config, ignoring any per-guildpermissions.adminRoleIdorpermissions.allowedCommands.configoverrides.Line 161 should be: