diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-12-29 16:20:06 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-12-29 16:20:06 -0500 |
commit | dcdfc1fda7cfedf7c0f69ba51857fd7ebc71a2dd (patch) | |
tree | 49845130275172abe14162427336842a7a71ccad /src/lib/extensions/discord-akairo | |
parent | 4cebaca70939b87c78537c5c3cd099e29e2e4e04 (diff) | |
download | tanzanite-dcdfc1fda7cfedf7c0f69ba51857fd7ebc71a2dd.tar.gz tanzanite-dcdfc1fda7cfedf7c0f69ba51857fd7ebc71a2dd.tar.bz2 tanzanite-dcdfc1fda7cfedf7c0f69ba51857fd7ebc71a2dd.zip |
refactoring & documentation
Diffstat (limited to 'src/lib/extensions/discord-akairo')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 49 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushCommand.ts | 13 |
2 files changed, 15 insertions, 47 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 7321c17..706b52a 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -11,33 +11,30 @@ import { snowflake } from '#args'; import type { - BushApplicationCommand, BushBaseGuildEmojiManager, BushChannelManager, BushClientEvents, BushClientUser, BushGuildManager, - BushReactionEmoji, - BushStageChannel, BushUserManager, + BushUserResolvable, Config } from '#lib'; -import { patch, PatchedElements } from '@notenoughupdates/events-intercept'; +import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; import { - Awaitable, Intents, Options, Structures, version as discordJsVersion, - type Collection, + type Awaitable, + type If, type InteractionReplyOptions, type Message, type MessageEditOptions, type MessageOptions, type MessagePayload, - type PartialDMChannel, type ReplyMessageOptions, type Snowflake, type WebhookEditMessageOptions @@ -93,42 +90,6 @@ export type BushEditMessageType = string | MessageEditOptions | MessagePayload; export type BushSlashSendMessageType = string | MessagePayload | InteractionReplyOptions; export type BushSlashEditMessageType = string | MessagePayload | WebhookEditMessageOptions; export type BushSendMessageType = string | MessagePayload | MessageOptions; -export type BushThreadMemberResolvable = BushThreadMember | BushUserResolvable; -export type BushUserResolvable = BushUser | Snowflake | BushMessage | BushGuildMember | BushThreadMember; -export type BushGuildMemberResolvable = BushGuildMember | BushUserResolvable; -export type BushRoleResolvable = BushRole | Snowflake; -export type BushMessageResolvable = Message | BushMessage | Snowflake; -export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji; -export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; -export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; -export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake; -export type BushGuildTextChannelResolvable = BushTextChannel | BushNewsChannel | Snowflake; -export type BushChannelResolvable = BushAnyChannel | Snowflake; -export type BushGuildChannelResolvable = Snowflake | BushGuildBasedChannel; -export type BushAnyChannel = - | BushCategoryChannel - | BushDMChannel - | PartialDMChannel - | BushNewsChannel - | BushStageChannel - // eslint-disable-next-line deprecation/deprecation - | BushStoreChannel - | BushTextChannel - | BushThreadChannel - | BushVoiceChannel; -export type BushTextBasedChannel = PartialDMChannel | BushThreadChannel | BushDMChannel | BushNewsChannel | BushTextChannel; -export type BushTextBasedChannelTypes = BushTextBasedChannel['type']; -export type BushVoiceBasedChannel = Extract<BushAnyChannel, { bitrate: number }>; -export type BushGuildBasedChannel = Extract<BushAnyChannel, { guild: BushGuild }>; -export type BushNonThreadGuildBasedChannel = Exclude<BushGuildBasedChannel, BushThreadChannel>; -export type BushGuildTextBasedChannel = Extract<BushGuildBasedChannel, BushTextBasedChannel>; -export type BushTextChannelResolvable = Snowflake | BushTextChannel; -export type BushGuildVoiceChannelResolvable = BushVoiceBasedChannel | Snowflake; - -export interface BushFetchedThreads { - threads: Collection<Snowflake, BushThreadChannel>; - hasMore?: boolean; -} const rl = readline.createInterface({ input: process.stdin, @@ -136,8 +97,6 @@ const rl = readline.createInterface({ terminal: false }); -type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B; - const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 0d0a0a8..c37a55f 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -511,6 +511,11 @@ export interface BushCommand extends Command { * @param args - Evaluated arguments. */ exec<R, A>(message: BushMessage, args: A): R; + /** + * Executes the command. + * @param message - Message that triggered the command. + * @param args - Evaluated arguments. + */ exec<R, A>(message: BushMessage | BushSlashMessage, args: A): R; } @@ -523,5 +528,9 @@ type SlashOptionKeys = | keyof AkairoApplicationCommandNumericOptionData | keyof AkairoApplicationCommandSubCommandData; -export type ArgType<T extends keyof BaseBushArgumentType> = NonNullable<BaseBushArgumentType[T]>; -export type OptionalArgType<T extends keyof BaseBushArgumentType> = BaseBushArgumentType[T]; +interface PseudoArguments extends BaseBushArgumentType { + boolean: boolean; +} + +export type ArgType<T extends keyof PseudoArguments> = NonNullable<PseudoArguments[T]>; +export type OptionalArgType<T extends keyof PseudoArguments> = PseudoArguments[T]; |