settings
This commit is contained in:
parent
617e63d5fb
commit
95a55b3b57
@ -24,7 +24,8 @@ class IgnoreSetting extends Setting {
|
||||
choices: [
|
||||
{ name: 'channels', value: 'channels' },
|
||||
{ name: 'bypass', value: 'bypass' }
|
||||
]
|
||||
],
|
||||
dependsOn: ['method']
|
||||
}),
|
||||
new CommandOption({
|
||||
name: 'method',
|
||||
@ -35,7 +36,8 @@ class IgnoreSetting extends Setting {
|
||||
{ name: 'remove', value: 'remove' },
|
||||
{ name: 'set', value: 'set' },
|
||||
{ name: 'reset', value: 'reset' },
|
||||
]
|
||||
],
|
||||
dependsOn: ['list']
|
||||
})
|
||||
]
|
||||
});
|
||||
|
@ -26,7 +26,8 @@ class ProtectionSetting extends Setting {
|
||||
choices: [
|
||||
{ name: 'role', value: 'role' },
|
||||
{ name: 'position', value: 'position' }
|
||||
]
|
||||
],
|
||||
dependsOn: ['method']
|
||||
}),
|
||||
new CommandOption({
|
||||
type: 'STRING',
|
||||
@ -37,7 +38,8 @@ class ProtectionSetting extends Setting {
|
||||
{ name: 'remove', value: 'remove' },
|
||||
{ name: 'set', value: 'set' },
|
||||
{ name: 'reset', value: 'reset' },
|
||||
]
|
||||
],
|
||||
dependsOn: [ 'type' ]
|
||||
})
|
||||
]
|
||||
});
|
||||
|
147
src/structure/components/settings/logging/DmInfraction.js
Normal file
147
src/structure/components/settings/logging/DmInfraction.js
Normal file
@ -0,0 +1,147 @@
|
||||
const { Setting, CommandOption } = require("../../../interfaces");
|
||||
const Infractions = [
|
||||
'NOTE',
|
||||
'WARN',
|
||||
'MUTE',
|
||||
'UNMUTE',
|
||||
'KICK',
|
||||
'SOFTBAN',
|
||||
'BAN',
|
||||
'UNBAN',
|
||||
'VCMUTE',
|
||||
'VCUNMUTE',
|
||||
'VCKICK',
|
||||
'VCBAN',
|
||||
'VCUNBAN',
|
||||
'REMOVEROLE',
|
||||
'ADDROLE',
|
||||
'NICKNAME'
|
||||
];
|
||||
|
||||
class DmInfraction extends Setting {
|
||||
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dminfraction',
|
||||
description: 'Configure what the bot DMs users upon moderation if anything',
|
||||
module: 'logging',
|
||||
default: {
|
||||
enabled: false,
|
||||
infractions: [
|
||||
'WARN',
|
||||
'MUTE',
|
||||
'UNMUTE',
|
||||
'KICK',
|
||||
'SOFTBAN',
|
||||
'BAN',
|
||||
'UNBAN',
|
||||
'VCMUTE',
|
||||
'VCUNMUTE',
|
||||
'VCKICK',
|
||||
'VCBAN',
|
||||
'VCUNBAN'
|
||||
],
|
||||
messages: {
|
||||
default: 'You were **{infraction}** {from|on} the server `{server}`, your infraction details are below.'
|
||||
}
|
||||
},
|
||||
definitions: {
|
||||
enabled: 'BOOLEAN',
|
||||
infractions: { ARRAY: Infractions },
|
||||
messages: {
|
||||
OBJECT: {
|
||||
keys: Infractions,
|
||||
values: 'STRING'
|
||||
}
|
||||
}
|
||||
},
|
||||
commandOptions: [
|
||||
new CommandOption({
|
||||
name: 'message',
|
||||
description: 'Set the message for an infraction type, must be used with the `infraction` option',
|
||||
type: 'STRING',
|
||||
dependsOn: ['infraction']
|
||||
}),
|
||||
new CommandOption({
|
||||
name: 'infraction',
|
||||
description: 'Choose the infraction for which to modify the message, must be used with the `message` option',
|
||||
type: 'STRING',
|
||||
choices: Infractions.map((inf) => {
|
||||
return { name: inf, value: inf };
|
||||
}),
|
||||
dependsOn: ['message']
|
||||
}),
|
||||
new CommandOption({
|
||||
name: 'infractions',
|
||||
description: 'Modify the list of infractions that are sent',
|
||||
type: 'STRING',
|
||||
choices: [
|
||||
{ name: 'add', value: 'add' },
|
||||
{ name: 'remove', value: 'remove' },
|
||||
{ name: 'set', value: 'set' },
|
||||
{ name: 'reset', value: 'reset' },
|
||||
]
|
||||
}),
|
||||
new CommandOption({
|
||||
name: 'enable',
|
||||
description: 'Enable or disable the sending of infractions in DMs',
|
||||
type: 'BOOLEAN'
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction, opts, setting) {
|
||||
|
||||
const { enable, infractions, infraction, message } = opts;
|
||||
|
||||
if (enable) setting.enable = enable.value;
|
||||
|
||||
if (infractions) {
|
||||
const response = await this._prompt(interaction, {
|
||||
message: `${interaction.format(`SETTING_PROMPT_${infractions.value.toUpperCase()}`, {
|
||||
list: 'infractions'
|
||||
})}\n\n${interaction.format('SETTING_DMINFRACTION_VALID', {
|
||||
valid: Infractions.join(`, `)
|
||||
})}`
|
||||
});
|
||||
if (response.error) return response;
|
||||
|
||||
const infs = response.split(' ')
|
||||
.map((inf) => this.client.resolver.resolveInfraction(inf))
|
||||
.filter((inf) => inf !== null);
|
||||
this[infractions.value](setting.infractions, infs);
|
||||
}
|
||||
|
||||
if (message && infraction) {
|
||||
setting.messages[infraction.value] = message.value;
|
||||
}
|
||||
|
||||
return { error: false, index: 'SETTING_SUCCESS_ALT' };
|
||||
|
||||
}
|
||||
|
||||
async fields(guild) {
|
||||
|
||||
const setting = guild._settings[this.name];
|
||||
return [
|
||||
{
|
||||
name: 'GENERAL_STATUS',
|
||||
value: guild.format('GENERAL_STATE', { bool: setting.enabled }, { code: true }),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'GENERAL_INFRACTIONS',
|
||||
value: setting.infractions.join(', ')
|
||||
},
|
||||
{
|
||||
name: 'GENERAL_MESSAGES',
|
||||
value: Object.entries(setting.messages).map(([key, val]) => `**${key}**: ${val}`).join('\n')
|
||||
}
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = DmInfraction;
|
@ -47,7 +47,8 @@ class MessageLog extends Setting {
|
||||
choices: [
|
||||
{ name: 'bypass', value: 'bypass' },
|
||||
{ name: 'ignore', value: 'ignore' },
|
||||
]
|
||||
],
|
||||
dependsOn: ['method']
|
||||
}),
|
||||
new CommandOption({
|
||||
name: 'method',
|
||||
@ -58,7 +59,8 @@ class MessageLog extends Setting {
|
||||
{ name: 'remove', value: 'remove' },
|
||||
{ name: 'set', value: 'set' },
|
||||
{ name: 'reset', value: 'reset' },
|
||||
]
|
||||
],
|
||||
dependsOn: ['list']
|
||||
}),
|
||||
]
|
||||
});
|
113
src/structure/components/settings/logging/Moderation.js
Normal file
113
src/structure/components/settings/logging/Moderation.js
Normal file
@ -0,0 +1,113 @@
|
||||
const { Infractions } = require("../../../../constants/Constants");
|
||||
const { Setting, CommandOption } = require("../../../interfaces");
|
||||
|
||||
// [
|
||||
// 'NOTE',
|
||||
// 'WARN',
|
||||
// 'MUTE',
|
||||
// 'UNMUTE',
|
||||
// 'LOCKDOWN',
|
||||
// 'UNLOCKDOWN',
|
||||
// 'SLOWMODE',
|
||||
// 'KICK',
|
||||
// 'SOFTBAN',
|
||||
// 'BAN',
|
||||
// 'UNBAN',
|
||||
// 'VCMUTE',
|
||||
// 'VCUNMUTE',
|
||||
// 'VCKICK',
|
||||
// 'VCBAN',
|
||||
// 'VCUNBAN',
|
||||
// 'NICKNAME',
|
||||
// 'ADDROLE',
|
||||
// 'REMOVEROLE',
|
||||
// 'PRUNE'
|
||||
// ]
|
||||
|
||||
class ModerationLog extends Setting {
|
||||
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'moderation',
|
||||
description: 'Configure moderation logs',
|
||||
module: 'logging',
|
||||
default: {
|
||||
channel: null,
|
||||
infractions: Infractions
|
||||
},
|
||||
definitions: {
|
||||
channel: 'GUILD_TEXT',
|
||||
infractions: {
|
||||
ARRAY: Infractions
|
||||
}
|
||||
},
|
||||
commandOptions: [
|
||||
new CommandOption({
|
||||
name: 'channel',
|
||||
description: '',
|
||||
type: 'TEXT_CHANNEL'
|
||||
}),
|
||||
new CommandOption({
|
||||
name: 'infractions',
|
||||
description: 'Modify the list of infractions that are sent',
|
||||
type: 'STRING',
|
||||
choices: [
|
||||
{ name: 'add', value: 'add' },
|
||||
{ name: 'remove', value: 'remove' },
|
||||
{ name: 'set', value: 'set' },
|
||||
{ name: 'reset', value: 'reset' },
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction, opts, setting) {
|
||||
|
||||
const { channel, infractions } = opts;
|
||||
|
||||
if (channel) setting.channel = channel.value.id;
|
||||
|
||||
if (infractions) {
|
||||
const response = await this._prompt(interaction, {
|
||||
message: `${interaction.format(`SETTING_PROMPT_${infractions.value.toUpperCase()}`, {
|
||||
list: 'infractions'
|
||||
})}\n\n${interaction.format('SETTING_DMINFRACTION_VALID', {
|
||||
valid: Infractions.join(`, `)
|
||||
})}`
|
||||
});
|
||||
if (response.error) return response;
|
||||
|
||||
const infs = response.split(' ')
|
||||
.map((inf) => this.client.resolver.resolveInfraction(inf))
|
||||
.filter((inf) => inf !== null);
|
||||
this[infractions.value](setting.infractions, infs);
|
||||
}
|
||||
|
||||
return { index: 'SETTING_SUCCESS_ALT' };
|
||||
|
||||
}
|
||||
|
||||
fields(guild) {
|
||||
const setting = guild._settings[this.name];
|
||||
return [
|
||||
{
|
||||
name: 'GENERAL_STATUS',
|
||||
value: guild.format('GENERAL_STATE', { bool: Boolean(setting.channel) }, { code: true }),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'GENERAL_CHANNEL',
|
||||
value: `<#${setting.channel}>`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'GENERAL_INFRACTIONS',
|
||||
value: setting.infractions.join(', ')
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ModerationLog;
|
51
src/structure/components/settings/logging/Nicknames.js
Normal file
51
src/structure/components/settings/logging/Nicknames.js
Normal file
@ -0,0 +1,51 @@
|
||||
const { Setting, CommandOption } = require("../../../interfaces");
|
||||
|
||||
class Nicknames extends Setting {
|
||||
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'nicknames',
|
||||
description: 'Configure logging of nicknames',
|
||||
module: 'logging',
|
||||
default: {
|
||||
channel: null
|
||||
},
|
||||
definitions: {
|
||||
channel: 'GUILD_TEXT'
|
||||
},
|
||||
commandOptions: [
|
||||
new CommandOption({
|
||||
name: 'channel',
|
||||
type: 'TEXT_CHANNEL',
|
||||
description: 'Set the channel for nickname logging'
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction, opts, setting) {
|
||||
|
||||
setting.channel = opts.channel.value.id;
|
||||
return { index: 'SETTING_SUCCESS_ALT' };
|
||||
|
||||
}
|
||||
|
||||
fields(guild) {
|
||||
const setting = guild._settings[this.name];
|
||||
return [
|
||||
{
|
||||
name: 'GENERAL_STATUS',
|
||||
value: guild.format('GENERAL_STATE', { bool: Boolean(setting.channel) }, { code: true }),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'GENERAL_CHANNEL',
|
||||
value: `<#${setting.channel}>`,
|
||||
inline: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Nicknames;
|
51
src/structure/components/settings/logging/Voice.js
Normal file
51
src/structure/components/settings/logging/Voice.js
Normal file
@ -0,0 +1,51 @@
|
||||
const { Setting, CommandOption } = require("../../../interfaces");
|
||||
|
||||
class Voice extends Setting {
|
||||
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'voice',
|
||||
description: 'Configure logging of joining and leaving voice channels',
|
||||
module: 'logging',
|
||||
default: {
|
||||
channel: null
|
||||
},
|
||||
definitions: {
|
||||
channel: 'GUILD_TEXT'
|
||||
},
|
||||
commandOptions: [
|
||||
new CommandOption({
|
||||
name: 'channel',
|
||||
type: 'TEXT_CHANNEL',
|
||||
description: 'Set the channel for voice join/leave logging'
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction, opts, setting) {
|
||||
|
||||
setting.channel = opts.channel.value.id;
|
||||
return { index: 'SETTING_SUCCESS_ALT' };
|
||||
|
||||
}
|
||||
|
||||
fields(guild) {
|
||||
const setting = guild._settings[this.name];
|
||||
return [
|
||||
{
|
||||
name: 'GENERAL_STATUS',
|
||||
value: guild.format('GENERAL_STATE', { bool: Boolean(setting.channel) }, { code: true }),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'GENERAL_CHANNEL',
|
||||
value: `<#${setting.channel}>`,
|
||||
inline: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Voice;
|
@ -55,7 +55,8 @@ class WordFilterSetting extends FilterSetting {
|
||||
{ name: 'reset', value: 'reset' },
|
||||
{ name: 'edit', value: 'edit' },
|
||||
{ name: 'list', value: 'list' }
|
||||
]
|
||||
],
|
||||
dependsOn: ['list']
|
||||
}),
|
||||
new CommandOption({
|
||||
type: 'STRING',
|
||||
@ -70,7 +71,8 @@ class WordFilterSetting extends FilterSetting {
|
||||
{ name: 'bypass', value: 'bypass' },
|
||||
{ name: 'ignore', value: 'ignore' },
|
||||
{ name: 'actions', value: 'actions' },
|
||||
]
|
||||
],
|
||||
dependsOn: ['method']
|
||||
}),
|
||||
new CommandOption({
|
||||
type: 'BOOLEAN',
|
Loading…
Reference in New Issue
Block a user