infractions thing
This commit is contained in:
parent
39d7c0bbb9
commit
43fd3e9c7e
@ -5,7 +5,7 @@ const { inspect } = require('util');
|
|||||||
|
|
||||||
const { Emojis, Constants } = require('../../constants');
|
const { Emojis, Constants } = require('../../constants');
|
||||||
const { Util, Logger } = require('../../utilities');
|
const { Util, Logger } = require('../../utilities');
|
||||||
const { Warn, Unmute, Mute, Kick, Softban, Unban, Ban, Addrole, Removerole, Lockdown, Unlockdown } = require('../components/infractions');
|
const { Warn, Unmute, Mute, Kick, Softban, Unban, Ban, Addrole, Removerole, Lockdown, Unlockdown } = require('../infractions');
|
||||||
|
|
||||||
const Constant = {
|
const Constant = {
|
||||||
MaxTargets: 10, //10+(10*premium-tier), theoretical max = 40
|
MaxTargets: 10, //10+(10*premium-tier), theoretical max = 40
|
||||||
@ -252,7 +252,10 @@ class ModerationManager {
|
|||||||
points = info.points || modpoints.points[type];
|
points = info.points || modpoints.points[type];
|
||||||
expiration = info.expiration || modpoints.expirations[type];
|
expiration = info.expiration || modpoints.expirations[type];
|
||||||
if(reason) for (const [phrase, amount] of Object.entries(modpoints.associations)) {
|
if(reason) for (const [phrase, amount] of Object.entries(modpoints.associations)) {
|
||||||
if (reason.toLowerCase().includes(phrase)) points = amount;
|
if (reason.toLowerCase().includes(phrase)) {
|
||||||
|
points = amount;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Ban } = require("../../infractions/");
|
const { Ban } = require("../../../infractions/");
|
||||||
|
|
||||||
class BanCommand extends ModerationCommand {
|
class BanCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Nickname } = require("../../infractions");
|
const { Nickname } = require("../../../infractions");
|
||||||
|
|
||||||
class DehoistCommand extends ModerationCommand {
|
class DehoistCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand } = require('../../../interfaces');
|
const { ModerationCommand } = require('../../../interfaces');
|
||||||
const { Kick } = require('../../infractions');
|
const { Kick } = require('../../../infractions');
|
||||||
|
|
||||||
class KickCommand extends ModerationCommand {
|
class KickCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
||||||
const { Lockdown } = require('../../infractions');
|
const { Lockdown } = require('../../../infractions');
|
||||||
|
|
||||||
class LockdownCommand extends ModerationCommand {
|
class LockdownCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
||||||
const { Mute } = require('../../infractions');
|
const { Mute } = require('../../../infractions');
|
||||||
|
|
||||||
class MuteCommand extends ModerationCommand {
|
class MuteCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Nickname } = require("../../infractions");
|
const { Nickname } = require("../../../infractions");
|
||||||
|
|
||||||
class NicknameCommand extends ModerationCommand {
|
class NicknameCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Note } = require("../../infractions");
|
const { Note } = require("../../../infractions");
|
||||||
|
|
||||||
class NoteCommand extends ModerationCommand {
|
class NoteCommand extends ModerationCommand {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
||||||
const { Prune } = require('../../infractions');
|
const { Prune } = require('../../../infractions');
|
||||||
|
|
||||||
class PruneCommand extends ModerationCommand {
|
class PruneCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Addrole, Removerole } = require("../../infractions");
|
const { Addrole, Removerole } = require("../../../infractions");
|
||||||
|
|
||||||
class AddroleCommand extends ModerationCommand {
|
class AddroleCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand } = require("../../../interfaces");
|
const { ModerationCommand } = require("../../../interfaces");
|
||||||
const { Slowmode } = require("../../infractions");
|
const { Slowmode } = require("../../../infractions");
|
||||||
|
|
||||||
class SlowmodeCommand extends ModerationCommand {
|
class SlowmodeCommand extends ModerationCommand {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Softban } = require("../../infractions");
|
const { Softban } = require("../../../infractions");
|
||||||
|
|
||||||
class SoftbanCommand extends ModerationCommand {
|
class SoftbanCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
const { ModerationCommand, CommandError } = require("../../../interfaces");
|
||||||
const { Unban } = require("../../infractions");
|
const { Unban } = require("../../../infractions");
|
||||||
|
|
||||||
class UnbanCommand extends ModerationCommand {
|
class UnbanCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
||||||
const { Unlockdown } = require('../../infractions');
|
const { Unlockdown } = require('../../../infractions');
|
||||||
|
|
||||||
class UnlockdownCommand extends ModerationCommand {
|
class UnlockdownCommand extends ModerationCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
const { ModerationCommand, CommandError } = require('../../../interfaces');
|
||||||
const { Unmute } = require('../../infractions');
|
const { Unmute } = require('../../../infractions');
|
||||||
|
|
||||||
class UnmuteCommand extends ModerationCommand {
|
class UnmuteCommand extends ModerationCommand {
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ class UnmuteCommand extends ModerationCommand {
|
|||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
showUsage: true,
|
showUsage: true,
|
||||||
memberPermissions: ['ModerateMembers'],
|
memberPermissions: ['ModerateMembers'],
|
||||||
clientPermissions: ['ManageRoles', 'ModerateMembers'],
|
// clientPermissions: ['ManageRoles', 'ModerateMembers'],
|
||||||
skipOptions: ['points', 'expiration', 'prune', 'force']
|
skipOptions: ['points', 'expiration', 'prune', 'force']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -20,6 +20,11 @@ class UnmuteCommand extends ModerationCommand {
|
|||||||
async execute(interaction, { users, ...args }) {
|
async execute(interaction, { users, ...args }) {
|
||||||
|
|
||||||
if (!users) throw new CommandError(interaction, { index: 'MODERATION_MISSING_USERS' });
|
if (!users) throw new CommandError(interaction, { index: 'MODERATION_MISSING_USERS' });
|
||||||
|
const { guild } = interaction;
|
||||||
|
const settings = await guild.settings();
|
||||||
|
const { type } = settings.mute;
|
||||||
|
if (type === 3 && !guild.members.me.permissions.has('ModerateMembers')) throw new CommandError(interaction, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', params: { command: this.name, missing: 'ModerateMembers' } });
|
||||||
|
else if (!guild.members.me.permissions.has('ManageRoles')) throw new CommandError(interaction, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', params: { command: this.name, missing: 'ManageRoles' } });
|
||||||
|
|
||||||
return this.client.moderationManager.handleInfraction(Unmute, interaction, {
|
return this.client.moderationManager.handleInfraction(Unmute, interaction, {
|
||||||
targets: users.value,
|
targets: users.value,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { ModerationCommand } = require("../../../interfaces");
|
const { ModerationCommand } = require("../../../interfaces");
|
||||||
const { Warn } = require("../../infractions");
|
const { Warn } = require("../../../infractions");
|
||||||
|
|
||||||
class WarnCommand extends ModerationCommand {
|
class WarnCommand extends ModerationCommand {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
@ -5,7 +5,7 @@ const { stripIndents } = require('common-tags');
|
|||||||
|
|
||||||
const { Observer } = require('../../interfaces');
|
const { Observer } = require('../../interfaces');
|
||||||
const { BinaryTree, Util, FilterUtil } = require('../../../utilities');
|
const { BinaryTree, Util, FilterUtil } = require('../../../utilities');
|
||||||
const { Warn, Mute, Kick, Softban, Ban } = require('../infractions');
|
const { Warn, Mute, Kick, Softban, Ban } = require('../../infractions');
|
||||||
const { ComponentType, ButtonStyle } = require('discord.js');
|
const { ComponentType, ButtonStyle } = require('discord.js');
|
||||||
|
|
||||||
const CONSTANTS = {
|
const CONSTANTS = {
|
||||||
@ -649,7 +649,11 @@ module.exports = class AutoModeration extends Observer {
|
|||||||
|
|
||||||
if (actions.length) {
|
if (actions.length) {
|
||||||
|
|
||||||
const action = actions.find((act) => {
|
let action = actions.find((act) => {
|
||||||
|
return act.trigger <= ids.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!action) action = actions.find((act) => {
|
||||||
return act.trigger === 'generic';
|
return act.trigger === 'generic';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class AddroleInfraction extends Infraction {
|
class AddroleInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
|
|
||||||
class BanInfraction extends Infraction {
|
class BanInfraction extends Infraction {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class KickInfraction extends Infraction {
|
class KickInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { OverwriteType } = require('discord.js');
|
const { OverwriteType } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces/');
|
const { Infraction } = require('../interfaces/');
|
||||||
|
|
||||||
const allowedPermissions = ['ManageMessages', 'ManageChannels'];
|
const allowedPermissions = ['ManageMessages', 'ManageChannels'];
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class MuteInfraction extends Infraction {
|
class MuteInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const { Infraction } = require('../../interfaces/');
|
const { Infraction } = require('../interfaces/');
|
||||||
const escapeRegex = require('escape-string-regexp');
|
const escapeRegex = require('escape-string-regexp');
|
||||||
|
|
||||||
const { Util } = require('../../../utilities');
|
const { Util } = require('../../utilities');
|
||||||
const { KillItWithFire } = require('../../../constants');
|
const { KillItWithFire } = require('../../constants');
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
|
|
||||||
const Constants = {
|
const Constants = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const { Infraction } = require('../../interfaces/');
|
const { Infraction } = require('../interfaces/');
|
||||||
|
|
||||||
class NoteInfraction extends Infraction {
|
class NoteInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const { Infraction } = require('../../interfaces/');
|
const { Infraction } = require('../interfaces/');
|
||||||
const { Collection } = require('@discordjs/collection');
|
const { Collection } = require('@discordjs/collection');
|
||||||
const { MessageType } = require('discord.js');
|
const { MessageType } = require('discord.js');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class RemoveroleInfraction extends Infraction {
|
class RemoveroleInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
const { Util } = require('../../../utilities');
|
const { Util } = require('../../utilities');
|
||||||
|
|
||||||
class SlowmodeInfraction extends Infraction {
|
class SlowmodeInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
|
|
||||||
class SoftbanInfraction extends Infraction {
|
class SoftbanInfraction extends Infraction {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class UnbanInfraction extends Infraction {
|
class UnbanInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class UnlockdownInfraction extends Infraction {
|
class UnlockdownInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class UnmuteInfraction extends Infraction {
|
class UnmuteInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class VckickInfraction extends Infraction {
|
class VckickInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const { GuildMember } = require('discord.js');
|
const { GuildMember } = require('discord.js');
|
||||||
const { Infraction } = require('../../interfaces');
|
const { Infraction } = require('../interfaces');
|
||||||
|
|
||||||
class WarnInfraction extends Infraction {
|
class WarnInfraction extends Infraction {
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class Infraction {
|
|||||||
this._logMessage = await this._moderationLog.send({ embeds: [this._embed()] });
|
this._logMessage = await this._moderationLog.send({ embeds: [this._embed()] });
|
||||||
this.modLogMessageId = this._logMessage.id;
|
this.modLogMessageId = this._logMessage.id;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
// console.log(e);
|
||||||
} //eslint-disable-line no-empty
|
} //eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user