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.ts138
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts35
-rw-r--r--src/commands/moulberry-bush/level.ts15
-rw-r--r--src/commands/moulberry-bush/rule.ts228
4 files changed, 208 insertions, 208 deletions
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts
index 3e4563a..d1850c8 100644
--- a/src/commands/moulberry-bush/capePerms.ts
+++ b/src/commands/moulberry-bush/capePerms.ts
@@ -1,17 +1,8 @@
-import { Message, MessageEmbed } from 'discord.js';
+import { Constants } from 'discord-akairo';
+import { MessageEmbed } from 'discord.js';
import got from 'got';
-import { SlashCommandOption } from '../../lib/extensions/BushClientUtil';
import { BushCommand } from '../../lib/extensions/BushCommand';
-import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
-
-interface Capeperms {
- success: boolean;
- perms: User[];
-}
-interface User {
- _id: string;
- perms: string[];
-}
+import { BushMessage } from '../../lib/extensions/BushMessage';
export default class CapePermissionsCommand extends BushCommand {
private nameMap = {
@@ -19,31 +10,32 @@ export default class CapePermissionsCommand extends BushCommand {
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'
+ nullzee: 'Patreon Tier 1',
+ gravy: 'Patreon Tier 1',
+ space: 'Patreon Tier 1',
+ mcworld: 'Patreon Tier 1',
+ lava: 'Patreon Tier 1',
+ packshq: 'Patreon Tier 1',
+ mbstaff: 'Patreon Tier 1',
+ thebakery: 'Patreon Tier 1',
+ negative: 'Patreon Tier 1',
+ void: 'Patreon Tier 1',
+ ironmoon: 'Patreon Tier 1',
+ krusty: 'Patreon Tier 1',
+ furf: 'Patreon Tier 1',
+ soldier: 'Patreon Tier 1',
+ dsm: 'Patreon Tier 1',
+ zera: 'Patreon Tier 1',
+ tunnel: 'Patreon Tier 1',
+ alexxoffi: 'Patreon Tier 1',
+ parallax: 'Patreon Tier 1',
+ jakethybro: 'Patreon Tier 1',
+ planets: 'Patreon Tier 1'
};
+
public constructor() {
- super('capeperms', {
- aliases: ['capeperms', 'capeperm', 'capepermissions', 'capepermission'],
+ super('capepermissions', {
+ aliases: ['capeperms', 'capeperm', 'capepermissions'],
category: "Moulberry's Bush",
description: {
content: 'A command to see what capes someone has access to.',
@@ -52,8 +44,9 @@ export default class CapePermissionsCommand extends BushCommand {
},
args: [
{
- id: 'user',
- type: 'string',
+ id: 'ign',
+ type: Constants.ArgumentTypes.STRING,
+ match: Constants.ArgumentMatches.PHRASE,
prompt: {
start: 'Who would you like to see the cape permissions of?',
retry: '{error} Choose someone to see the capes their available capes.',
@@ -63,53 +56,72 @@ export default class CapePermissionsCommand extends BushCommand {
],
clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'],
channel: 'guild',
+ slash: true,
slashOptions: [
{
+ name: 'ign',
+ description: 'The ign of the player you would like to view the capes permissions of.',
type: 'STRING',
- name: 'user',
- description: 'The username of the player to see the cape permissions of',
required: true
}
- ],
- slash: true
+ ]
});
}
- private async getResponse(user: string): Promise<{ content?: string; embeds?: MessageEmbed[] }> {
+
+ public async exec(message: BushMessage, args: { ign: string }): Promise<unknown> {
+ interface Capeperms {
+ success: boolean;
+ perms: User[];
+ }
+
+ interface User {
+ _id: string;
+ perms: string[];
+ }
+
let capeperms: Capeperms, uuid: string;
try {
- uuid = await this.client.util.mcUUID(user);
+ uuid = await this.client.util.mcUUID(args.ign);
} catch (e) {
- return { content: `${this.client.util.emojis.error} \`${user}\` doesn't appear to be a valid username.` };
+ return await message.util.reply(
+ `${this.client.util.emojis.error} \`${args.ign}\` doesn't appear to be a valid username.`
+ );
}
try {
- capeperms = await got.get('http://moulberry.codes/permscapes.json').json();
+ capeperms = await got.get('https://moulberry.codes/permscapes.json').json();
} catch (error) {
capeperms = null;
}
if (capeperms == null) {
- return { content: `${this.client.util.emojis.error} There was an error finding cape perms for \`${user}\`.` };
+ return await message.util.reply(
+ `${this.client.util.emojis.error} There was an error finding cape perms for \`${args.ign}\`.`
+ );
} else {
if (capeperms?.perms) {
- const foundUser = capeperms.perms.find((u) => u._id === uuid);
- if (foundUser == null)
- return { content: `${this.client.util.emojis.error} \`${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 { embeds: [embed] };
+ let index = null;
+
+ for (let i = 0; i < capeperms.perms.length; i++) {
+ if (capeperms.perms[i]._id == uuid) {
+ index = i;
+ break;
+ }
+ }
+ if (index == null)
+ return await message.util.reply(
+ `${this.client.util.emojis.error} \`${args.ign}\` does not appear to have any capes.`
+ );
+ const userPerm: string[] = capeperms.perms[index].perms;
+ const embed = new MessageEmbed()
+ .setTitle(`${args.ign}'s Capes`)
+ .setDescription(userPerm.join('\n'))
+ .setColor(this.client.util.colors.default);
+ await message.util.reply({ embeds: [embed] });
} else {
- return { content: `${this.client.util.emojis.error} There was an error finding cape perms for ${user}.` };
+ return await message.util.reply(
+ `${this.client.util.emojis.error} There was an error finding cape perms for ${args.ign}.`
+ );
}
}
}
- public async exec(message: Message, { user }: { user: string }): Promise<void> {
- await message.reply(await this.getResponse(user));
- }
-
- public async execSlash(message: BushSlashMessage, { 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 d308602..19163d7 100644
--- a/src/commands/moulberry-bush/giveawayPing.ts
+++ b/src/commands/moulberry-bush/giveawayPing.ts
@@ -1,5 +1,5 @@
-import { Message, NewsChannel, TextChannel, WebhookClient } from 'discord.js';
import { BushCommand } from '../../lib/extensions/BushCommand';
+import { BushMessage } from '../../lib/extensions/BushMessage';
import AllowedMentions from '../../lib/utils/AllowedMentions';
export default class GiveawayPingCommand extends BushCommand {
@@ -19,16 +19,26 @@ export default class GiveawayPingCommand extends BushCommand {
ignorePermissions: [],
cooldown: 1.44e7, //4 hours
ratelimit: 1,
- editable: false
+ editable: false,
+ restrictedGuilds: ['516977525906341928'],
+ restrictedChannels: ['767782084981817344', '833855738501267456']
});
}
- public async exec(message: Message): Promise<unknown> {
- if (message.guild.id !== '516977525906341928')
- return message.reply(`${this.client.util.emojis.error} This command may only be run in Moulberry's Bush.`);
- if (!['767782084981817344', '833855738501267456'].includes(message.channel.id))
- return message.reply(`${this.client.util.emojis.error} This command may only be run in giveaway channels.`);
- await message.delete().catch(() => undefined);
- const webhooks = await (message.channel as TextChannel | NewsChannel).fetchWebhooks();
+
+ public async exec(message: BushMessage): Promise<unknown> {
+ if (!message.member.permissions.has('MANAGE_GUILD'))
+ await message.util.reply(`${this.client.util.emojis.error} You are missing the \`manage server\` permission.`);
+
+ await message.delete().catch(() => {});
+
+ return await message.channel.send({
+ content:
+ '🎉 <@&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.',
+ allowedMentions: AllowedMentions.roles()
+ });
+
+ //! Broken
+ /* 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');
@@ -37,11 +47,12 @@ export default class GiveawayPingCommand extends BushCommand {
const webhook = webhooks.first();
webhookClient = new WebhookClient(webhook.id, webhook.token);
}
- return webhookClient.send({
- content: `🎉 <@&767782793261875210> Giveaway.\n\n${this.client.util.emojis.mad} 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.`,
+ return await webhookClient.send({
+ content:
+ '🎉 <@&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
index f822555..41541e0 100644
--- a/src/commands/moulberry-bush/level.ts
+++ b/src/commands/moulberry-bush/level.ts
@@ -1,4 +1,4 @@
-import { CommandInteractionOption, Message, User } from 'discord.js';
+import { Message, User } from 'discord.js';
import { BushCommand } from '../../lib/extensions/BushCommand';
import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
import { Level } from '../../lib/models';
@@ -26,7 +26,7 @@ export default class LevelCommand extends BushCommand {
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: '{error} Choose a valid user to see the level of.',
optional: true
}
}
@@ -139,7 +139,7 @@ export default class LevelCommand extends BushCommand {
}
}
- async exec(message: Message, { user }: { user?: User }): Promise<void> {
+ async exec(message: Message | BushSlashMessage, { user }: { user?: User }): Promise<void> {
// await message.reply(
// new MessageAttachment(
// await this.getImage(user || message.author),
@@ -148,13 +148,4 @@ export default class LevelCommand extends BushCommand {
// );
await message.reply(await this.getResponse(user || message.author));
}
- async execSlash(message: BushSlashMessage, { user }: { user?: CommandInteractionOption }): Promise<void> {
- // await message.reply(
- // new MessageAttachment(
- // await this.getImage(user?.user || message.user),
- // 'lel.png'
- // )
- // );
- await message.reply(await this.getResponse(user?.user || message.author));
- }
}
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts
index e9b09eb..3cd9ec6 100644
--- a/src/commands/moulberry-bush/rule.ts
+++ b/src/commands/moulberry-bush/rule.ts
@@ -1,69 +1,60 @@
-import { Argument } from 'discord-akairo';
-import { CommandInteraction, Message, MessageEmbed, User } from 'discord.js';
-import { SlashCommandOption } from '../../lib/extensions/BushClientUtil';
+import { Argument, Constants } from 'discord-akairo';
+import { MessageEmbed, User } from 'discord.js';
import { BushCommand } from '../../lib/extensions/BushCommand';
-import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
+import { BushMessage } from '../../lib/extensions/BushMessage';
+import AllowedMentions from '../../lib/utils/AllowedMentions';
+const rules = [
+ {
+ title: "1.) Follow Discord's TOS",
+ description:
+ "Be sure to follow discord's TOS found at <https://discordapp.com/tos>, you must be 13 to use discord so if you admit to being under 13 you will be banned from the server."
+ },
+ {
+ title: '2.) 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: '3.) 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: '4.) English',
+ description: 'The primary language of the server is English, please keep all discussions in English.'
+ },
+ {
+ title: '5.) Safe for Work',
+ description:
+ 'Please keep NSFW and NSFL content out of this server, avoid borderline images as well as keeping your status, profile picture, and banner SFW.'
+ },
+ {
+ title: '6.) No Advertising',
+ description: 'Do not promote anything without prior approval from a staff member, this includes DM advertising.'
+ },
+ {
+ title: '7.) Impersonation',
+ description:
+ 'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.'
+ },
+ { title: '8.) Swearing', description: 'Swearing is allowed only when not used as an insult.' },
+ {
+ title: "9.) 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** ban that cannot be appealed."
+ },
+ {
+ title: '10.) No Backseat Moderating',
+ description: 'If you see a rule being broken be broken, please report it using: `-report <user> [evidence]`.'
+ },
+ {
+ title: '11.) 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.'
+ }
+];
export default class RuleCommand extends BushCommand {
- private rules = [
- {
- title: "Follow Discord's TOS",
- description:
- "Be sure to follow discord's TOS found at <https://discordapp.com/tos>, 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 <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.'
- },
- {
- 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'],
@@ -76,98 +67,93 @@ export default class RuleCommand extends BushCommand {
args: [
{
id: 'rule',
- type: Argument.range('number', 1, 12, true),
+ type: Argument.range(Constants.ArgumentTypes.INTEGER, 1, rules.length, true),
+ match: Constants.ArgumentMatches.PHRASE,
prompt: {
start: 'What rule would you like to have cited?',
retry: '{error} Choose a valid rule.',
optional: true
- },
- default: undefined
+ }
},
{
id: 'user',
type: 'user',
+ match: Constants.ArgumentMatches.PHRASE,
prompt: {
start: 'What user would you like to mention?',
retry: '{error} Choose a valid user to mention.',
optional: true
- },
- default: undefined
+ }
}
],
clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'],
channel: 'guild',
+ restrictedGuilds: ['516977525906341928'],
+ slash: true,
slashOptions: [
{
- type: 'INTEGER',
name: 'rule',
- description: 'The rule to show',
+ description: 'The rule you would you like to have cited',
+ type: 'INTEGER',
required: false
},
{
- type: 'USER',
name: 'user',
- description: 'The user to ping',
+ description: 'The user you would like to mention.',
+ type: 'USER',
required: false
}
],
- slash: true
+ slashGuilds: ['516977525906341928']
});
}
- private getResponse(
- message: Message | CommandInteraction,
- rule?: number,
- user?: User
- ): { content?: string; embeds?: MessageEmbed[] } | [string, MessageEmbed] {
- if (
- message.guild.id !== '516977525906341928' &&
- !this.client.ownerID.includes(message instanceof Message ? message.author.id : message.user.id)
- ) {
- return { content: `${this.client.util.emojis.error} 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 }));
+
+ public async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> {
+ const rulesEmbed = new MessageEmbed()
+ .setColor('ef3929')
+ .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }))
+ .setTimestamp();
+
+ if (rule > 12 || rule < 1) {
+ rule = undefined;
}
if (rule) {
- const foundRule = this.rules[rule - 1];
- rulesEmbed.addField(`${rule}) ${foundRule.title}`, foundRule.description);
+ if (rules[rule - 1]?.title && rules[rule - 1]?.description)
+ rulesEmbed.addField(rules[rule - 1].title, rules[rule - 1].description);
} else {
- for (const curRule of this.rules) {
- rulesEmbed.addField(`${this.rules.indexOf(curRule) + 1}) ${curRule.title}`, curRule.description);
+ for (let i = 0; i < rules.length; i++) {
+ if (rules[i]?.title && rules[i]?.description) rulesEmbed.addField(rules[i].title, rules[i].description);
}
}
- if (!user) {
- return { embeds: [rulesEmbed] };
- } else {
- return [`<@!${user.id}>`, rulesEmbed];
- }
- }
- 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({
- content: response[0],
- embeds: [response[1]]
- });
- } else {
- await message.util.send(response);
+ await respond();
+ if (!message.util.isSlash) {
+ await message.delete().catch(() => {});
}
- await message.delete().catch(() => undefined);
- }
-
- public async execSlash(
- message: BushSlashMessage,
- { rule, user }: { rule?: SlashCommandOption<number>; user?: SlashCommandOption<void> }
- ): Promise<void> {
- const response = this.getResponse(message.interaction, rule?.value, user?.user);
- if (Array.isArray(response)) {
- await message.interaction.reply({
- content: response[0],
- embeds: [response[1]]
- });
- } else {
- await message.interaction.reply(response);
+ return;
+ async function respond(): Promise<unknown> {
+ if (!user) {
+ return (
+ // If the original message was a reply -> imitate it
+ message.reference?.messageID && !message.util.isSlash
+ ? await message.channel.messages.fetch(message.reference.messageID).then(async (message) => {
+ await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() });
+ })
+ : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() })
+ );
+ } else {
+ return message.reference?.messageID && !message.util.isSlash
+ ? await message.util.send({
+ content: `<@!${user.id}>`,
+ embeds: [rulesEmbed],
+ allowedMentions: AllowedMentions.users(),
+ reply: { messageReference: message.reference.messageID }
+ })
+ : await message.util.send({
+ content: `<@!${user.id}>`,
+ embeds: [rulesEmbed],
+ allowedMentions: AllowedMentions.users()
+ });
+ }
}
}
}