diff --git a/package-lock.json b/package-lock.json old mode 100644 new mode 100755 index 3c58765..4b816bf --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "arunabase", - "version": "1.0.0-ALPHA.2", + "version": "1.0.0-ALPHA.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "arunabase", - "version": "1.0.0-ALPHA.2", + "version": "1.0.0-ALPHA.3", "license": "GPL-3.0", "dependencies": { "@twitchapis/twitch.js": "^2.0.0-beta.0", diff --git a/package.json b/package.json old mode 100644 new mode 100755 index c453c9b..b59f23e --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "arunabase", - "version": "1.0.0-ALPHA.2", + "version": "1.0.0-ALPHA.3", "description": "An API made to help developers what works with discord and twitch.", "main": "build/index.js", "types": "src/main/index.ts", diff --git a/src/main/discord/Client.ts b/src/main/discord/Client.ts old mode 100644 new mode 100755 index abed480..56264fb --- a/src/main/discord/Client.ts +++ b/src/main/discord/Client.ts @@ -1,5 +1,5 @@ +import { ClientOptions, Client as DJSClient } from 'discord.js'; import { IDiscordConfiguration } from '../interfaces'; -import { Client as DJSClient } from 'discord.js'; import { CommandManager } from './managers'; import { Utils } from '@twitchapis/twitch.js'; @@ -12,7 +12,7 @@ export class DiscordClient extends DJSClient { private logger: Utils.Logger; constructor(options: IDiscordConfiguration) { - super(options); + super(options as ClientOptions); this.prefix = options.prefix ?? '!'; this.allowSlashCommands = options.allowSlashCommands ?? true; @@ -48,6 +48,16 @@ export class DiscordClient extends DJSClient { public getLogger(): Utils.Logger { return this.logger; } + + public login(token?: string): Promise { + if (token) { + return super.login(token); + } else if (this.configuration.token) { + return super.login(this.configuration.token); + } else { + throw new Error('No token provided.'); + } + } } export { IntentsBitField as Intents } from 'discord.js'; diff --git a/src/main/discord/structures/CommandStructure.ts b/src/main/discord/structures/CommandStructure.ts old mode 100644 new mode 100755 index 819946b..ae7fa33 --- a/src/main/discord/structures/CommandStructure.ts +++ b/src/main/discord/structures/CommandStructure.ts @@ -22,8 +22,8 @@ class CommandStructureBase { constructor(name: string, options: ICommandOptions) { this.name = name; this.description = options.description; - this.isSlashCommand = options.isSlashCommand; - this.isLegacyCommand = options.isLegacyCommand; + this.isSlashCommand = options.isSlashCommand ?? true; + this.isLegacyCommand = options.isLegacyCommand ?? true; this.allowDM = options.allowDM ?? true; this.aliases = options.aliases ?? []; this.type = options.type ?? ApplicationCommandType.ChatInput; // Slash Commands only diff --git a/src/main/interfaces/IDiscordConfiguration.ts b/src/main/interfaces/IDiscordConfiguration.ts old mode 100644 new mode 100755 index eec1863..99e9d0d --- a/src/main/interfaces/IDiscordConfiguration.ts +++ b/src/main/interfaces/IDiscordConfiguration.ts @@ -4,6 +4,7 @@ export interface IDiscordConfiguration extends ClientOptions { botID?: string, token?: string, prefix?: string, + shardId?: number, allowSlashCommands?: boolean, allowLegacyCommands?: boolean, } diff --git a/tsconfig.json b/tsconfig.json old mode 100644 new mode 100755 index f9947e8..5cda978 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "removeComments": false, "declaration": true, "declarationMap": true, - "traceResolution": true, "moduleResolution": "node", "skipLibCheck": true, "target": "ES6",