diff options
Diffstat (limited to 'src/lib/extensions')
30 files changed, 97 insertions, 35 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 59aea26..3339a62 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -363,7 +363,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re try { await this.#init(); await this.login(this.token!); - this.taskHandler.startAll(); } catch (e) { await this.console.error('start', util.inspect(e, { colors: true, depth: 1 }), false); } diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 11f5ee3..1494aee 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -27,6 +27,7 @@ interface BaseBushArgumentOptions extends Omit<ArgumentOptions, 'type'> { description?: string; prompt?: ArgumentPromptOptions; } + export interface BushArgumentOptions extends BaseBushArgumentOptions { /** * The type that the argument should be cast to. @@ -93,26 +94,49 @@ export interface CustomBushArgumentOptions extends BaseBushArgumentOptions { export type BushMissingPermissionSupplier = (message: BushMessage | BushSlashMessage) => Promise<any> | any; export interface BushCommandOptions extends Omit<CommandOptions, 'userPermissions' | 'clientPermissions'> { - /** Whether the command is hidden from the help command. */ + /** + * Whether the command is hidden from the help command. + */ hidden?: boolean; - /** The channels the command is limited to run in. */ + + /** + * The channels the command is limited to run in. + */ restrictedChannels?: Snowflake[]; - /** The guilds the command is limited to run in. */ + + /** + * The guilds the command is limited to run in. + */ restrictedGuilds?: Snowflake[]; + description: { content: string; usage: string[]; examples: string[]; }; + args?: BushArgumentOptions[] & CustomBushArgumentOptions[]; + category: string; - /** A fake command, completely hidden from the help command. */ + + /** + * A fake command, completely hidden from the help command. + */ pseudo?: boolean; - /** Allow this command to be run in channels that are blacklisted. */ + + /** + * Allow this command to be run in channels that are blacklisted. + */ bypassChannelBlacklist?: boolean; - /** Permissions required by the client to run this command. */ + + /** + * Permissions required by the client to run this command. + */ clientPermissions: PermissionResolvable | PermissionResolvable[] | BushMissingPermissionSupplier; - /** Permissions required by the user to run this command. */ + + /** + * Permissions required by the user to run this command. + */ userPermissions: PermissionResolvable | PermissionResolvable[] | BushMissingPermissionSupplier; } @@ -127,22 +151,34 @@ export class BushCommand extends Command { examples: string[]; }; - /** The command's options */ + /** + * The command's options + */ public options: BushCommandOptions; - /** The channels the command is limited to run in. */ + /** + * The channels the command is limited to run in. + */ public restrictedChannels: Snowflake[] | undefined; - /** The guilds the command is limited to run in. */ + /** + * The guilds the command is limited to run in. + */ public restrictedGuilds: Snowflake[] | undefined; - /** Whether the command is hidden from the help command. */ + /** + * Whether the command is hidden from the help command. + */ public hidden: boolean; - /** A fake command, completely hidden from the help command. */ + /** + * A fake command, completely hidden from the help command. + */ public pseudo: boolean; - /** Allow this command to be run in channels that are blacklisted. */ + /** + * Allow this command to be run in channels that are blacklisted. + */ public bypassChannelBlacklist: boolean; public constructor(id: string, options: BushCommandOptions) { @@ -164,9 +200,9 @@ export class BushCommand extends Command { this.pseudo = Boolean(options.pseudo); this.bypassChannelBlacklist = Boolean(options.bypassChannelBlacklist); } +} - public override exec(message: BushMessage, args: any): any; - public override exec(message: BushMessage | BushSlashMessage, args: any): any { - super.exec(message, args); - } +export interface BushCommand { + exec(message: BushMessage, args: any): any; + exec(message: BushMessage | BushSlashMessage, args: any): any; } diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts index 2a74aa4..a5aabb1 100644 --- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts +++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts @@ -36,6 +36,7 @@ export class BushCommandHandler extends CommandHandler { public declare client: BushClient; public declare modules: Collection<string, BushCommand>; public declare categories: Collection<string, Category<string, BushCommand>>; + public constructor(client: BushClient, options: CommandHandlerOptions) { super(client, options); } diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts index 78563c9..c3f9994 100644 --- a/src/lib/extensions/discord-akairo/BushInhibitor.ts +++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts @@ -3,9 +3,9 @@ import { Inhibitor } from 'discord-akairo'; export class BushInhibitor extends Inhibitor { public declare client: BushClient; +} - public override exec(message: BushMessage, command: BushCommand): any; - public override exec(message: BushMessage | BushSlashMessage, command: BushCommand): any { - return super.exec(message, command); - } +export interface BushInhibitor { + exec(message: BushMessage, command: BushCommand): any; + exec(message: BushMessage | BushSlashMessage, command: BushCommand): any; } diff --git a/src/lib/extensions/discord-akairo/BushListener.ts b/src/lib/extensions/discord-akairo/BushListener.ts index 28aefe5..f6247ec 100644 --- a/src/lib/extensions/discord-akairo/BushListener.ts +++ b/src/lib/extensions/discord-akairo/BushListener.ts @@ -4,6 +4,7 @@ import type EventEmitter from 'events'; export class BushListener extends Listener { public declare client: BushClient; + public constructor( id: string, options: { diff --git a/src/lib/extensions/discord-akairo/BushSlashMessage.ts b/src/lib/extensions/discord-akairo/BushSlashMessage.ts index 4e0c297..c0a4a60 100644 --- a/src/lib/extensions/discord-akairo/BushSlashMessage.ts +++ b/src/lib/extensions/discord-akairo/BushSlashMessage.ts @@ -10,8 +10,8 @@ export class BushSlashMessage extends AkairoMessage { public constructor(client: BushClient, interaction: CommandInteraction) { super(client, interaction); } +} - public override get guild(): BushGuild | null { - return super.guild as BushGuild | null; - } +export interface BushSlashMessage { + get guild(): BushGuild | null; } diff --git a/src/lib/extensions/discord-akairo/BushTask.ts b/src/lib/extensions/discord-akairo/BushTask.ts index 4a2068d..b4359ce 100644 --- a/src/lib/extensions/discord-akairo/BushTask.ts +++ b/src/lib/extensions/discord-akairo/BushTask.ts @@ -3,6 +3,7 @@ import { Task, type TaskOptions } from 'discord-akairo'; export class BushTask extends Task { public declare client: BushClient; + public constructor(id: string, options: TaskOptions) { super(id, options); } diff --git a/src/lib/extensions/discord-akairo/BushTaskHandler.ts b/src/lib/extensions/discord-akairo/BushTaskHandler.ts index d5ccad6..ed6b91d 100644 --- a/src/lib/extensions/discord-akairo/BushTaskHandler.ts +++ b/src/lib/extensions/discord-akairo/BushTaskHandler.ts @@ -4,8 +4,9 @@ import { TaskHandler, type AkairoHandlerOptions } from 'discord-akairo'; export type BushTaskHandlerOptions = AkairoHandlerOptions; export class BushTaskHandler extends TaskHandler { + public declare client: BushClient; + public constructor(client: BushClient, options: BushTaskHandlerOptions) { super(client, options); } - declare client: BushClient; } diff --git a/src/lib/extensions/discord.js/BushActivity.ts b/src/lib/extensions/discord.js/BushActivity.ts index 10d7f05..e438918 100644 --- a/src/lib/extensions/discord.js/BushActivity.ts +++ b/src/lib/extensions/discord.js/BushActivity.ts @@ -4,6 +4,7 @@ import type { RawActivityData } from 'discord.js/typings/rawDataTypes'; export class BushActivity extends Activity { public declare emoji: BushEmoji | null; + public constructor(presence: BushPresence, data?: RawActivityData) { super(presence, data); } diff --git a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts index c3c279e..742ea76 100644 --- a/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts +++ b/src/lib/extensions/discord.js/BushBaseGuildTextChannel.ts @@ -9,13 +9,14 @@ import { import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushBaseGuildTextChannel extends BaseGuildTextChannel { - public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { - super(guild, data, client, immediatePatch); - } public declare messages: BushMessageManager; public declare threads: BushThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>; public declare readonly client: BushClient; public declare guild: BushGuild; public declare readonly members: Collection<Snowflake, BushGuildMember>; public declare readonly parent: BushCategoryChannel | null; + + public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { + super(guild, data, client, immediatePatch); + } } diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts index 03ec881..9e62d46 100644 --- a/src/lib/extensions/discord.js/BushButtonInteraction.ts +++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts @@ -8,6 +8,7 @@ export class BushButtonInteraction<Cached extends CacheType = CacheType> extends public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; + public constructor(client: BushClient, data: RawMessageButtonInteractionData) { super(client, data); } diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts index 90f52dd..c30a761 100644 --- a/src/lib/extensions/discord.js/BushCategoryChannel.ts +++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts @@ -8,6 +8,7 @@ export class BushCategoryChannel extends CategoryChannel { public declare guild: BushGuild; public declare readonly members: Collection<Snowflake, BushGuildMember>; public declare readonly parent: CategoryChannel | null; + public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { super(guild, data, client, immediatePatch); } diff --git a/src/lib/extensions/discord.js/BushCommandInteraction.ts b/src/lib/extensions/discord.js/BushCommandInteraction.ts index 3cbef57..b61ec9b 100644 --- a/src/lib/extensions/discord.js/BushCommandInteraction.ts +++ b/src/lib/extensions/discord.js/BushCommandInteraction.ts @@ -15,13 +15,14 @@ import { BushTextBasedChannels, type BushClient } from '../discord-akairo/BushCl export type BushGuildResolvable = BushGuild | BushGuildChannel | BushGuildMember | BushGuildEmoji | Invite | BushRole | Snowflake; export class BushCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> { - public constructor(client: BushClient, data: RawCommandInteractionData) { - super(client, data); - } public declare readonly client: BushClient; public declare readonly command: BushApplicationCommand | BushApplicationCommand<{ guild: BushGuildResolvable }> | null; public declare readonly channel: CacheTypeReducer<Cached, BushTextBasedChannels | null>; public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; + + public constructor(client: BushClient, data: RawCommandInteractionData) { + super(client, data); + } } diff --git a/src/lib/extensions/discord.js/BushEmoji.ts b/src/lib/extensions/discord.js/BushEmoji.ts index 4c97fee..5cdf5ac 100644 --- a/src/lib/extensions/discord.js/BushEmoji.ts +++ b/src/lib/extensions/discord.js/BushEmoji.ts @@ -4,6 +4,7 @@ import type { RawEmojiData } from 'discord.js/typings/rawDataTypes'; export class BushEmoji extends Emoji { public declare readonly client: BushClient; + public constructor(client: BushClient, emoji: RawEmojiData) { super(client, emoji); } diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index ff920ce..e3b39d3 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -19,6 +19,7 @@ export class BushGuild extends Guild { public declare readonly client: BushClient; public declare readonly me: BushGuildMember | null; public declare members: BushGuildMemberManager; + public constructor(client: BushClient, data: RawGuildData) { super(client, data); } diff --git a/src/lib/extensions/discord.js/BushGuildChannel.ts b/src/lib/extensions/discord.js/BushGuildChannel.ts index ddf4c9a..3324dc8 100644 --- a/src/lib/extensions/discord.js/BushGuildChannel.ts +++ b/src/lib/extensions/discord.js/BushGuildChannel.ts @@ -5,6 +5,7 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushGuildChannel extends GuildChannel { public declare readonly client: BushClient; public declare guild: BushGuild; + public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient, immediatePatch?: boolean) { super(guild, data, client, immediatePatch); } diff --git a/src/lib/extensions/discord.js/BushGuildEmoji.ts b/src/lib/extensions/discord.js/BushGuildEmoji.ts index f3a7491..180f78c 100644 --- a/src/lib/extensions/discord.js/BushGuildEmoji.ts +++ b/src/lib/extensions/discord.js/BushGuildEmoji.ts @@ -7,6 +7,7 @@ export class BushGuildEmoji extends GuildEmoji { public declare guild: BushGuild; public declare author: BushUser | null; public declare readonly roles: BushGuildEmojiRoleManager; + public constructor(client: BushClient, data: RawGuildEmojiData, guild: BushGuild) { super(client, data, guild); } diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 0667646..c4a2ed3 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -78,6 +78,7 @@ export class BushGuildMember extends GuildMember { public declare readonly client: BushClient; public declare guild: BushGuild; public declare user: BushUser; + public constructor(client: BushClient, data: RawGuildMemberData, guild: BushGuild) { super(client, data, guild); } diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 83ae59b..c722f3d 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -22,10 +22,12 @@ export class BushMessage<Cached extends boolean = boolean> extends Message<Cache public declare readonly member: BushGuildMember | null; public declare author: BushUser; public declare readonly channel: If<Cached, BushGuildTextBasedChannel, BushTextBasedChannels>; + public constructor(client: BushClient, data: RawMessageData) { super(client, data); } - public override fetch(force?: boolean): Promise<BushMessage> { - return super.fetch(force) as Promise<BushMessage>; - } +} + +export interface BushMessage { + fetch(force?: boolean): Promise<BushMessage>; } diff --git a/src/lib/extensions/discord.js/BushReactionEmoji.ts b/src/lib/extensions/discord.js/BushReactionEmoji.ts index 2e87183..b85916c 100644 --- a/src/lib/extensions/discord.js/BushReactionEmoji.ts +++ b/src/lib/extensions/discord.js/BushReactionEmoji.ts @@ -4,6 +4,7 @@ import type { RawReactionEmojiData } from 'discord.js/typings/rawDataTypes'; export class BushReactionEmoji extends ReactionEmoji { public declare reaction: BushMessageReaction; + public constructor(reaction: BushMessageReaction, emoji: RawReactionEmojiData) { super(reaction, emoji); } diff --git a/src/lib/extensions/discord.js/BushRole.ts b/src/lib/extensions/discord.js/BushRole.ts index 10757c1..bf09e2d 100644 --- a/src/lib/extensions/discord.js/BushRole.ts +++ b/src/lib/extensions/discord.js/BushRole.ts @@ -5,6 +5,7 @@ import type { RawRoleData } from 'discord.js/typings/rawDataTypes'; export class BushRole extends Role { public declare guild: BushGuild; public declare readonly members: Collection<Snowflake, BushGuildMember>; + public constructor(client: BushClient, data: RawRoleData, guild: BushGuild) { super(client, data, guild); } diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts index 7581236..6b33c20 100644 --- a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts +++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts @@ -8,6 +8,7 @@ export class BushSelectMenuInteraction<Cached extends CacheType = CacheType> ext public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; + public constructor(client: BushClient, data: RawMessageSelectMenuInteractionData) { super(client, data); } diff --git a/src/lib/extensions/discord.js/BushStageChannel.ts b/src/lib/extensions/discord.js/BushStageChannel.ts index 5b1fd88..1391757 100644 --- a/src/lib/extensions/discord.js/BushStageChannel.ts +++ b/src/lib/extensions/discord.js/BushStageChannel.ts @@ -7,6 +7,7 @@ export class BushStageChannel extends StageChannel { public declare readonly members: Collection<Snowflake, BushGuildMember>; public declare guild: BushGuild; public declare readonly parent: BushCategoryChannel | null; + public constructor(guild: BushGuild, data?: RawGuildChannelData) { super(guild, data); } diff --git a/src/lib/extensions/discord.js/BushStageInstance.ts b/src/lib/extensions/discord.js/BushStageInstance.ts index 67b1030..3b46bf6 100644 --- a/src/lib/extensions/discord.js/BushStageInstance.ts +++ b/src/lib/extensions/discord.js/BushStageInstance.ts @@ -5,6 +5,7 @@ import type { RawStageInstanceData } from 'discord.js/typings/rawDataTypes'; export class BushStageInstance extends StageInstance { public declare readonly channel: BushStageChannel | null; public declare readonly guild: BushGuild | null; + public constructor(client: BushClient, data: RawStageInstanceData, channel: BushStageChannel) { super(client, data, channel); } diff --git a/src/lib/extensions/discord.js/BushTextChannel.ts b/src/lib/extensions/discord.js/BushTextChannel.ts index 57a0598..57f0833 100644 --- a/src/lib/extensions/discord.js/BushTextChannel.ts +++ b/src/lib/extensions/discord.js/BushTextChannel.ts @@ -6,6 +6,7 @@ export class BushTextChannel extends TextChannel { public declare guild: BushGuild; public declare messages: BushMessageManager; public declare threads: BushThreadManager<AllowedThreadTypeForTextChannel>; + public constructor(guild: BushGuild, data?: RawGuildChannelData) { super(guild, data); } diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts index ea4b07c..5f68213 100644 --- a/src/lib/extensions/discord.js/BushThreadChannel.ts +++ b/src/lib/extensions/discord.js/BushThreadChannel.ts @@ -17,6 +17,7 @@ export class BushThreadChannel extends ThreadChannel { public declare readonly client: BushClient; public declare readonly guildMembers: Collection<Snowflake, BushGuildMember>; public declare readonly parent: BushTextChannel | BushNewsChannel | null; + public constructor(guild: BushGuild, data?: RawThreadChannelData, client?: BushClient, fromInteraction?: boolean) { super(guild, data, client, fromInteraction); } diff --git a/src/lib/extensions/discord.js/BushThreadMember.ts b/src/lib/extensions/discord.js/BushThreadMember.ts index db63d01..fa7588e 100644 --- a/src/lib/extensions/discord.js/BushThreadMember.ts +++ b/src/lib/extensions/discord.js/BushThreadMember.ts @@ -6,6 +6,7 @@ export class BushThreadMember extends ThreadMember { public declare readonly guildMember: BushGuildMember | null; public declare readonly user: BushUser | null; public declare thread: BushThreadChannel; + public constructor(thread: BushThreadChannel, data?: RawThreadMemberData) { super(thread, data); } diff --git a/src/lib/extensions/discord.js/BushUser.ts b/src/lib/extensions/discord.js/BushUser.ts index e7f232a..9b2c92a 100644 --- a/src/lib/extensions/discord.js/BushUser.ts +++ b/src/lib/extensions/discord.js/BushUser.ts @@ -7,6 +7,7 @@ export type PartialBushUser = Partialize<BushUser, 'username' | 'tag' | 'discrim export class BushUser extends User { public declare readonly client: BushClient; public declare readonly dmChannel: BushDMChannel | null; + public constructor(client: BushClient, data: RawUserData) { super(client, data); } diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts index f65906e..d5cdafc 100644 --- a/src/lib/extensions/discord.js/BushVoiceChannel.ts +++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts @@ -5,6 +5,7 @@ import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; export class BushVoiceChannel extends VoiceChannel { public declare readonly client: BushClient; public declare readonly members: Collection<Snowflake, BushGuildMember>; + public constructor(guild: BushGuild, data?: RawGuildChannelData) { super(guild, data); } diff --git a/src/lib/extensions/discord.js/BushVoiceState.ts b/src/lib/extensions/discord.js/BushVoiceState.ts index 167a369..a479143 100644 --- a/src/lib/extensions/discord.js/BushVoiceState.ts +++ b/src/lib/extensions/discord.js/BushVoiceState.ts @@ -7,6 +7,7 @@ export class BushVoiceState extends VoiceState { public declare readonly channel: BushVoiceChannel | BushStageChannel | null; public declare guild: BushGuild; public declare readonly member: BushGuildMember | null; + public constructor(guild: BushGuild, data: RawVoiceStateData) { super(guild, data); } |