diff options
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r-- | src/commands/moulberry-bush/capePermissions.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/capes.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/gimmeRole.ts | 42 | ||||
-rw-r--r-- | src/commands/moulberry-bush/giveawayPing.ts | 13 | ||||
-rw-r--r-- | src/commands/moulberry-bush/moulHammer.ts | 7 | ||||
-rw-r--r-- | src/commands/moulberry-bush/neuRepo.ts | 13 | ||||
-rw-r--r-- | src/commands/moulberry-bush/report.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 16 | ||||
-rw-r--r-- | src/commands/moulberry-bush/serverStatus.ts | 7 | ||||
-rw-r--r-- | src/commands/moulberry-bush/solved.ts | 4 |
10 files changed, 73 insertions, 47 deletions
diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts index fdeddd8..6f7ac4a 100644 --- a/src/commands/moulberry-bush/capePermissions.ts +++ b/src/commands/moulberry-bush/capePermissions.ts @@ -1,7 +1,6 @@ import { AllowedMentions, BotCommand, - clientSendAndPermCheck, colors, emojis, format, @@ -10,7 +9,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; export default class CapePermissionsCommand extends BotCommand { public constructor() { @@ -31,7 +30,8 @@ export default class CapePermissionsCommand extends BotCommand { } ], slash: true, - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [], channel: 'guild' }); diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 79c163f..b292f24 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -2,7 +2,6 @@ import { AllowedMentions, BotCommand, ButtonPaginator, - clientSendAndPermCheck, colors, DeleteButton, emojis, @@ -13,7 +12,7 @@ import { type SlashMessage } from '#lib'; import assert from 'assert/strict'; -import { ApplicationCommandOptionType, PermissionFlagsBits, type APIEmbed, type AutocompleteInteraction } from 'discord.js'; +import { ApplicationCommandOptionType, type APIEmbed, type AutocompleteInteraction } from 'discord.js'; import { default as Fuse } from 'fuse.js'; assert(Fuse); @@ -39,7 +38,8 @@ export default class CapesCommand extends BotCommand { } ], slash: true, - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [] }); } diff --git a/src/commands/moulberry-bush/gimmeRole.ts b/src/commands/moulberry-bush/gimmeRole.ts new file mode 100644 index 0000000..2e3cc77 --- /dev/null +++ b/src/commands/moulberry-bush/gimmeRole.ts @@ -0,0 +1,42 @@ +import { BotCommand, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib'; +import assert from 'assert/strict'; + +export default class GimmeRole extends BotCommand { + public constructor() { + super('gimmeRole', { + aliases: ['gimme-role', 'gimme'], + category: "Moulberry's Bush", + description: 'Gives you role.', + usage: ['gimme-role'], + examples: ['gimme-role'], + slash: false, + channel: 'guild', + clientPermissions: [], + userPermissions: [], + restrictedGuilds: [mappings.guilds["Moulberry's Bush"]] + }); + } + + public override async exec(message: CommandMessage | SlashMessage) { + assert(message.inGuild() && message.member); + assert(message.guildId === mappings.guilds["Moulberry's Bush"]); + + const roleId = '1016149863651622923'; + + try { + if (!message.guild.roles.cache.has(roleId)) { + return await message.util.reply(`${emojis.error} Fucky wucky, the role does not exist.`); + } + + if (message.member.roles.cache.has(roleId)) { + await message.member.roles.remove(roleId); + return await message.util.reply(`${emojis.success} Removed role.`); + } else { + await message.member.roles.add(roleId); + return await message.util.reply(`${emojis.success} Added role.`); + } + } catch { + return message.util.reply(`${emojis.error} Fucky wucky, an error occurred.`); + } + } +} diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index aebcc52..ef08473 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,4 +1,4 @@ -import { AllowedMentions, BotCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage } from '#lib'; +import { AllowedMentions, BotCommand, emojis, mappings, type CommandMessage } from '#lib'; import assert from 'assert/strict'; import { PermissionFlagsBits } from 'discord.js'; @@ -10,14 +10,9 @@ export default class GiveawayPingCommand extends BotCommand { description: 'Pings the giveaway role.', usage: ['giveaway-ping'], examples: ['giveaway-ping'], - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.ManageMessages], true), - userPermissions: [ - PermissionFlagsBits.ManageGuild, - PermissionFlagsBits.ManageMessages, - PermissionFlagsBits.BanMembers, - PermissionFlagsBits.KickMembers, - PermissionFlagsBits.ViewChannel - ], + clientPermissions: ['ManageMessages'], + clientCheckChannel: true, + userPermissions: ['ManageGuild', 'ManageMessages', 'BanMembers', 'KickMembers', 'ViewChannel'], channel: 'guild', ignoreCooldown: [], ignorePermissions: [], diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 0407428..776dea1 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,6 +1,6 @@ -import { BotCommand, clientSendAndPermCheck, colors, mappings, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, colors, mappings, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; -import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; export default class MoulHammerCommand extends BotCommand { public constructor() { @@ -24,7 +24,8 @@ export default class MoulHammerCommand extends BotCommand { channel: 'guild', slashGuilds: [mappings.guilds["Moulberry's Bush"]], restrictedGuilds: [mappings.guilds["Moulberry's Bush"]], - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [] }); } diff --git a/src/commands/moulberry-bush/neuRepo.ts b/src/commands/moulberry-bush/neuRepo.ts index d8eb7ed..9ff2903 100644 --- a/src/commands/moulberry-bush/neuRepo.ts +++ b/src/commands/moulberry-bush/neuRepo.ts @@ -1,12 +1,6 @@ -import { BotCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import canvas from '@napi-rs/canvas'; -import { - ApplicationCommandOptionType, - AttachmentBuilder, - AutocompleteInteraction, - CacheType, - PermissionFlagsBits -} from 'discord.js'; +import { ApplicationCommandOptionType, AttachmentBuilder, AutocompleteInteraction, CacheType } from 'discord.js'; import { join } from 'path'; import tinycolor from 'tinycolor2'; import { formattingInfo, RawNeuItem } from '../../../lib/utils/Minecraft.js'; @@ -43,7 +37,8 @@ export default class NeuRepoCommand extends BotCommand { } */ ], slash: false, - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [], ownerOnly: true, hidden: true diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 8eb412c..02de6fe 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,7 +1,6 @@ import { AllowedMentions, BotCommand, - clientSendAndPermCheck, colors, emojis, mappings, @@ -11,7 +10,7 @@ import { } from '#lib'; import { stripIndent } from '#tags'; import assert from 'assert/strict'; -import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; export default class ReportCommand extends BotCommand { public constructor() { @@ -42,7 +41,8 @@ export default class ReportCommand extends BotCommand { } ], slash: true, - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [], channel: 'guild' }); diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 5f2155f..b4ca571 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,15 +1,6 @@ -import { - AllowedMentions, - Arg, - BotCommand, - clientSendAndPermCheck, - mappings, - type CommandMessage, - type OptArgType, - type SlashMessage -} from '#lib'; +import { AllowedMentions, Arg, BotCommand, mappings, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; import { stripIndent } from '#tags'; -import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; const rules = [ { @@ -101,7 +92,8 @@ export default class RuleCommand extends BotCommand { slash: true, slashGuilds: [mappings.guilds["Moulberry's Bush"]], channel: 'guild', - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [], restrictedGuilds: [mappings.guilds["Moulberry's Bush"]] }); diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 709de26..8e59c9f 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -1,5 +1,5 @@ -import { BotCommand, clientSendAndPermCheck, colors, emojis, type CommandMessage } from '#lib'; -import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; +import { BotCommand, colors, emojis, type CommandMessage } from '#lib'; +import { EmbedBuilder } from 'discord.js'; export default class ServerStatusCommand extends BotCommand { public constructor() { @@ -9,7 +9,8 @@ export default class ServerStatusCommand extends BotCommand { description: "Gives the status of moulberry's server", usage: ['server-status'], examples: ['server-status', 'ss'], - clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + clientPermissions: ['EmbedLinks'], + clientCheckChannel: true, userPermissions: [], slash: true }); diff --git a/src/commands/moulberry-bush/solved.ts b/src/commands/moulberry-bush/solved.ts index 197a3ce..ecda1c7 100644 --- a/src/commands/moulberry-bush/solved.ts +++ b/src/commands/moulberry-bush/solved.ts @@ -1,4 +1,4 @@ -import { BotCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; export default class Solved extends BotCommand { @@ -11,7 +11,7 @@ export default class Solved extends BotCommand { examples: ['solved'], slash: true, channel: 'guild', - clientPermissions: (m) => clientSendAndPermCheck(m), + clientPermissions: [], userPermissions: [], slashGuilds: [mappings.guilds["Moulberry's Bush"]], restrictedGuilds: [mappings.guilds["Moulberry's Bush"]] |