From 1546da359646b89f13d17784eb7653a52ca61efd Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Thu, 27 May 2021 14:58:21 -0600 Subject: Fix file naming --- .../moulberry-bush/capePermissionsCommand.ts | 126 -------------- src/commands/moulberry-bush/capePerms.ts | 126 ++++++++++++++ src/commands/moulberry-bush/giveawayPing.ts | 68 ++++++++ src/commands/moulberry-bush/giveawayPingCommand.ts | 68 -------- src/commands/moulberry-bush/level.ts | 62 +++++++ src/commands/moulberry-bush/levelCommand.ts | 62 ------- src/commands/moulberry-bush/rule.ts | 188 +++++++++++++++++++++ src/commands/moulberry-bush/ruleCommand.ts | 188 --------------------- 8 files changed, 444 insertions(+), 444 deletions(-) delete mode 100644 src/commands/moulberry-bush/capePermissionsCommand.ts create mode 100644 src/commands/moulberry-bush/capePerms.ts create mode 100644 src/commands/moulberry-bush/giveawayPing.ts delete mode 100644 src/commands/moulberry-bush/giveawayPingCommand.ts create mode 100644 src/commands/moulberry-bush/level.ts delete mode 100644 src/commands/moulberry-bush/levelCommand.ts create mode 100644 src/commands/moulberry-bush/rule.ts delete mode 100644 src/commands/moulberry-bush/ruleCommand.ts (limited to 'src/commands/moulberry-bush') diff --git a/src/commands/moulberry-bush/capePermissionsCommand.ts b/src/commands/moulberry-bush/capePermissionsCommand.ts deleted file mode 100644 index fdb5caf..0000000 --- a/src/commands/moulberry-bush/capePermissionsCommand.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; -import { MessageEmbed } from 'discord.js'; -import { CommandInteraction } from 'discord.js'; -import { Message } from 'discord.js'; -import got from 'got'; -import { BushCommand } from '../../lib/extensions/BushCommand'; -import { SlashCommandOption } from '../../lib/extensions/Util'; - -interface Capeperms { - success: boolean; - perms: User[]; -} -interface User { - _id: string; - perms: string[]; -} - -export default class CapePermissionsCommand extends BushCommand { - private nameMap = { - patreon1: 'Patreon Tier 1', - patreon2: 'Patreon Tier 2', - fade: 'Fade', - contrib: 'Contributor', - nullzee: 'Nullzee', - gravy: 'ThatGravyBoat', - space: 'Space', - mcworld: 'Minecraft World', - lava: 'Lava', - packshq: 'PacksHQ', - mbstaff: "Moulberry's Bush staff", - thebakery: "Biscuit's Bakery", - negative: 'Negative', - void: 'Void', - ironmoon: 'IRONM00N', - krusty: 'Krusty', - furf: 'FurfSky Reborn', - soldier: 'Soldier', - dsm: "Danker's Skyblock Mod", - zera: 'Zera', - tunnel: 'Tunnel', - alexxoffi: 'Alexxoffi', - parallax: 'Parallax', - jakethybro: 'Jakethybro', - planets: 'Planets' - }; - public constructor() { - super('capeperms', { - aliases: ['capeperms', 'capeperm', 'capepermissions', 'capepermission'], - category: "Moulberry's Bush", - description: { - content: 'A command to see what capes someone has access to.', - usage: 'capeperms ', - examples: ['capeperms IRONM00N'] - }, - args: [ - { - id: 'user', - type: 'string', - prompt: { - start: 'Who would you like to see the cape permissions of?', - retry: - '<:error:837123021016924261> Choose someone to see the capes their available capes.', - optional: false - } - } - ], - clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], - channel: 'guild', - slashCommandOptions: [ - { - type: ApplicationCommandOptionType.STRING, - name: 'user', - description: - 'The username of the player to see the cape permissions of', - required: true - } - ] - }); - } - private async getResponse(user: string): Promise { - let capeperms: Capeperms, uuid: string; - try { - uuid = await this.client.util.mcUUID(user); - } catch (e) { - return `<:error:837123021016924261> \`${user}\` doesn't appear to be a valid username.`; - } - - try { - capeperms = await got - .get('http://moulberry.codes/permscapes.json') - .json(); - } catch (error) { - capeperms = null; - } - if (capeperms == null) { - return `<:error:837123021016924261> There was an error finding cape perms for \`${user}\`.`; - } else { - if (capeperms?.perms) { - const foundUser = capeperms.perms.find((u) => u._id === uuid); - if (foundUser == null) - return `<:error:837123021016924261> \`${user}\` does not appear to have any capes.`; - const userPerm: string[] = foundUser.perms; - const embed = this.client.util - .createEmbed(this.client.util.colors.default) - .setTitle(`${user}'s Capes`) - .setDescription(userPerm.join('\n')); - return embed; - } else { - return `<:error:837123021016924261> There was an error finding cape perms for ${user}.`; - } - } - } - public async exec( - message: Message, - { user }: { user: string } - ): Promise { - await message.reply(await this.getResponse(user)); - } - - public async execSlash( - message: CommandInteraction, - { user }: { user: SlashCommandOption } - ): Promise { - await message.reply(await this.getResponse(user.value)); - } -} diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts new file mode 100644 index 0000000..fdb5caf --- /dev/null +++ b/src/commands/moulberry-bush/capePerms.ts @@ -0,0 +1,126 @@ +import { ApplicationCommandOptionType } from 'discord-api-types'; +import { MessageEmbed } from 'discord.js'; +import { CommandInteraction } from 'discord.js'; +import { Message } from 'discord.js'; +import got from 'got'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { SlashCommandOption } from '../../lib/extensions/Util'; + +interface Capeperms { + success: boolean; + perms: User[]; +} +interface User { + _id: string; + perms: string[]; +} + +export default class CapePermissionsCommand extends BushCommand { + private nameMap = { + patreon1: 'Patreon Tier 1', + patreon2: 'Patreon Tier 2', + fade: 'Fade', + contrib: 'Contributor', + nullzee: 'Nullzee', + gravy: 'ThatGravyBoat', + space: 'Space', + mcworld: 'Minecraft World', + lava: 'Lava', + packshq: 'PacksHQ', + mbstaff: "Moulberry's Bush staff", + thebakery: "Biscuit's Bakery", + negative: 'Negative', + void: 'Void', + ironmoon: 'IRONM00N', + krusty: 'Krusty', + furf: 'FurfSky Reborn', + soldier: 'Soldier', + dsm: "Danker's Skyblock Mod", + zera: 'Zera', + tunnel: 'Tunnel', + alexxoffi: 'Alexxoffi', + parallax: 'Parallax', + jakethybro: 'Jakethybro', + planets: 'Planets' + }; + public constructor() { + super('capeperms', { + aliases: ['capeperms', 'capeperm', 'capepermissions', 'capepermission'], + category: "Moulberry's Bush", + description: { + content: 'A command to see what capes someone has access to.', + usage: 'capeperms ', + examples: ['capeperms IRONM00N'] + }, + args: [ + { + id: 'user', + type: 'string', + prompt: { + start: 'Who would you like to see the cape permissions of?', + retry: + '<:error:837123021016924261> Choose someone to see the capes their available capes.', + optional: false + } + } + ], + clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], + channel: 'guild', + slashCommandOptions: [ + { + type: ApplicationCommandOptionType.STRING, + name: 'user', + description: + 'The username of the player to see the cape permissions of', + required: true + } + ] + }); + } + private async getResponse(user: string): Promise { + let capeperms: Capeperms, uuid: string; + try { + uuid = await this.client.util.mcUUID(user); + } catch (e) { + return `<:error:837123021016924261> \`${user}\` doesn't appear to be a valid username.`; + } + + try { + capeperms = await got + .get('http://moulberry.codes/permscapes.json') + .json(); + } catch (error) { + capeperms = null; + } + if (capeperms == null) { + return `<:error:837123021016924261> There was an error finding cape perms for \`${user}\`.`; + } else { + if (capeperms?.perms) { + const foundUser = capeperms.perms.find((u) => u._id === uuid); + if (foundUser == null) + return `<:error:837123021016924261> \`${user}\` does not appear to have any capes.`; + const userPerm: string[] = foundUser.perms; + const embed = this.client.util + .createEmbed(this.client.util.colors.default) + .setTitle(`${user}'s Capes`) + .setDescription(userPerm.join('\n')); + return embed; + } else { + return `<:error:837123021016924261> There was an error finding cape perms for ${user}.`; + } + } + } + public async exec( + message: Message, + { user }: { user: string } + ): Promise { + await message.reply(await this.getResponse(user)); + } + + public async execSlash( + message: CommandInteraction, + { user }: { user: SlashCommandOption } + ): Promise { + await message.reply(await this.getResponse(user.value)); + } +} diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts new file mode 100644 index 0000000..e6fdd9a --- /dev/null +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -0,0 +1,68 @@ +import { BushCommand } from '../../lib/extensions/BushCommand'; +import AllowedMentions from '../../lib/utils/AllowedMentions'; +import { Message, WebhookClient } from 'discord.js'; +import { TextChannel } from 'discord.js'; +import { NewsChannel } from 'discord.js'; + +export default class GiveawayPingCommand extends BushCommand { + constructor() { + super('giveawayping', { + aliases: ['giveawayping', 'giveawaypong'], + category: "Moulberry's Bush", + description: { + content: 'Pings the giveaway role.', + usage: 'giveawayping', + examples: ['giveawayping'] + }, + clientPermissions: ['MANAGE_MESSAGES'], + userPermissions: [ + 'SEND_MESSAGES', + 'MANAGE_GUILD', + 'MANAGE_MESSAGES', + 'BAN_MEMBERS', + 'KICK_MEMBERS', + 'VIEW_CHANNEL' + ], + channel: 'guild', + ignoreCooldown: [], + ignorePermissions: [], + cooldown: 1.44e7, //4 hours + ratelimit: 1, + editable: false + }); + } + public async exec(message: Message): Promise { + if (message.guild.id !== '516977525906341928') + return message.reply( + "<:error:837123021016924261> This command may only be run in Moulberry's Bush." + ); + if ( + !['767782084981817344', '833855738501267456'].includes(message.channel.id) + ) + return message.reply( + '<:error:837123021016924261> This command may only be run in giveaway channels.' + ); + await message.delete().catch(() => undefined); + const webhooks = await ( + message.channel as TextChannel | NewsChannel + ).fetchWebhooks(); + let webhookClient: WebhookClient; + if (webhooks.size < 1) { + const webhook = await ( + message.channel as TextChannel | NewsChannel + ).createWebhook('Giveaway ping webhook'); + webhookClient = new WebhookClient(webhook.id, webhook.token); + } else { + const webhook = webhooks.first(); + webhookClient = new WebhookClient(webhook.id, webhook.token); + } + return webhookClient.send( + '🎉 <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.', + { + username: `${message.member.nickname || message.author.username}`, + avatarURL: message.author.avatarURL({ dynamic: true }), + allowedMentions: AllowedMentions.roles() + } + ); + } +} diff --git a/src/commands/moulberry-bush/giveawayPingCommand.ts b/src/commands/moulberry-bush/giveawayPingCommand.ts deleted file mode 100644 index e6fdd9a..0000000 --- a/src/commands/moulberry-bush/giveawayPingCommand.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { BushCommand } from '../../lib/extensions/BushCommand'; -import AllowedMentions from '../../lib/utils/AllowedMentions'; -import { Message, WebhookClient } from 'discord.js'; -import { TextChannel } from 'discord.js'; -import { NewsChannel } from 'discord.js'; - -export default class GiveawayPingCommand extends BushCommand { - constructor() { - super('giveawayping', { - aliases: ['giveawayping', 'giveawaypong'], - category: "Moulberry's Bush", - description: { - content: 'Pings the giveaway role.', - usage: 'giveawayping', - examples: ['giveawayping'] - }, - clientPermissions: ['MANAGE_MESSAGES'], - userPermissions: [ - 'SEND_MESSAGES', - 'MANAGE_GUILD', - 'MANAGE_MESSAGES', - 'BAN_MEMBERS', - 'KICK_MEMBERS', - 'VIEW_CHANNEL' - ], - channel: 'guild', - ignoreCooldown: [], - ignorePermissions: [], - cooldown: 1.44e7, //4 hours - ratelimit: 1, - editable: false - }); - } - public async exec(message: Message): Promise { - if (message.guild.id !== '516977525906341928') - return message.reply( - "<:error:837123021016924261> This command may only be run in Moulberry's Bush." - ); - if ( - !['767782084981817344', '833855738501267456'].includes(message.channel.id) - ) - return message.reply( - '<:error:837123021016924261> This command may only be run in giveaway channels.' - ); - await message.delete().catch(() => undefined); - const webhooks = await ( - message.channel as TextChannel | NewsChannel - ).fetchWebhooks(); - let webhookClient: WebhookClient; - if (webhooks.size < 1) { - const webhook = await ( - message.channel as TextChannel | NewsChannel - ).createWebhook('Giveaway ping webhook'); - webhookClient = new WebhookClient(webhook.id, webhook.token); - } else { - const webhook = webhooks.first(); - webhookClient = new WebhookClient(webhook.id, webhook.token); - } - return webhookClient.send( - '🎉 <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.', - { - username: `${message.member.nickname || message.author.username}`, - avatarURL: message.author.avatarURL({ dynamic: true }), - allowedMentions: AllowedMentions.roles() - } - ); - } -} diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts new file mode 100644 index 0000000..decac8a --- /dev/null +++ b/src/commands/moulberry-bush/level.ts @@ -0,0 +1,62 @@ +import { ApplicationCommandOptionType } from 'discord-api-types'; +import { Message } from 'discord.js'; +import { CommandInteractionOption } from 'discord.js'; +import { CommandInteraction } from 'discord.js'; +import { User } from 'discord.js'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { Level } from '../../lib/models'; + +export default class LevelCommand extends BushCommand { + constructor() { + super('level', { + aliases: ['level', 'rank'], + category: "Moulberry's Bush", + description: { + content: 'Shows the level of a user', + usage: 'level [user]', + examples: ['level', 'level @Tyman'] + }, + args: [ + { + id: 'user', + type: 'user', + prompt: { + start: 'What user would you like to see the level of?', + retry: + 'Invalid user. What user would you like to see the level of?', + optional: true + } + } + ], + slashCommandOptions: [ + { + type: ApplicationCommandOptionType.USER, + name: 'user', + description: 'The user to get the level of', + required: false + } + ] + }); + } + + private async getResponse(user: User): Promise { + const userLevelRow = await Level.findByPk(user.id); + if (userLevelRow) { + return `${user ? `${user.tag}'s` : 'Your'} level is ${ + userLevelRow.level + } (${userLevelRow.xp} XP)`; + } else { + return `${user ? `${user.tag} does` : 'You do'} not have a level yet!`; + } + } + + async exec(message: Message, { user }: { user?: User }): Promise { + await message.reply(await this.getResponse(user || message.author)); + } + async execSlash( + message: CommandInteraction, + { user }: { user?: CommandInteractionOption } + ): Promise { + await message.reply(await this.getResponse(user?.user || message.user)); + } +} diff --git a/src/commands/moulberry-bush/levelCommand.ts b/src/commands/moulberry-bush/levelCommand.ts deleted file mode 100644 index decac8a..0000000 --- a/src/commands/moulberry-bush/levelCommand.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; -import { Message } from 'discord.js'; -import { CommandInteractionOption } from 'discord.js'; -import { CommandInteraction } from 'discord.js'; -import { User } from 'discord.js'; -import { BushCommand } from '../../lib/extensions/BushCommand'; -import { Level } from '../../lib/models'; - -export default class LevelCommand extends BushCommand { - constructor() { - super('level', { - aliases: ['level', 'rank'], - category: "Moulberry's Bush", - description: { - content: 'Shows the level of a user', - usage: 'level [user]', - examples: ['level', 'level @Tyman'] - }, - args: [ - { - id: 'user', - type: 'user', - prompt: { - start: 'What user would you like to see the level of?', - retry: - 'Invalid user. What user would you like to see the level of?', - optional: true - } - } - ], - slashCommandOptions: [ - { - type: ApplicationCommandOptionType.USER, - name: 'user', - description: 'The user to get the level of', - required: false - } - ] - }); - } - - private async getResponse(user: User): Promise { - const userLevelRow = await Level.findByPk(user.id); - if (userLevelRow) { - return `${user ? `${user.tag}'s` : 'Your'} level is ${ - userLevelRow.level - } (${userLevelRow.xp} XP)`; - } else { - return `${user ? `${user.tag} does` : 'You do'} not have a level yet!`; - } - } - - async exec(message: Message, { user }: { user?: User }): Promise { - await message.reply(await this.getResponse(user || message.author)); - } - async execSlash( - message: CommandInteraction, - { user }: { user?: CommandInteractionOption } - ): Promise { - await message.reply(await this.getResponse(user?.user || message.user)); - } -} diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts new file mode 100644 index 0000000..69dcb6e --- /dev/null +++ b/src/commands/moulberry-bush/rule.ts @@ -0,0 +1,188 @@ +import { Argument } from 'discord-akairo'; +import { Message, MessageEmbed, User } from 'discord.js'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { ApplicationCommandOptionType } from 'discord-api-types'; +import { CommandInteraction } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/Util'; + +export default class RuleCommand extends BushCommand { + private rules = [ + { + title: "Follow Discord's TOS", + description: + "Be sure to follow discord's TOS found at , you must be 13 to use discord so if you admit to being under 13 you will be banned from the server." + }, + { + title: 'Be Respectful', + description: + 'Racist, sexist, homophobic, xenophobic, transphobic, ableist, hate speech, slurs, or any other derogatory, toxic, or discriminatory behavior will not be tolerated.' + }, + { + title: 'No Spamming', + description: + 'Including but not limited to: any messages that do not contribute to the conversation, repeated messages, randomly tagging users, and chat flood.' + }, + { + title: 'English', + description: + 'The primary language of the server is English, please keep all discussions in English.' + }, + { + title: 'Safe for Work', + description: + 'Please keep NSFW and NSFL content out of this server, avoid borderline images as well as keeping your status and profile picture SFW.' + }, + { + title: 'No Advertising', + description: + 'Do not promote anything without prior approval from a staff member, this includes DM advertising.' + }, + { + title: 'Impersonation', + description: + 'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.' + }, + { + title: 'Swearing', + description: 'Swearing is allowed only when not used as an insult.' + }, + { + title: 'Only ping @emergency in emergencies', + description: + 'Pinging <@&833802660209229854> for no reason will result in severe punishment. <@&833802660209229854> is only to be pinged in true emergencies.' + }, + { + title: 'No Backseat Moderating', + description: + 'If you see a rule being broken be broken, please report it using: `-report [evidence]`.' + }, + { + title: 'Staff may moderate at their discretion', + description: + 'If there are loopholes in our rules, the staff team may moderate based on what they deem appropriate. The staff team holds final discretion.' + }, + { + title: "Sending media that are able to crash a user's Discord", + description: + "Sending videos, GIFs, emojis, etc. that are able to crash someone's discord will result in a **permanent** mute that cannot be appealed." + } + ]; + + public constructor() { + super('rule', { + aliases: ['rule', 'rules'], + category: "Moulberry's Bush", + description: { + content: 'A command to state a rule.', + usage: 'rule [user]', + examples: ['rule 1 IRONM00N', 'rule 2', 'rules'] + }, + args: [ + { + id: 'rule', + type: Argument.range('number', 1, 12, true), + prompt: { + start: 'What rule would you like to have cited?', + retry: '<:no:787549684196704257> Choose a valid rule.', + optional: true + }, + default: undefined + }, + { + id: 'user', + type: 'user', + prompt: { + start: 'What user would you like to mention?', + retry: '<:no:787549684196704257> Choose a valid user to mention.', + optional: true + }, + default: undefined + } + ], + clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], + channel: 'guild', + slashCommandOptions: [ + { + type: ApplicationCommandOptionType.INTEGER, + name: 'rule', + description: 'The rule to show', + required: false + }, + { + type: ApplicationCommandOptionType.USER, + name: 'user', + description: 'The user to ping', + required: false + } + ] + }); + } + private getResponse( + message: Message | CommandInteraction, + rule?: number, + user?: User + ): string | MessageEmbed | [string, MessageEmbed] { + if ( + message.guild.id !== '516977525906341928' && + !this.client.ownerID.includes( + message instanceof Message ? message.author.id : message.user.id + ) + ) { + return "<:no:787549684196704257> This command can only be run in Moulberry's Bush."; + } + let rulesEmbed = new MessageEmbed().setColor('ef3929'); + if (message instanceof Message) { + rulesEmbed = rulesEmbed.setFooter( + `Triggered by ${message.author.tag}`, + message.author.avatarURL({ dynamic: true }) + ); + } + if (rule) { + const foundRule = this.rules[rule - 1]; + rulesEmbed.addField(`${rule}) ${foundRule.title}`, foundRule.description); + } else { + for (const curRule of this.rules) { + rulesEmbed.addField( + `${this.rules.indexOf(curRule) + 1}) ${curRule.title}`, + curRule.description + ); + } + } + if (!user) { + return rulesEmbed; + } else { + return [`<@!${user.id}>`, rulesEmbed]; + } + } + public async exec( + message: Message, + { rule, user }: { rule?: number; user?: User } + ): Promise { + const response = this.getResponse(message, rule, user); + if (Array.isArray(response)) { + await message.util.send(response[0], { + embed: response[1] + }); + } else { + await message.util.send(response); + } + await message.delete().catch(() => undefined); + } + + public async execSlash( + message: CommandInteraction, + { + rule, + user + }: { rule?: SlashCommandOption; user?: SlashCommandOption } + ): Promise { + const response = this.getResponse(message, rule?.value, user?.user); + if (Array.isArray(response)) { + await message.reply(response[0], { + embeds: [response[1]] + }); + } else { + await message.reply(response); + } + } +} diff --git a/src/commands/moulberry-bush/ruleCommand.ts b/src/commands/moulberry-bush/ruleCommand.ts deleted file mode 100644 index 69dcb6e..0000000 --- a/src/commands/moulberry-bush/ruleCommand.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { Argument } from 'discord-akairo'; -import { Message, MessageEmbed, User } from 'discord.js'; -import { BushCommand } from '../../lib/extensions/BushCommand'; -import { ApplicationCommandOptionType } from 'discord-api-types'; -import { CommandInteraction } from 'discord.js'; -import { SlashCommandOption } from '../../lib/extensions/Util'; - -export default class RuleCommand extends BushCommand { - private rules = [ - { - title: "Follow Discord's TOS", - description: - "Be sure to follow discord's TOS found at , you must be 13 to use discord so if you admit to being under 13 you will be banned from the server." - }, - { - title: 'Be Respectful', - description: - 'Racist, sexist, homophobic, xenophobic, transphobic, ableist, hate speech, slurs, or any other derogatory, toxic, or discriminatory behavior will not be tolerated.' - }, - { - title: 'No Spamming', - description: - 'Including but not limited to: any messages that do not contribute to the conversation, repeated messages, randomly tagging users, and chat flood.' - }, - { - title: 'English', - description: - 'The primary language of the server is English, please keep all discussions in English.' - }, - { - title: 'Safe for Work', - description: - 'Please keep NSFW and NSFL content out of this server, avoid borderline images as well as keeping your status and profile picture SFW.' - }, - { - title: 'No Advertising', - description: - 'Do not promote anything without prior approval from a staff member, this includes DM advertising.' - }, - { - title: 'Impersonation', - description: - 'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.' - }, - { - title: 'Swearing', - description: 'Swearing is allowed only when not used as an insult.' - }, - { - title: 'Only ping @emergency in emergencies', - description: - 'Pinging <@&833802660209229854> for no reason will result in severe punishment. <@&833802660209229854> is only to be pinged in true emergencies.' - }, - { - title: 'No Backseat Moderating', - description: - 'If you see a rule being broken be broken, please report it using: `-report [evidence]`.' - }, - { - title: 'Staff may moderate at their discretion', - description: - 'If there are loopholes in our rules, the staff team may moderate based on what they deem appropriate. The staff team holds final discretion.' - }, - { - title: "Sending media that are able to crash a user's Discord", - description: - "Sending videos, GIFs, emojis, etc. that are able to crash someone's discord will result in a **permanent** mute that cannot be appealed." - } - ]; - - public constructor() { - super('rule', { - aliases: ['rule', 'rules'], - category: "Moulberry's Bush", - description: { - content: 'A command to state a rule.', - usage: 'rule [user]', - examples: ['rule 1 IRONM00N', 'rule 2', 'rules'] - }, - args: [ - { - id: 'rule', - type: Argument.range('number', 1, 12, true), - prompt: { - start: 'What rule would you like to have cited?', - retry: '<:no:787549684196704257> Choose a valid rule.', - optional: true - }, - default: undefined - }, - { - id: 'user', - type: 'user', - prompt: { - start: 'What user would you like to mention?', - retry: '<:no:787549684196704257> Choose a valid user to mention.', - optional: true - }, - default: undefined - } - ], - clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], - channel: 'guild', - slashCommandOptions: [ - { - type: ApplicationCommandOptionType.INTEGER, - name: 'rule', - description: 'The rule to show', - required: false - }, - { - type: ApplicationCommandOptionType.USER, - name: 'user', - description: 'The user to ping', - required: false - } - ] - }); - } - private getResponse( - message: Message | CommandInteraction, - rule?: number, - user?: User - ): string | MessageEmbed | [string, MessageEmbed] { - if ( - message.guild.id !== '516977525906341928' && - !this.client.ownerID.includes( - message instanceof Message ? message.author.id : message.user.id - ) - ) { - return "<:no:787549684196704257> This command can only be run in Moulberry's Bush."; - } - let rulesEmbed = new MessageEmbed().setColor('ef3929'); - if (message instanceof Message) { - rulesEmbed = rulesEmbed.setFooter( - `Triggered by ${message.author.tag}`, - message.author.avatarURL({ dynamic: true }) - ); - } - if (rule) { - const foundRule = this.rules[rule - 1]; - rulesEmbed.addField(`${rule}) ${foundRule.title}`, foundRule.description); - } else { - for (const curRule of this.rules) { - rulesEmbed.addField( - `${this.rules.indexOf(curRule) + 1}) ${curRule.title}`, - curRule.description - ); - } - } - if (!user) { - return rulesEmbed; - } else { - return [`<@!${user.id}>`, rulesEmbed]; - } - } - public async exec( - message: Message, - { rule, user }: { rule?: number; user?: User } - ): Promise { - const response = this.getResponse(message, rule, user); - if (Array.isArray(response)) { - await message.util.send(response[0], { - embed: response[1] - }); - } else { - await message.util.send(response); - } - await message.delete().catch(() => undefined); - } - - public async execSlash( - message: CommandInteraction, - { - rule, - user - }: { rule?: SlashCommandOption; user?: SlashCommandOption } - ): Promise { - const response = this.getResponse(message, rule?.value, user?.user); - if (Array.isArray(response)) { - await message.reply(response[0], { - embeds: [response[1]] - }); - } else { - await message.reply(response); - } - } -} -- cgit