aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 13:46:27 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 13:46:27 -0400
commitedcc0dd0a9228192ff6c4f6d6797dd6238e98f92 (patch)
tree70c3f5436342d7f6b0e81222467d2773a3bb0b33 /src/lib/extensions/discord-akairo
parentb63a6b0cb61f0abf8a946a7f0f04a2a19a31e690 (diff)
downloadtanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.tar.gz
tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.tar.bz2
tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.zip
upgraded to typescript 4.3.5
The reason I had to use getters and setters for the db models is because in the newer version of typescript the properties would be defined at runtime and override the getter and setters that sequalize uses later, causing all the values to be undefined and not being able to save any information.
Diffstat (limited to 'src/lib/extensions/discord-akairo')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts24
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts4
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandHandler.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitor.ts4
5 files changed, 26 insertions, 10 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 7b270f6..4c2b940 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -34,12 +34,17 @@ import { BushConstants } from '../../utils/BushConstants';
import { BushLogger } from '../../utils/BushLogger';
import { Config } from '../../utils/Config';
import { BushApplicationCommand } from '../discord.js/BushApplicationCommand';
+import { BushBaseGuildEmojiManager } from '../discord.js/BushBaseGuildEmojiManager';
import { BushButtonInteraction } from '../discord.js/BushButtonInteraction';
import { BushCategoryChannel } from '../discord.js/BushCategoryChannel';
+import { BushChannel } from '../discord.js/BushChannel';
+import { BushChannelManager } from '../discord.js/BushChannelManager';
+import { BushClientUser } from '../discord.js/BushClientUser';
import { BushCommandInteraction } from '../discord.js/BushCommandInteraction';
import { BushDMChannel } from '../discord.js/BushDMChannel';
import { BushGuild } from '../discord.js/BushGuild';
import { BushGuildEmoji } from '../discord.js/BushGuildEmoji';
+import { BushGuildManager } from '../discord.js/BushGuildManager';
import { BushGuildMember } from '../discord.js/BushGuildMember';
import { BushMessage } from '../discord.js/BushMessage';
import { BushMessageReaction } from '../discord.js/BushMessageReaction';
@@ -53,6 +58,7 @@ import { BushTextChannel } from '../discord.js/BushTextChannel';
import { BushThreadChannel } from '../discord.js/BushThreadChannel';
import { BushThreadMember } from '../discord.js/BushThreadMember';
import { BushUser } from '../discord.js/BushUser';
+import { BushUserManager } from '../discord.js/BushUserManager';
import { BushVoiceChannel } from '../discord.js/BushVoiceChannel';
import { BushVoiceState } from '../discord.js/BushVoiceState';
import { BushClientUtil } from './BushClientUtil';
@@ -75,6 +81,8 @@ 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 = BushChannel | Snowflake;
export interface BushFetchedThreads {
threads: Collection<Snowflake, BushThreadChannel>;
hasMore?: boolean;
@@ -86,7 +94,9 @@ const rl = readline.createInterface({
terminal: false
});
-export class BushClient extends AkairoClient {
+type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B;
+
+export class BushClient<Ready extends boolean = boolean> extends AkairoClient {
public static preStart(): void {
Structures.extend('GuildEmoji', () => BushGuildEmoji);
Structures.extend('DMChannel', () => BushDMChannel);
@@ -110,6 +120,12 @@ export class BushClient extends AkairoClient {
Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction);
}
+ public declare channels: BushChannelManager;
+ public declare readonly emojis: BushBaseGuildEmojiManager;
+ public declare guilds: BushGuildManager;
+ public declare user: If<Ready, BushClientUser>;
+ public declare users: BushUserManager;
+
public config: Config;
public listenerHandler: BushListenerHandler;
public inhibitorHandler: BushInhibitorHandler;
@@ -289,17 +305,17 @@ export class BushClient extends AkairoClient {
}
/** Logs out, terminates the connection to Discord, and destroys the client. */
- public destroy(relogin = false): void | Promise<string> {
+ public override destroy(relogin = false): void | Promise<string> {
super.destroy();
if (relogin) {
return this.login(this.token);
}
}
- public isOwner(user: BushUserResolvable): boolean {
+ public override isOwner(user: BushUserResolvable): boolean {
return this.config.owners.includes(this.users.resolveId(user));
}
- public isSuperUser(user: BushUserResolvable): boolean {
+ public override isSuperUser(user: BushUserResolvable): boolean {
const userID = this.users.resolveId(user);
return !!BushCache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID);
}
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index aecc635..ac39611 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -521,7 +521,7 @@ export class BushClientUtil extends ClientUtil {
/** Gets the channel configs as a TextChannel */
public async getConfigChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> {
- return (await client.channels.fetch(client.config.channels[channel])) as TextChannel;
+ return (await client.channels.fetch(client.config.channels[channel])) as unknown as TextChannel;
}
/**
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index 6616d1d..6dd5449 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -182,8 +182,8 @@ export class BushCommand extends Command {
}
}
- public exec(message: BushMessage, args: any): any;
- public exec(message: BushMessage | BushSlashMessage, args: any): any {
+ public override exec(message: BushMessage, args: any): any;
+ public override exec(message: BushMessage | BushSlashMessage, args: any): any {
super.exec(message, args);
}
}
diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
index f16554c..7eca05b 100644
--- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
@@ -35,7 +35,7 @@ export class BushCommandHandler extends CommandHandler {
super(client, options);
}
- public async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> {
+ public override async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> {
if (command.ownerOnly) {
const isOwner = client.isOwner(message.author);
if (!isOwner) {
diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts
index f924458..8a199fc 100644
--- a/src/lib/extensions/discord-akairo/BushInhibitor.ts
+++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts
@@ -8,8 +8,8 @@ import { BushSlashMessage } from './BushSlashMessage';
export class BushInhibitor extends Inhibitor {
public declare client: BushClient;
- public exec(message: BushMessage, command: BushCommand): any;
- public exec(message: BushMessage | BushSlashMessage, command: BushCommand): any {
+ public override exec(message: BushMessage, command: BushCommand): any;
+ public override exec(message: BushMessage | BushSlashMessage, command: BushCommand): any {
return super.exec(message, command);
}
}