diff options
| author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-14 22:51:48 -0400 |
|---|---|---|
| committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-14 22:51:48 -0400 |
| commit | d055e0dbb86ef7fd4ee96a1531b51181e825fb4b (patch) | |
| tree | e2ed9e956f2d8167e7f225383f9917e66d2a2803 /src/commands/moulberry-bush | |
| parent | 335f7c30994fc8c4e787f407dfd4c2de63b400e3 (diff) | |
| download | tanzanite-d055e0dbb86ef7fd4ee96a1531b51181e825fb4b.tar.gz tanzanite-d055e0dbb86ef7fd4ee96a1531b51181e825fb4b.tar.bz2 tanzanite-d055e0dbb86ef7fd4ee96a1531b51181e825fb4b.zip | |
made a few changes
Diffstat (limited to 'src/commands/moulberry-bush')
| -rw-r--r-- | src/commands/moulberry-bush/capePerms.ts | 19 | ||||
| -rw-r--r-- | src/commands/moulberry-bush/giveawayPing.ts | 19 | ||||
| -rw-r--r-- | src/commands/moulberry-bush/level.ts | 10 | ||||
| -rw-r--r-- | src/commands/moulberry-bush/rule.ts | 26 |
4 files changed, 35 insertions, 39 deletions
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index a0edf8c..7eb90c5 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -1,9 +1,8 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; -import { MessageEmbed } from 'discord.js'; -import { CommandInteraction } from 'discord.js'; -import { Message } from 'discord.js'; +import { Message, MessageEmbed } from 'discord.js'; import got from 'got'; import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; import { SlashCommandOption } from '../../lib/extensions/Util'; interface Capeperms { @@ -75,12 +74,12 @@ export default class CapePermissionsCommand extends BushCommand { ] }); } - private async getResponse(user: string): Promise<string | MessageEmbed> { + private async getResponse(user: string): Promise<{ content?: string; embeds?: MessageEmbed[] }> { 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.`; + return { content: `<:error:837123021016924261> \`${user}\` doesn't appear to be a valid username.` }; } try { @@ -89,19 +88,19 @@ export default class CapePermissionsCommand extends BushCommand { capeperms = null; } if (capeperms == null) { - return `<:error:837123021016924261> There was an error finding cape perms for \`${user}\`.`; + return { content: `<: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.`; + if (foundUser == null) return { content: `<: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; + return { embeds: [embed] }; } else { - return `<:error:837123021016924261> There was an error finding cape perms for ${user}.`; + return { content: `<:error:837123021016924261> There was an error finding cape perms for ${user}.` }; } } } @@ -109,7 +108,7 @@ export default class CapePermissionsCommand extends BushCommand { await message.reply(await this.getResponse(user)); } - public async execSlash(message: CommandInteraction, { user }: { user: SlashCommandOption<string> }): Promise<void> { + public async execSlash(message: BushInteractionMessage, { 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 34de257..9a03140 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,8 +1,6 @@ +import { Message, NewsChannel, TextChannel, WebhookClient } from 'discord.js'; 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() { @@ -39,13 +37,12 @@ export default class GiveawayPingCommand extends BushCommand { 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() - } - ); + return 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 0375fd8..f53aa64 100644 --- a/src/commands/moulberry-bush/level.ts +++ b/src/commands/moulberry-bush/level.ts @@ -1,9 +1,7 @@ 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 { CommandInteractionOption, Message, User } from 'discord.js'; import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; import { Level } from '../../lib/models'; /* import canvas from 'canvas'; @@ -150,13 +148,13 @@ export default class LevelCommand extends BushCommand { // ); await message.reply(await this.getResponse(user || message.author)); } - async execSlash(message: CommandInteraction, { user }: { user?: CommandInteractionOption }): Promise<void> { + async execSlash(message: BushInteractionMessage, { 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.user)); + 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 ba4f9e6..b71b42f 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,8 +1,8 @@ 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 { CommandInteraction, Message, MessageEmbed, User } from 'discord.js'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; import { SlashCommandOption } from '../../lib/extensions/Util'; export default class RuleCommand extends BushCommand { @@ -118,12 +118,12 @@ export default class RuleCommand extends BushCommand { message: Message | CommandInteraction, rule?: number, user?: User - ): string | MessageEmbed | [string, MessageEmbed] { + ): { 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 "<:no:787549684196704257> This command can only be run in Moulberry's Bush."; + return { content: "<:no:787549684196704257> This command can only be run in Moulberry's Bush." }; } let rulesEmbed = new MessageEmbed().setColor('ef3929'); if (message instanceof Message) { @@ -138,7 +138,7 @@ export default class RuleCommand extends BushCommand { } } if (!user) { - return rulesEmbed; + return { embeds: [rulesEmbed] }; } else { return [`<@!${user.id}>`, rulesEmbed]; } @@ -146,8 +146,9 @@ export default class RuleCommand extends BushCommand { 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], { - embed: response[1] + await message.util.send({ + content: response[0], + embeds: [response[1]] }); } else { await message.util.send(response); @@ -156,16 +157,17 @@ export default class RuleCommand extends BushCommand { } public async execSlash( - message: CommandInteraction, + message: BushInteractionMessage, { rule, user }: { rule?: SlashCommandOption<number>; user?: SlashCommandOption<void> } ): Promise<void> { - const response = this.getResponse(message, rule?.value, user?.user); + const response = this.getResponse(message.interaction, rule?.value, user?.user); if (Array.isArray(response)) { - await message.reply(response[0], { + await message.interaction.reply({ + content: response[0], embeds: [response[1]] }); } else { - await message.reply(response); + await message.interaction.reply(response); } } } |
