galactic-bot/structure/client/components/settings/moderation/DmInfraction.js

100 lines
2.7 KiB
JavaScript
Raw Normal View History

2020-06-04 19:59:09 +02:00
const { Setting } = require('../../../../interfaces/');
2020-08-31 18:47:20 +02:00
const Constants = {
Infractions: [
'NOTE',
'WARN',
'MUTE',
'UNMUTE',
'KICK',
'SOFTBAN',
'BAN',
'UNBAN',
'VCMUTE',
'VCUNMUTE',
'VCKICK',
'VCBAN',
'VCUNBAN',
'REMOVEROLE',
'ADDROLE',
'NICKNAME'
]
};
2020-06-04 19:59:09 +02:00
class DmInfractionSetting extends Setting {
constructor(client) {
super(client, {
name: 'dmInfraction',
module: 'moderation',
aliases: [
'directMessageInfraction',
'privateLog',
'dmLog'// idk...
],
2020-08-31 18:47:20 +02:00
usage: "<boolean|method> <value>",
examples: [
"dmInfraction off",
"dmInfraction - warning mute",
"dmInfraction default You have been {infraction-past} in the server {servername}.",
"dmInfraction ban You have been banned! If you would like to appeal this ban, please visit this link: https://google.com/"
],
2020-06-04 19:59:09 +02:00
default: {
dmInfraction: {
enabled: true,
2020-08-31 18:47:20 +02:00
infractions: ['WARN', 'MUTE', 'UNMUTE', 'KICK', 'SOFTBAN', 'BAN', 'UNBAN', 'VCMUTE', 'VCUNMUTE', 'VCKICK', 'VCBAN', 'VCUNBAN'],
messages: {
2020-07-20 00:42:21 +02:00
default: "You were **{infraction}** {from|on} the server `{server}`, your infraction details are below."
2020-06-04 19:59:09 +02:00
//BAN: etc
}
}
},
archivable: false
2020-06-04 19:59:09 +02:00
});
}
async handle(message, args) {
2020-08-31 18:47:20 +02:00
const setting = message.guild._settings[this.index];
const boolean = this.client.resolver.resolveBoolean(args.join(' '));
if(boolean !== null) {
await message.guild._updateSettings({
[this.index]: {
...setting,
enabled: boolean
}
});
return {
msg: message.format('S_DMINFRACTION_TOGGLESUCCESS', { boolean: message.format('SETTING_ENABLEDISABLE', boolean) }),
error: false
};
}
const result = this.client.resolver.list(
setting.infractions,
Constants.Infractions,
args,
this.client.resolver.resolveInfractions.bind(this.client.resolver)
);
2020-08-31 16:50:20 +02:00
// if(result) {
// const method =
// }
2020-06-04 19:59:09 +02:00
}
async fields(guild) {
const setting = guild._settings[this.index];
2020-08-31 18:47:20 +02:00
return [
{
}
];
2020-06-04 19:59:09 +02:00
}
}
module.exports = DmInfractionSetting;