diff --git a/src/structure/components/settings/logging/Members.js b/src/structure/components/settings/logging/Members.js index e0a2afc..41f06d2 100644 --- a/src/structure/components/settings/logging/Members.js +++ b/src/structure/components/settings/logging/Members.js @@ -12,7 +12,8 @@ class MemberLog extends Setting { default: { channel: null, join: '{mention} joined the server.', - leave: '**{tag}** ({id}) left the server.' + leave: '**{tag}** ({id}) left the server.', + enabled: false }, definitions: { channel: 'GUILD_TEXT', @@ -20,6 +21,11 @@ class MemberLog extends Setting { leave: 'STRING' }, commandOptions: [ + new CommandOption({ + name: 'enabled', + description: 'Enable/disable member logs', + type: 'BOOLEAN' + }), new CommandOption({ name: 'channel', description: 'Select the log output channel', @@ -45,6 +51,7 @@ class MemberLog extends Setting { if (opts.join) setting.join = opts.join.value; if (opts.leave) setting.join = opts.join.value; if (opts.channel) setting.channel = opts.channel.value.id; + if (opts.enabled) setting.enabled = opts.enabled.value; return { index: 'SETTING_SUCCESS_ALT' }; @@ -54,6 +61,13 @@ class MemberLog extends Setting { const setting = guild._settings[this.name]; return [ + { + name: 'GENERAL_STATUS', + value: guild.format('GENERAL_STATE', { + bool: Boolean(setting.enabled) + }, { code: true }), + inline: true + }, { name: 'GENERAL_CHANNEL', value: setting.channel ? `<#${setting.channel}>` : '**N/A**', diff --git a/src/structure/components/settings/logging/Moderation.js b/src/structure/components/settings/logging/Moderation.js index 9592194..9a5268d 100644 --- a/src/structure/components/settings/logging/Moderation.js +++ b/src/structure/components/settings/logging/Moderation.js @@ -44,6 +44,11 @@ class ModerationLog extends Setting { } }, commandOptions: [ + new CommandOption({ + name: 'enabled', + description: 'Enable/disable member logs', + type: 'BOOLEAN' + }), new CommandOption({ name: 'channel', description: 'Logging channel', @@ -71,12 +76,13 @@ class ModerationLog extends Setting { async execute(interaction, opts, setting) { - const { channel, infractions, anonymous } = opts, + const { channel, infractions, anonymous, enabled } = opts, langParams = {}; let index = 'SETTING_SUCCESS_ALT'; if (anonymous) setting.anonymous = anonymous.value; if (channel) setting.channel = channel.value.id; + if (enabled) setting.enabled = enabled.value; if (infractions) { const response = await this._prompt(interaction, { @@ -108,7 +114,7 @@ class ModerationLog extends Setting { return [ { name: 'GENERAL_STATUS', - value: guild.format('GENERAL_STATE', { bool: Boolean(setting.channel) }, { code: true }), + value: guild.format('GENERAL_STATE', { bool: Boolean(setting.enabled) }, { code: true }), inline: true }, { diff --git a/src/structure/components/settings/logging/Nicknames.js b/src/structure/components/settings/logging/Nicknames.js index 1901bda..6ff906f 100644 --- a/src/structure/components/settings/logging/Nicknames.js +++ b/src/structure/components/settings/logging/Nicknames.js @@ -9,12 +9,18 @@ class Nicknames extends Setting { display: 'Nickname Logging', module: 'logging', default: { - channel: null + channel: null, + enabled: false }, definitions: { channel: 'GUILD_TEXT' }, commandOptions: [ + new CommandOption({ + name: 'enabled', + description: 'Toggle logging on or off', + type: 'BOOLEAN' + }), new CommandOption({ name: 'channel', type: 'TEXT_CHANNEL', @@ -26,7 +32,9 @@ class Nicknames extends Setting { async execute(interaction, opts, setting) { - setting.channel = opts.channel.value.id; + if (opts.enabled) setting.enabled = opts.enabled.value; + if (opts.channel) setting.channel = opts.channel.value.id; + return { index: 'SETTING_SUCCESS_ALT' }; } @@ -36,7 +44,7 @@ class Nicknames extends Setting { return [ { name: 'GENERAL_STATUS', - value: guild.format('GENERAL_STATE', { bool: Boolean(setting.channel) }, { code: true }), + value: guild.format('GENERAL_STATE', { bool: Boolean(setting.enabled) }, { code: true }), inline: true }, { diff --git a/src/structure/components/settings/logging/Voice.js b/src/structure/components/settings/logging/Voice.js index 7d83402..972a42c 100644 --- a/src/structure/components/settings/logging/Voice.js +++ b/src/structure/components/settings/logging/Voice.js @@ -15,6 +15,11 @@ class Voice extends Setting { channel: 'GUILD_TEXT' }, commandOptions: [ + new CommandOption({ + name: 'enabled', + description: 'Toggle logging on or off', + type: 'BOOLEAN' + }), new CommandOption({ name: 'channel', type: 'TEXT_CHANNEL', @@ -26,7 +31,9 @@ class Voice extends Setting { async execute(interaction, opts, setting) { - setting.channel = opts.channel.value.id; + if (opts.enabled) setting.enabled = opts.enabled.value; + if (opts.channel) setting.channel = opts.channel.value.id; + return { index: 'SETTING_SUCCESS_ALT' }; } @@ -36,7 +43,7 @@ class Voice extends Setting { return [ { name: 'GENERAL_STATUS', - value: guild.format('GENERAL_STATE', { bool: Boolean(setting.channel) }, { code: true }), + value: guild.format('GENERAL_STATE', { bool: Boolean(setting.enabled) }, { code: true }), inline: true }, { diff --git a/src/utilities/SettingsMigrator.js b/src/utilities/SettingsMigrator.js index 92c7497..a2de1c6 100644 --- a/src/utilities/SettingsMigrator.js +++ b/src/utilities/SettingsMigrator.js @@ -307,6 +307,7 @@ class SettingsMigrator { }; if (memberlogs) settings.members = { + enabled: result.memberlogs?.enabled || false, channel: result.memberlogs?.channel || null, join: result.memberlogs?.join || '{mention} joined the server.', leave: result.memberlogs?.leave || '**{tag}** ({id}) left the server.'