aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-11-07 09:43:35 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-11-07 09:43:35 -0500
commit4ca474ca0fb5809a4c65faf730f8465a96a355d9 (patch)
treec6426852d2628fcfe24d4f8356c907b3c42bb106
parenta39aa8c11a3fd5dd5f007865960ef5429744f057 (diff)
downloadtanzanite-4ca474ca0fb5809a4c65faf730f8465a96a355d9.tar.gz
tanzanite-4ca474ca0fb5809a4c65faf730f8465a96a355d9.tar.bz2
tanzanite-4ca474ca0fb5809a4c65faf730f8465a96a355d9.zip
fix some errors I hope
-rw-r--r--src/commands/info/pronouns.ts2
-rw-r--r--src/commands/info/userInfo.ts4
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts136
3 files changed, 72 insertions, 70 deletions
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index db1a3a4..fbbc5af 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -39,6 +39,8 @@ export default class PronounsCommand extends BushCommand {
const user = args.user ?? message.author;
const author = user.id === message.author.id;
+ if (message.util.isSlashMessage(message)) await message.interaction.deferReply()
+
const pronouns = await util.getPronounsOf(user);
if (!pronouns) {
return await message.util.reply(
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 3afdff2..2b87d0b 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -95,8 +95,8 @@ export default class UserInfoCommand extends BushCommand {
const generalInfo = [`**Mention:** <@${user.id}>`, `**ID:** ${user.id}`, `**Created:** ${createdAt} (${createdAtDelta} ago)`];
if (user.accentColor !== null) generalInfo.push(`**Accent Color:** ${user.hexAccentColor}`);
if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ dynamic: true, format: 'png', size: 4096 })})`);
- const pronouns = await util.getPronounsOf(user);
- if (pronouns) generalInfo.push(`**Pronouns:** ${pronouns}`);
+ const pronouns = await Promise.race([util.getPronounsOf(user), util.sleep(2)]);
+ if (pronouns && typeof pronouns === 'string') generalInfo.push(`**Pronouns:** ${pronouns}`);
userEmbed.addField('ยป General Info', generalInfo.join('\n'));
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 0fb84f3..c2d8970 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -83,7 +83,6 @@ import { BushListenerHandler } from './BushListenerHandler.js';
import { BushTaskHandler } from './BushTaskHandler.js';
const { Sequelize } = (await import('sequelize')).default;
-
export type BushReplyMessageType = string | MessagePayload | ReplyMessageOptions;
export type BushEditMessageType = string | MessageEditOptions | MessagePayload;
export type BushSlashSendMessageType = string | MessagePayload | InteractionReplyOptions;
@@ -118,29 +117,6 @@ type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ?
const __dirname = dirname(fileURLToPath(import.meta.url));
export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> {
- public static init(): void {
- Structures.extend('GuildEmoji', () => BushGuildEmoji);
- Structures.extend('DMChannel', () => BushDMChannel);
- Structures.extend('TextChannel', () => BushTextChannel);
- Structures.extend('VoiceChannel', () => BushVoiceChannel);
- Structures.extend('CategoryChannel', () => BushCategoryChannel);
- Structures.extend('NewsChannel', () => BushNewsChannel);
- Structures.extend('StoreChannel', () => BushStoreChannel);
- Structures.extend('ThreadChannel', () => BushThreadChannel);
- Structures.extend('GuildMember', () => BushGuildMember);
- Structures.extend('ThreadMember', () => BushThreadMember);
- Structures.extend('Guild', () => BushGuild);
- Structures.extend('Message', () => BushMessage);
- Structures.extend('MessageReaction', () => BushMessageReaction);
- Structures.extend('Presence', () => BushPresence);
- Structures.extend('VoiceState', () => BushVoiceState);
- Structures.extend('Role', () => BushRole);
- Structures.extend('User', () => BushUser);
- Structures.extend('CommandInteraction', () => BushCommandInteraction);
- Structures.extend('ButtonInteraction', () => BushButtonInteraction);
- Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction);
- }
-
public declare channels: BushChannelManager;
public declare readonly emojis: BushBaseGuildEmojiManager;
public declare guilds: BushGuildManager;
@@ -163,49 +139,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
public cache = BushCache;
public sentry!: typeof Sentry;
- public override on<K extends keyof BushClientEvents>(
- event: K,
- listener: (...args: BushClientEvents[K]) => Awaitable<void>
- ): this;
- public override on<S extends string | symbol>(
- event: Exclude<S, keyof BushClientEvents>,
- listener: (...args: any[]) => Awaitable<void>
- ): this {
- return super.on(event as any, listener);
- }
-
- public override once<K extends keyof BushClientEvents>(
- event: K,
- listener: (...args: BushClientEvents[K]) => Awaitable<void>
- ): this;
- public override once<S extends string | symbol>(
- event: Exclude<S, keyof BushClientEvents>,
- listener: (...args: any[]) => Awaitable<void>
- ): this {
- return super.once(event as any, listener);
- }
-
- public override emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean;
- public override emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean {
- return super.emit(event as any, ...args);
- }
-
- public override off<K extends keyof BushClientEvents>(
- event: K,
- listener: (...args: BushClientEvents[K]) => Awaitable<void>
- ): this;
- public override off<S extends string | symbol>(
- event: Exclude<S, keyof BushClientEvents>,
- listener: (...args: any[]) => Awaitable<void>
- ): this {
- return super.off(event as any, listener);
- }
-
- public override removeAllListeners<K extends keyof BushClientEvents>(event?: K): this;
- public override removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this {
- return super.removeAllListeners(event as any);
- }
-
public constructor(config: Config) {
super({
ownerID: config.owners,
@@ -221,7 +154,8 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
},
http: { api: 'https://canary.discord.com/api' },
allowedMentions: AllowedMentions.users(), // No everyone or role mentions by default
- makeCache: Options.cacheWithLimits({})
+ makeCache: Options.cacheWithLimits({}),
+ failIfNotExists: false
});
this.token = config.token as If<Ready, string, string | null>;
@@ -305,6 +239,29 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
return this.constants;
}
+ public static init(): void {
+ Structures.extend('GuildEmoji', () => BushGuildEmoji);
+ Structures.extend('DMChannel', () => BushDMChannel);
+ Structures.extend('TextChannel', () => BushTextChannel);
+ Structures.extend('VoiceChannel', () => BushVoiceChannel);
+ Structures.extend('CategoryChannel', () => BushCategoryChannel);
+ Structures.extend('NewsChannel', () => BushNewsChannel);
+ Structures.extend('StoreChannel', () => BushStoreChannel);
+ Structures.extend('ThreadChannel', () => BushThreadChannel);
+ Structures.extend('GuildMember', () => BushGuildMember);
+ Structures.extend('ThreadMember', () => BushThreadMember);
+ Structures.extend('Guild', () => BushGuild);
+ Structures.extend('Message', () => BushMessage);
+ Structures.extend('MessageReaction', () => BushMessageReaction);
+ Structures.extend('Presence', () => BushPresence);
+ Structures.extend('VoiceState', () => BushVoiceState);
+ Structures.extend('Role', () => BushRole);
+ Structures.extend('User', () => BushUser);
+ Structures.extend('CommandInteraction', () => BushCommandInteraction);
+ Structures.extend('ButtonInteraction', () => BushButtonInteraction);
+ Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction);
+ }
+
// Initialize everything
async #init() {
this.commandHandler.useListenerHandler(this.listenerHandler);
@@ -429,4 +386,47 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
const userID = this.users.resolveId(user)!;
return !!BushCache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID);
}
+
+ public override on<K extends keyof BushClientEvents>(
+ event: K,
+ listener: (...args: BushClientEvents[K]) => Awaitable<void>
+ ): this;
+ public override on<S extends string | symbol>(
+ event: Exclude<S, keyof BushClientEvents>,
+ listener: (...args: any[]) => Awaitable<void>
+ ): this {
+ return super.on(event as any, listener);
+ }
+
+ public override once<K extends keyof BushClientEvents>(
+ event: K,
+ listener: (...args: BushClientEvents[K]) => Awaitable<void>
+ ): this;
+ public override once<S extends string | symbol>(
+ event: Exclude<S, keyof BushClientEvents>,
+ listener: (...args: any[]) => Awaitable<void>
+ ): this {
+ return super.once(event as any, listener);
+ }
+
+ public override emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean;
+ public override emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean {
+ return super.emit(event as any, ...args);
+ }
+
+ public override off<K extends keyof BushClientEvents>(
+ event: K,
+ listener: (...args: BushClientEvents[K]) => Awaitable<void>
+ ): this;
+ public override off<S extends string | symbol>(
+ event: Exclude<S, keyof BushClientEvents>,
+ listener: (...args: any[]) => Awaitable<void>
+ ): this {
+ return super.off(event as any, listener);
+ }
+
+ public override removeAllListeners<K extends keyof BushClientEvents>(event?: K): this;
+ public override removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this {
+ return super.removeAllListeners(event as any);
+ }
}