infractions thing

This commit is contained in:
Erik 2022-07-23 14:42:53 +03:00
parent 39d7c0bbb9
commit 43fd3e9c7e
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
34 changed files with 52 additions and 40 deletions

View File

@ -5,7 +5,7 @@ const { inspect } = require('util');
const { Emojis, Constants } = require('../../constants');
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 = {
MaxTargets: 10, //10+(10*premium-tier), theoretical max = 40
@ -252,7 +252,10 @@ class ModerationManager {
points = info.points || modpoints.points[type];
expiration = info.expiration || modpoints.expirations[type];
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;
}
}
}

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Ban } = require("../../infractions/");
const { Ban } = require("../../../infractions/");
class BanCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Nickname } = require("../../infractions");
const { Nickname } = require("../../../infractions");
class DehoistCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand } = require('../../../interfaces');
const { Kick } = require('../../infractions');
const { Kick } = require('../../../infractions');
class KickCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require('../../../interfaces');
const { Lockdown } = require('../../infractions');
const { Lockdown } = require('../../../infractions');
class LockdownCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require('../../../interfaces');
const { Mute } = require('../../infractions');
const { Mute } = require('../../../infractions');
class MuteCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Nickname } = require("../../infractions");
const { Nickname } = require("../../../infractions");
class NicknameCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Note } = require("../../infractions");
const { Note } = require("../../../infractions");
class NoteCommand extends ModerationCommand {
constructor(client) {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require('../../../interfaces');
const { Prune } = require('../../infractions');
const { Prune } = require('../../../infractions');
class PruneCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Addrole, Removerole } = require("../../infractions");
const { Addrole, Removerole } = require("../../../infractions");
class AddroleCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand } = require("../../../interfaces");
const { Slowmode } = require("../../infractions");
const { Slowmode } = require("../../../infractions");
class SlowmodeCommand extends ModerationCommand {
constructor(client) {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Softban } = require("../../infractions");
const { Softban } = require("../../../infractions");
class SoftbanCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require("../../../interfaces");
const { Unban } = require("../../infractions");
const { Unban } = require("../../../infractions");
class UnbanCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require('../../../interfaces');
const { Unlockdown } = require('../../infractions');
const { Unlockdown } = require('../../../infractions');
class UnlockdownCommand extends ModerationCommand {

View File

@ -1,5 +1,5 @@
const { ModerationCommand, CommandError } = require('../../../interfaces');
const { Unmute } = require('../../infractions');
const { Unmute } = require('../../../infractions');
class UnmuteCommand extends ModerationCommand {
@ -12,7 +12,7 @@ class UnmuteCommand extends ModerationCommand {
guildOnly: true,
showUsage: true,
memberPermissions: ['ModerateMembers'],
clientPermissions: ['ManageRoles', 'ModerateMembers'],
// clientPermissions: ['ManageRoles', 'ModerateMembers'],
skipOptions: ['points', 'expiration', 'prune', 'force']
});
}
@ -20,6 +20,11 @@ class UnmuteCommand extends ModerationCommand {
async execute(interaction, { users, ...args }) {
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, {
targets: users.value,

View File

@ -1,5 +1,5 @@
const { ModerationCommand } = require("../../../interfaces");
const { Warn } = require("../../infractions");
const { Warn } = require("../../../infractions");
class WarnCommand extends ModerationCommand {
constructor(client) {

View File

@ -5,7 +5,7 @@ const { stripIndents } = require('common-tags');
const { Observer } = require('../../interfaces');
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 CONSTANTS = {
@ -649,7 +649,11 @@ module.exports = class AutoModeration extends Observer {
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';
});

View File

@ -1,6 +1,6 @@
/* eslint-disable indent */
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class AddroleInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
/* eslint-disable indent */
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
const { GuildMember } = require('discord.js');
class BanInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class KickInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
const { OverwriteType } = require('discord.js');
const { Infraction } = require('../../interfaces/');
const { Infraction } = require('../interfaces/');
const allowedPermissions = ['ManageMessages', 'ManageChannels'];

View File

@ -1,6 +1,6 @@
/* eslint-disable indent */
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class MuteInfraction extends Infraction {

View File

@ -1,8 +1,8 @@
const { Infraction } = require('../../interfaces/');
const { Infraction } = require('../interfaces/');
const escapeRegex = require('escape-string-regexp');
const { Util } = require('../../../utilities');
const { KillItWithFire } = require('../../../constants');
const { Util } = require('../../utilities');
const { KillItWithFire } = require('../../constants');
const { GuildMember } = require('discord.js');
const Constants = {

View File

@ -1,4 +1,4 @@
const { Infraction } = require('../../interfaces/');
const { Infraction } = require('../interfaces/');
class NoteInfraction extends Infraction {

View File

@ -1,4 +1,4 @@
const { Infraction } = require('../../interfaces/');
const { Infraction } = require('../interfaces/');
const { Collection } = require('@discordjs/collection');
const { MessageType } = require('discord.js');

View File

@ -1,6 +1,6 @@
/* eslint-disable indent */
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class RemoveroleInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
const { Infraction } = require('../../interfaces');
const { Util } = require('../../../utilities');
const { Infraction } = require('../interfaces');
const { Util } = require('../../utilities');
class SlowmodeInfraction extends Infraction {

View File

@ -1,4 +1,4 @@
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
const { GuildMember } = require('discord.js');
class SoftbanInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
/* eslint-disable indent */
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class UnbanInfraction extends Infraction {

View File

@ -1,4 +1,4 @@
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class UnlockdownInfraction extends Infraction {

View File

@ -1,6 +1,6 @@
/* eslint-disable indent */
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class UnmuteInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class VckickInfraction extends Infraction {

View File

@ -1,5 +1,5 @@
const { GuildMember } = require('discord.js');
const { Infraction } = require('../../interfaces');
const { Infraction } = require('../interfaces');
class WarnInfraction extends Infraction {

View File

@ -101,7 +101,7 @@ class Infraction {
this._logMessage = await this._moderationLog.send({ embeds: [this._embed()] });
this.modLogMessageId = this._logMessage.id;
} catch (e) {
console.log(e);
// console.log(e);
} //eslint-disable-line no-empty
}