aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moulberry-bush
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r--src/commands/moulberry-bush/capePerms.ts (renamed from src/commands/moulberry-bush/capeperms.ts)34
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts (renamed from src/commands/moulberry-bush/giveawayping.ts)34
-rw-r--r--src/commands/moulberry-bush/level.ts8
-rw-r--r--src/commands/moulberry-bush/rule.ts67
4 files changed, 39 insertions, 104 deletions
diff --git a/src/commands/moulberry-bush/capeperms.ts b/src/commands/moulberry-bush/capePerms.ts
index 5b3dc10..79f9d6b 100644
--- a/src/commands/moulberry-bush/capeperms.ts
+++ b/src/commands/moulberry-bush/capePerms.ts
@@ -3,7 +3,7 @@ import { MessageEmbed } from 'discord.js';
import { CommandInteraction } from 'discord.js';
import { Message } from 'discord.js';
import got from 'got';
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
import { SlashCommandOption } from '../../lib/extensions/Util';
interface Capeperms {
@@ -15,7 +15,7 @@ interface User {
perms: string[];
}
-export default class CapePermsCommand extends BotCommand {
+export default class CapePermissionsCommand extends BushCommand {
private nameMap = {
patreon1: 'Patreon Tier 1',
patreon2: 'Patreon Tier 2',
@@ -45,7 +45,7 @@ export default class CapePermsCommand extends BotCommand {
};
public constructor() {
super('capeperms', {
- aliases: ['capeperms', 'capeperm'],
+ aliases: ['capeperms', 'capeperm', 'capepermissions', 'capepermission'],
category: "Moulberry's Bush",
description: {
content: 'A command to see what capes someone has access to.',
@@ -58,8 +58,7 @@ export default class CapePermsCommand extends BotCommand {
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.',
+ retry: '<:error:837123021016924261> Choose someone to see the capes their available capes.',
optional: false
}
}
@@ -70,8 +69,7 @@ export default class CapePermsCommand extends BotCommand {
{
type: ApplicationCommandOptionType.STRING,
name: 'user',
- description:
- 'The username of the player to see the cape permissions of',
+ description: 'The username of the player to see the cape permissions of',
required: true
}
]
@@ -86,9 +84,7 @@ export default class CapePermsCommand extends BotCommand {
}
try {
- capeperms = await got
- .get('http://moulberry.codes/permscapes.json')
- .json();
+ capeperms = await got.get('http://moulberry.codes/permscapes.json').json();
} catch (error) {
capeperms = null;
}
@@ -97,30 +93,20 @@ export default class CapePermsCommand extends BotCommand {
} 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.`;
+ 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'));
+ 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<void> {
+ public async exec(message: Message, { user }: { user: string }): Promise<void> {
await message.reply(await this.getResponse(user));
}
- public async execSlash(
- message: CommandInteraction,
- { user }: { user: SlashCommandOption<string> }
- ): Promise<void> {
+ public async execSlash(message: CommandInteraction, { user }: { user: SlashCommandOption<string> }): Promise<void> {
await message.reply(await this.getResponse(user.value));
}
}
diff --git a/src/commands/moulberry-bush/giveawayping.ts b/src/commands/moulberry-bush/giveawayPing.ts
index d99f475..e11585a 100644
--- a/src/commands/moulberry-bush/giveawayping.ts
+++ b/src/commands/moulberry-bush/giveawayPing.ts
@@ -1,10 +1,10 @@
-import { BotCommand } from '../../lib/extensions/BotCommand';
+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 BotCommand {
+export default class GiveawayPingCommand extends BushCommand {
constructor() {
super('giveawayping', {
aliases: ['giveawayping', 'giveawaypong'],
@@ -15,14 +15,7 @@ export default class GiveawayPingCommand extends BotCommand {
examples: ['giveawayping']
},
clientPermissions: ['MANAGE_MESSAGES'],
- userPermissions: [
- 'SEND_MESSAGES',
- 'MANAGE_GUILD',
- 'MANAGE_MESSAGES',
- 'BAN_MEMBERS',
- 'KICK_MEMBERS',
- 'VIEW_CHANNEL'
- ],
+ userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD', 'MANAGE_MESSAGES', 'BAN_MEMBERS', 'KICK_MEMBERS', 'VIEW_CHANNEL'],
channel: 'guild',
ignoreCooldown: [],
ignorePermissions: [],
@@ -32,25 +25,14 @@ export default class GiveawayPingCommand extends BotCommand {
});
}
public async exec(message: Message): Promise<unknown> {
- 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.'
- );
+ 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();
+ 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');
+ const webhook = await (message.channel as TextChannel | NewsChannel).createWebhook('Giveaway ping webhook');
webhookClient = new WebhookClient(webhook.id, webhook.token);
} else {
const webhook = webhooks.first();
diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts
index 046940a..554219d 100644
--- a/src/commands/moulberry-bush/level.ts
+++ b/src/commands/moulberry-bush/level.ts
@@ -3,7 +3,7 @@ import { Message } from 'discord.js';
import { CommandInteractionOption } from 'discord.js';
import { CommandInteraction } from 'discord.js';
import { User } from 'discord.js';
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
import { Level } from '../../lib/models';
import canvas from 'canvas';
import { MessageAttachment } from 'discord.js';
@@ -11,10 +11,11 @@ import { join } from 'path';
import got from 'got/dist/source';
import { CanvasProgressBar } from '../../lib/extensions/Util';
-export default class LevelCommand extends BotCommand {
+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]',
@@ -26,8 +27,7 @@ export default class LevelCommand extends BotCommand {
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?',
+ retry: 'Invalid user. What user would you like to see the level of?',
optional: true
}
}
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts
index bd8b08a..e3f9e34 100644
--- a/src/commands/moulberry-bush/rule.ts
+++ b/src/commands/moulberry-bush/rule.ts
@@ -1,11 +1,11 @@
import { Argument } from 'discord-akairo';
import { Message, MessageEmbed, User } from 'discord.js';
-import { BotCommand } from '../../lib/extensions/BotCommand';
+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 BotCommand {
+export default class RuleCommand extends BushCommand {
private rules = [
{
title: "Follow Discord's TOS",
@@ -19,28 +19,23 @@ export default class RuleCommand extends BotCommand {
},
{
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.'
+ 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.'
+ 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.'
+ 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.'
+ 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.'
+ description: 'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.'
},
{
title: 'Swearing',
@@ -48,23 +43,19 @@ export default class RuleCommand extends BotCommand {
},
{
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.'
+ 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 <user> [evidence]`.'
+ description: 'If you see a rule being broken be broken, please report it using: `-report <user> [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.'
+ 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."
+ description: "Sending videos, GIFs, emojis, etc. that are able to crash someone's discord will result in a **permanent** mute that cannot be appealed."
}
];
@@ -117,35 +108,20 @@ export default class RuleCommand extends BotCommand {
]
});
}
- 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
- )
- ) {
+ 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 })
- );
+ 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
- );
+ rulesEmbed.addField(`${this.rules.indexOf(curRule) + 1}) ${curRule.title}`, curRule.description);
}
}
if (!user) {
@@ -154,10 +130,7 @@ export default class RuleCommand extends BotCommand {
return [`<@!${user.id}>`, rulesEmbed];
}
}
- public async exec(
- message: Message,
- { rule, user }: { rule?: number; user?: User }
- ): Promise<void> {
+ public async exec(message: Message, { rule, user }: { rule?: number; user?: User }): Promise<void> {
const response = this.getResponse(message, rule, user);
if (Array.isArray(response)) {
await message.util.send(response[0], {
@@ -169,13 +142,7 @@ export default class RuleCommand extends BotCommand {
await message.delete().catch(() => undefined);
}
- public async execSlash(
- message: CommandInteraction,
- {
- rule,
- user
- }: { rule?: SlashCommandOption<number>; user?: SlashCommandOption<void> }
- ): Promise<void> {
+ public async execSlash(message: CommandInteraction, { rule, user }: { rule?: SlashCommandOption<number>; user?: SlashCommandOption<void> }): Promise<void> {
const response = this.getResponse(message, rule?.value, user?.user);
if (Array.isArray(response)) {
await message.reply(response[0], {