diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-14 12:47:57 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-14 12:47:57 -0400 |
commit | 661e4c9935aeb8760dafc7ced4bbec6cc356a033 (patch) | |
tree | bb4c12bdef067d203f100e13e05ccb705b299834 /src/commands/utilities/steal.ts | |
parent | eaf592b72eb5b1d66aa2bde5151a8947570a506c (diff) | |
download | tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.tar.gz tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.tar.bz2 tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.zip |
remove the war crimes that I previously committed
- Remove custom typings and replace with declaration merging
- Fix the typings for args
- Replace all discord-api-types imports with discord.js imports
- Fix discord.js breaking changes
Diffstat (limited to 'src/commands/utilities/steal.ts')
-rw-r--r-- | src/commands/utilities/steal.ts | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index e4f08f1..69d3054 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -1,7 +1,7 @@ -import { BushCommand, OptArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { BushCommand, OptArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert'; import { type ArgumentGeneratorReturn, type ArgumentType, type ArgumentTypeCaster } from 'discord-akairo'; -import { ApplicationCommandOptionType, PermissionFlagsBits, type Attachment } from 'discord.js'; +import { ApplicationCommandOptionType, Attachment, PermissionFlagsBits } from 'discord.js'; import _ from 'lodash'; import { Stream } from 'stream'; import { URL } from 'url'; @@ -41,7 +41,7 @@ export default class StealCommand extends BushCommand { }); } - public override *args(message: BushMessage): ArgumentGeneratorReturn { + public override *args(message: CommandMessage): ArgumentGeneratorReturn { const hasImage = message.attachments.size && message.attachments.first()?.contentType?.includes('image/'); const emoji = hasImage @@ -60,8 +60,8 @@ export default class StealCommand extends BushCommand { } public override async exec( - message: BushMessage, - args: { emoji: OptArgType<'discordEmoji'> | OptArgType<'snowflake'> | OptArgType<'url'> | string; name: string } + message: CommandMessage, + args: { emoji: OptArgType<'discordEmoji' | 'snowflake' | 'url'>; name: OptArgType<'string'> } ) { assert(message.inGuild()); @@ -88,7 +88,9 @@ export default class StealCommand extends BushCommand { : 'stolen_emoji'; const creationSuccess = await message.guild.emojis - .create(image, emojiName, { + .create({ + attachment: image, + name: emojiName, reason: `Stolen by ${message.author.tag} (${message.author.id})` }) .catch((e: Error) => e); @@ -102,7 +104,7 @@ export default class StealCommand extends BushCommand { } } - public override async execSlash(message: BushSlashMessage, args: { emoji: Attachment; name?: string }) { + public override async execSlash(message: SlashMessage, args: { emoji: Attachment; name: string | null }) { assert(message.inGuild()); const name = args.name ?? args.emoji.name ?? 'stolen_emoji'; @@ -119,7 +121,9 @@ export default class StealCommand extends BushCommand { : args.emoji.attachment; const creationSuccess = await message.guild.emojis - .create(data, name, { + .create({ + attachment: data, + name: name, reason: `Stolen by ${message.author.tag} (${message.author.id})` }) .catch((e: Error) => e); |