diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-09-05 17:36:42 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-09-05 17:36:42 -0400 |
commit | 048f99752550c6e03d1990a03cad78f3ac7d73aa (patch) | |
tree | c238ac29b1b526e86bcbc4989036df981c860187 /src/inhibitors/command | |
parent | 6f8a4d13a490eda7a195d14833c83810f7b5a789 (diff) | |
download | tanzanite-048f99752550c6e03d1990a03cad78f3ac7d73aa.tar.gz tanzanite-048f99752550c6e03d1990a03cad78f3ac7d73aa.tar.bz2 tanzanite-048f99752550c6e03d1990a03cad78f3ac7d73aa.zip |
revamp command permissions, fix permission exploit for some command when used in forum channels, use enums more
Diffstat (limited to 'src/inhibitors/command')
-rw-r--r-- | src/inhibitors/command/disabledGlobal.ts (renamed from src/inhibitors/command/globalDisabledCommand.ts) | 12 | ||||
-rw-r--r-- | src/inhibitors/command/disabledGuild.ts (renamed from src/inhibitors/command/guildDisabledCommand.ts) | 12 | ||||
-rw-r--r-- | src/inhibitors/command/dm.ts | 8 | ||||
-rw-r--r-- | src/inhibitors/command/guild.ts | 10 | ||||
-rw-r--r-- | src/inhibitors/command/notNsfw.ts (renamed from src/inhibitors/command/nsfw.ts) | 12 | ||||
-rw-r--r-- | src/inhibitors/command/owner.ts | 10 | ||||
-rw-r--r-- | src/inhibitors/command/restrictedChannel.ts | 10 | ||||
-rw-r--r-- | src/inhibitors/command/restrictedGuild.ts | 10 | ||||
-rw-r--r-- | src/inhibitors/command/superUser.ts | 8 |
9 files changed, 46 insertions, 46 deletions
diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/disabledGlobal.ts index 4a93f2f..bfb5969 100644 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ b/src/inhibitors/command/disabledGlobal.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class DisabledGuildCommandInhibitor extends BotInhibitor { +export default class DisabledGlobalInhibitor extends BotInhibitor { public constructor() { - super('disabledGlobalCommand', { - reason: 'disabledGlobal', - type: 'post', + super(InhibitorReason.DisabledGlobal, { + reason: InhibitorReason.DisabledGlobal, + type: InhibitorType.Post, priority: 300 }); } @@ -13,7 +13,7 @@ export default class DisabledGuildCommandInhibitor extends BotInhibitor { if (message.author.isOwner()) return false; if (this.client.cache.global.disabledCommands.includes(command?.id)) { void this.client.console.verbose( - 'disabledGlobalCommand', + InhibitorReason.DisabledGlobal, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/disabledGuild.ts index 97ac995..0df827d 100644 --- a/src/inhibitors/command/guildDisabledCommand.ts +++ b/src/inhibitors/command/disabledGuild.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class DisabledGuildCommandInhibitor extends BotInhibitor { +export default class DisabledGuildInhibitor extends BotInhibitor { public constructor() { - super('disabledGuildCommand', { - reason: 'disabledGuild', - type: 'post', + super(InhibitorReason.DisabledGuild, { + reason: InhibitorReason.DisabledGuild, + type: InhibitorType.Post, priority: 250 }); } @@ -15,7 +15,7 @@ export default class DisabledGuildCommandInhibitor extends BotInhibitor { if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { void this.client.console.verbose( - 'disabledGuildCommand', + InhibitorReason.DisabledGuild, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); return true; diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts index f25f542..aa39b94 100644 --- a/src/inhibitors/command/dm.ts +++ b/src/inhibitors/command/dm.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class DMInhibitor extends BotInhibitor { public constructor() { - super('dm', { - reason: 'dm', - type: 'post', + super(InhibitorReason.Dm, { + reason: InhibitorReason.Dm, + type: InhibitorType.Post, priority: 75 }); } diff --git a/src/inhibitors/command/guild.ts b/src/inhibitors/command/guild.ts index 1d70c7d..24e2577 100644 --- a/src/inhibitors/command/guild.ts +++ b/src/inhibitors/command/guild.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class GuildInhibitor extends BotInhibitor { public constructor() { - super('guild', { - reason: 'guild', - type: 'post', + super(InhibitorReason.Guild, { + reason: InhibitorReason.Guild, + type: InhibitorType.Post, priority: 80 }); } @@ -12,7 +12,7 @@ export default class GuildInhibitor extends BotInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.channel === 'guild' && !message.guild) { void this.client.console.verbose( - 'guild', + InhibitorReason.Guild, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.author.tag}>>.` ); return true; diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/notNsfw.ts index 623115e..08e5556 100644 --- a/src/inhibitors/command/nsfw.ts +++ b/src/inhibitors/command/notNsfw.ts @@ -1,11 +1,11 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; import { type TextChannel } from 'discord.js'; -export default class NsfwInhibitor extends BotInhibitor { +export default class NotNsfwInhibitor extends BotInhibitor { public constructor() { - super('nsfw', { - reason: 'notNsfw', - type: 'post', + super(InhibitorReason.NotNsfw, { + reason: InhibitorReason.NotNsfw, + type: InhibitorType.Post, priority: 25 }); } @@ -13,7 +13,7 @@ export default class NsfwInhibitor extends BotInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { void this.client.console.verbose( - 'notNsfw', + InhibitorReason.NotNsfw, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/owner.ts b/src/inhibitors/command/owner.ts index 15643be..8736cff 100644 --- a/src/inhibitors/command/owner.ts +++ b/src/inhibitors/command/owner.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class OwnerInhibitor extends BotInhibitor { public constructor() { - super('owner', { - reason: 'owner', - type: 'post', + super(InhibitorReason.Owner, { + reason: InhibitorReason.Owner, + type: InhibitorType.Post, priority: 100 }); } @@ -13,7 +13,7 @@ export default class OwnerInhibitor extends BotInhibitor { if (command.ownerOnly) { if (!this.client.isOwner(message.author)) { void this.client.console.verbose( - 'owner', + InhibitorReason.Owner, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/restrictedChannel.ts b/src/inhibitors/command/restrictedChannel.ts index ec23604..bfacebc 100644 --- a/src/inhibitors/command/restrictedChannel.ts +++ b/src/inhibitors/command/restrictedChannel.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class RestrictedChannelInhibitor extends BotInhibitor { public constructor() { - super('restrictedChannel', { - reason: 'restrictedChannel', - type: 'post', + super(InhibitorReason.RestrictedChannel, { + reason: InhibitorReason.RestrictedChannel, + type: InhibitorType.Post, priority: 10 }); } @@ -13,7 +13,7 @@ export default class RestrictedChannelInhibitor extends BotInhibitor { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { void this.client.console.verbose( - 'restrictedChannel', + InhibitorReason.RestrictedChannel, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/restrictedGuild.ts b/src/inhibitors/command/restrictedGuild.ts index ec0ad2c..4520cbc 100644 --- a/src/inhibitors/command/restrictedGuild.ts +++ b/src/inhibitors/command/restrictedGuild.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class RestrictedGuildInhibitor extends BotInhibitor { public constructor() { - super('restrictedGuild', { - reason: 'restrictedGuild', - type: 'post', + super(InhibitorReason.RestrictedGuild, { + reason: InhibitorReason.RestrictedGuild, + type: InhibitorType.Post, priority: 5 }); } @@ -13,7 +13,7 @@ export default class RestrictedGuildInhibitor extends BotInhibitor { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { void this.client.console.verbose( - 'restrictedGuild', + InhibitorReason.RestrictedGuild, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/superUser.ts b/src/inhibitors/command/superUser.ts index a923c1a..dd71539 100644 --- a/src/inhibitors/command/superUser.ts +++ b/src/inhibitors/command/superUser.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class SuperUserInhibitor extends BotInhibitor { public constructor() { - super('superUser', { - reason: 'superUser', - type: 'post', + super(InhibitorReason.SuperUser, { + reason: InhibitorReason.SuperUser, + type: InhibitorType.Post, priority: 99 }); } |