missing stuff

This commit is contained in:
Erik 2022-07-07 19:50:01 +03:00
parent 14bfc137f3
commit 3b06edde70
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
5 changed files with 44 additions and 8 deletions

View File

@ -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**',

View File

@ -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
},
{

View File

@ -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
},
{

View File

@ -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
},
{

View File

@ -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.'