diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..6313b56c57 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/package.json b/package.json index 3aed3bbf43..0861a3bbb5 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "url": "https://github.com/dirigeants/klasa.git" }, "scripts": { - "lint": "npm run test -- --fix", - "test": "npx eslint src", + "lint": "npx eslint src --fix && npx tslint --fix 'typings/*.ts'", + "test": "npx eslint src && npx tslint 'typings/*.ts'", "docs": "npx jsdoc -c ./.docstrap.json -R README.md" }, "dependencies": { @@ -29,7 +29,9 @@ "devDependencies": { "eslint": "^4.6.1", "ink-docstrap": "github:bdistin/docstrap#klasa", - "jsdoc": "github:jsdoc3/jsdoc" + "jsdoc": "github:jsdoc3/jsdoc", + "tslint": "^5.7.0", + "typescript": "^2.5.2" }, "engines": { "node": ">=8.1.0" diff --git a/src/index.js b/src/index.js index 56791f2ef3..27289acd13 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,8 @@ module.exports = { Client: require('./lib/Client'), util: require('./lib/util/util'), - colors: require('./lib/util/util'), - console: require('./lib/util/util'), + Colors: require('./lib/util/Colors'), + Console: require('./lib/util/Console'), Command: require('./lib/structures/Command'), CommandMessage: require('./lib/structures/CommandMessage'), Event: require('./lib/structures/Event'), diff --git a/src/lib/Client.js b/src/lib/Client.js index 9095980dcf..941b35820b 100644 --- a/src/lib/Client.js +++ b/src/lib/Client.js @@ -320,6 +320,7 @@ class KlasaClient extends Discord.Client { /** * Use this to login to Discord with your bot * @param {string} token Your bot token + * @returns {Promise} */ async login(token) { const start = now(); @@ -331,7 +332,7 @@ class KlasaClient extends Discord.Client { this.emit('log', loaded.join('\n')); this.settings = new Settings(this); this.emit('log', `Loaded in ${(now() - start).toFixed(2)}ms.`); - super.login(token); + return super.login(token); } /** diff --git a/src/lib/parsers/ArgResolver.js b/src/lib/parsers/ArgResolver.js index 56ad009bf2..a3c74f4ea1 100644 --- a/src/lib/parsers/ArgResolver.js +++ b/src/lib/parsers/ArgResolver.js @@ -13,7 +13,7 @@ class ArgResolver extends Resolver { * @param {number} possible This possible usage id * @param {boolean} repeat If it is a looping/repeating arg * @param {external:Message} msg The message that triggered the command - * @returns {Command} + * @returns {Piece} */ async piece(arg, currentUsage, possible, repeat, msg) { for (const store of this.client.pieceStores.values()) { @@ -31,7 +31,7 @@ class ArgResolver extends Resolver { * @param {number} possible This possible usage id * @param {boolean} repeat If it is a looping/repeating arg * @param {external:Message} msg The message that triggered the command - * @returns {Command} + * @returns {Store} */ async store(arg, currentUsage, possible, repeat, msg) { const store = this.client.pieceStores.get(arg); @@ -92,7 +92,7 @@ class ArgResolver extends Resolver { * @param {number} possible This possible usage id * @param {boolean} repeat If it is a looping/repeating arg * @param {external:Message} msg The message that triggered the command - * @returns {?Event} + * @returns {?Extendable} */ async extendable(arg, currentUsage, possible, repeat, msg) { const extendable = this.client.extendables.get(arg); diff --git a/src/lib/parsers/Resolver.js b/src/lib/parsers/Resolver.js index 910df5747f..28dff59631 100644 --- a/src/lib/parsers/Resolver.js +++ b/src/lib/parsers/Resolver.js @@ -19,7 +19,7 @@ class Resolver { /** * Fetch a Message object by its Snowflake or instanceof Message. - * @param {Snowflake} message The message snowflake to validate. + * @param {Message|Snowflake} message The message snowflake to validate. * @param {Channel} channel The Channel object in which the message can be found. * @returns {?external:Message} */ @@ -30,7 +30,7 @@ class Resolver { /** * Resolve a User object by its instance of User, GuildMember, or by its Snowflake. - * @param {User} user The user to validate. + * @param {(User|GuildMember|Message|Snowflake)} user The user to validate. * @returns {?external:User} */ async user(user) { diff --git a/src/lib/parsers/SettingResolver.js b/src/lib/parsers/SettingResolver.js index f68d6696d6..9b454d973a 100644 --- a/src/lib/parsers/SettingResolver.js +++ b/src/lib/parsers/SettingResolver.js @@ -178,7 +178,7 @@ class SettingResolver extends Resolver { * @param {any} data The data to resolve * @param {external:Guild} guild The guild to resolve for * @param {string} name The name of the key being resolved - * @returns {Command} + * @returns {Language} */ async language(data, guild, name) { const language = this.client.languages.get(data); @@ -197,7 +197,7 @@ class SettingResolver extends Resolver { * @param {string} [suffix=''] The suffix to apply to the error messages * @returns {boolean} */ - static async maxOrMin(guild, value, min, max, name, suffix = '') { + static maxOrMin(guild, value, min, max, name, suffix = '') { if (min && max) { if (value >= min && value <= max) return true; if (min === max) throw guild.language.get('RESOLVER_MINMAX_EXACTLY', name, min, suffix); diff --git a/src/lib/settings/SQL.js b/src/lib/settings/SQL.js index bba60ec244..a90289d77b 100644 --- a/src/lib/settings/SQL.js +++ b/src/lib/settings/SQL.js @@ -53,7 +53,7 @@ class SQL { buildSQLSchema(schema) { const output = ['id TEXT NOT NULL UNIQUE']; for (const [key, value] of Object.entries(schema)) { - output.push(`${key} ${this.buildSingleSQLSchema(key, value)}`); + output.push(`${key} ${this.buildSingleSQLSchema(value)}`); } return output; } @@ -74,7 +74,11 @@ class SQL { */ deserializer(data) { const deserialize = this.deserializeKeys; - for (let i = 0; i < deserialize.length; i++) data[deserialize[i]] = JSON.parse(data[deserialize[i]]); + for (let i = 0; i < deserialize.length; i++) { + if (typeof data[deserialize[i]] !== 'undefined') { + data[deserialize[i]] = JSON.parse(data[deserialize[i]]); + } + } } /** diff --git a/src/lib/settings/SchemaManager.js b/src/lib/settings/SchemaManager.js index 662dd11228..97e1c92d3c 100644 --- a/src/lib/settings/SchemaManager.js +++ b/src/lib/settings/SchemaManager.js @@ -63,7 +63,7 @@ class SchemaManager extends CacheManager { /** * @typedef {Object} AddOptions * @property {string} type The type for the key. - * @property {string} default The default value for the key. + * @property {any} default The default value for the key. * @property {number} min The min value for the key (String.length for String, value for number). * @property {number} max The max value for the key (String.length for String, value for number). * @property {boolean} array Whether the key should be stored as Array or not. @@ -123,6 +123,7 @@ class SchemaManager extends CacheManager { * Modify all configurations. Do NOT use this directly. * @param {string} action Whether reset, add, or delete. * @param {string} key The key to update. + * @private * @returns {void} */ async force(action, key) { diff --git a/src/lib/settings/SettingGateway.js b/src/lib/settings/SettingGateway.js index af654f09bf..1f1a1bda14 100644 --- a/src/lib/settings/SettingGateway.js +++ b/src/lib/settings/SettingGateway.js @@ -115,7 +115,7 @@ class SettingGateway extends SchemaManager { /** * Updates an entry. * @param {(Object|string)} input An object containing a id property, like Discord.js objects, or a string. - * @param {(Object|string)} [guild=null] A Guild resolvable, useful for when the instance of SG doesn't aim for Guild settings. + * @param {external:Guild} [guild=null] A Guild resolvable, useful for when the instance of SG doesn't aim for Guild settings. * @returns {Object} */ async getResolved(input, guild = null) { diff --git a/src/lib/structures/CommandStore.js b/src/lib/structures/CommandStore.js index 009e47cb64..011c3e8033 100644 --- a/src/lib/structures/CommandStore.js +++ b/src/lib/structures/CommandStore.js @@ -56,15 +56,6 @@ class CommandStore extends Collection { this.name = 'commands'; } - /** - * The specific command information needed to make our help command. - * @type {Array} - * @readonly - */ - get help() { - return this.map(command => ({ name: command.name, usage: command.parsedUsage.fullUsage, description: command.description })); - } - /** * Returns a command in the store if it exists by its name or by an alias. * @param {string} name A command or alias name. @@ -121,7 +112,7 @@ class CommandStore extends Collection { /** * Loads a command file into Klasa so it can saved in this store. * @param {string} dir The user directory or core directory where this file is saved. - * @param {Array} file An array containing information about it's category structure. + * @param {string[]} file An array containing information about it's category structure. * @returns {Command} */ load(dir, file) { @@ -132,7 +123,7 @@ class CommandStore extends Collection { /** * Loads all of our commands from both the user and core directories. - * @returns {number[]} The number of commands and aliases loaded. + * @returns {number} The number of commands and aliases loaded. */ async loadAll() { this.clear(); diff --git a/src/lib/structures/Extendable.js b/src/lib/structures/Extendable.js index e4f3ece915..74327ceb38 100644 --- a/src/lib/structures/Extendable.js +++ b/src/lib/structures/Extendable.js @@ -85,7 +85,6 @@ class Extendable { /** * The init method to apply the extend method to the Discord.js Class - * @private */ async init() { if (this.enabled) this.enable(); diff --git a/src/lib/structures/Finalizer.js b/src/lib/structures/Finalizer.js index 0e243db300..5520bee127 100644 --- a/src/lib/structures/Finalizer.js +++ b/src/lib/structures/Finalizer.js @@ -18,7 +18,7 @@ class Finalizer { /** * @param {KlasaClient} client The Klasa Client * @param {string} dir The path to the core or user finalizer pieces folder - * @param {Array} file The path from the pieces folder to the finalizer file + * @param {string} file The path from the pieces folder to the finalizer file * @param {FinalizerOptions} [options = {}] Optional Finalizer settings */ constructor(client, dir, file, options = {}) { @@ -62,7 +62,7 @@ class Finalizer { * The run method to be overwritten in actual finalizers * @param {CommandMessage} msg The command message mapped on top of the message used to trigger this finalizer * @param {external:Message} mes The bot's response message, if one is returned - * @param {external:Now} start The performance now start time including all command overhead + * @param {number} start The performance now start time including all command overhead * @abstract * @returns {void} */ diff --git a/src/lib/structures/interfaces/Store.js b/src/lib/structures/interfaces/Store.js index a3e460109a..ea271555dc 100644 --- a/src/lib/structures/interfaces/Store.js +++ b/src/lib/structures/interfaces/Store.js @@ -26,7 +26,7 @@ class Store { * Loads a piece into Klasa so it can be saved in this store. * @param {string} dir The user directory or core directory where this file is saved. * @param {string} file A string showing where the file is located. - * @returns {Finalizer} + * @returns {Piece} */ load(dir, file) { const piece = this.set(new (require(join(dir, file)))(this.client, dir, file)); diff --git a/src/lib/util/Console.js b/src/lib/util/Console.js index 07bc6698b1..c55df0c86c 100644 --- a/src/lib/util/Console.js +++ b/src/lib/util/Console.js @@ -83,24 +83,25 @@ class KlasaConsole extends Console { /** * @memberof KlasaConsole * @typedef {object} Colors - Time is for the timestamp of the log, message is for the actual output. - * @property {ColorObjects} debug An object containing a message and time color object. - * @property {ColorObjects} error An object containing a message and time color object. - * @property {ColorObjects} log An object containing a message and time color object. - * @property {ColorObjects} verbose An object containing a message and time color object. - * @property {ColorObjects} warn An object containing a message and time color object. - * @property {ColorObjects} wtf An object containing a message and time Color Object. + * @property {KlasaConsoleColorObjects} debug An object containing a message and time color object. + * @property {KlasaConsoleColorObjects} error An object containing a message and time color object. + * @property {KlasaConsoleColorObjects} log An object containing a message and time color object. + * @property {KlasaConsoleColorObjects} verbose An object containing a message and time color object. + * @property {KlasaConsoleColorObjects} warn An object containing a message and time color object. + * @property {KlasaConsoleColorObjects} wtf An object containing a message and time Color Object. */ /** * @memberof KlasaConsole - * @typedef {object} ColorObjects - * @property {MessageObject} message A message object containing colors and styles. - * @property {TimeObject} time A time object containing colors and styles. + * @typedef {object} KlasaConsoleColorObjects + * @property {string} [type='log'] The method from Console this color object should call. + * @property {KlasaConsoleMessageObject} message A message object containing colors and styles. + * @property {KlasaConsoleTimeObject} time A time object containing colors and styles. */ /** * @memberof KlasaConsole - * @typedef {object} MessageObject + * @typedef {object} KlasaConsoleMessageObject * @property {BackgroundColorTypes} background The background color. Can be a basic string like "red", a hex string, or a RGB array. * @property {TextColorTypes} text The text color. Can be a basic string like "red", a hex string, or a RGB array. * @property {StyleTypes} style A style string from StyleTypes. @@ -108,7 +109,7 @@ class KlasaConsole extends Console { /** * @memberof KlasaConsole - * @typedef {object} TimeObject + * @typedef {object} KlasaConsoleTimeObject * @property {BackgroundColorTypes} background The background color. Can be a basic string like "red", a hex string, or a RGB array. * @property {TextColorTypes} text The text color. Can be a basic string like "red", a hex string, a RGB array, or HSL array. * @property {StyleTypes} style A style string from StyleTypes. @@ -181,77 +182,77 @@ class KlasaConsole extends Console { /** * Logs everything to the console/writable stream. - * @param {*} stuff The stuff we want to print. + * @param {*} data The data we want to print. * @param {string} [type="log"] The type of log, particularly useful for coloring. */ - write(stuff, type = 'log') { - stuff = KlasaConsole.flatten(stuff, this.useColors); + write(data, type = 'log') { + data = KlasaConsole.flatten(data, this.useColors); const color = this.colors[type.toLowerCase()] || {}; const message = color.message || {}; const time = color.time || {}; const timestamp = this.timestamps ? `${this.timestamp(`[${moment().format(this.timestamps)}]`, time)} ` : ''; - super[color.type || 'log'](stuff.split('\n').map(str => `${timestamp}${this.messages(str, message)}`).join('\n')); + super[color.type || 'log'](data.split('\n').map(str => `${timestamp}${this.messages(str, message)}`).join('\n')); } /** * Calls a log write with everything to the console/writable stream. - * @param {...*} stuff The stuff we want to print. - * @returns {undefined} + * @param {...*} data The data we want to print. + * @returns {void} */ - log(...stuff) { - this.write(stuff, 'log'); + log(...data) { + this.write(data, 'log'); } /** * Calls a warn write with everything to the console/writable stream. - * @param {...*} stuff The stuff we want to print. - * @returns {undefined} + * @param {...*} data The data we want to print. + * @returns {void} */ - warn(...stuff) { - this.write(stuff, 'warn'); + warn(...data) { + this.write(data, 'warn'); } /** * Calls an error write with everything to the console/writable stream. - * @param {...*} stuff The stuff we want to print. - * @returns {undefined} + * @param {...*} data The data we want to print. + * @returns {void} */ - error(...stuff) { - this.write(stuff, 'error'); + error(...data) { + this.write(data, 'error'); } /** * Calls a debug write with everything to the console/writable stream. - * @param {...*} stuff The stuff we want to print. - * @returns {undefined} + * @param {...*} data The data we want to print. + * @returns {void} */ - debug(...stuff) { - this.write(stuff, 'debug'); + debug(...data) { + this.write(data, 'debug'); } /** * Calls a verbose write with everything to the console/writable stream. - * @param {...*} stuff The stuff we want to print. - * @returns {undefined} + * @param {...*} data The data we want to print. + * @returns {void} */ - verbose(...stuff) { - this.write(stuff, 'verbose'); + verbose(...data) { + this.write(data, 'verbose'); } /** * Calls a wtf (what a terrible failure) write with everything to the console/writable stream. - * @param {...*} stuff The stuff we want to print. - * @returns {undefined} + * @param {...*} data The data we want to print. + * @returns {void} */ - wtf(...stuff) { - this.write(stuff, 'wtf'); + wtf(...data) { + this.write(data, 'wtf'); } /** * Logs everything to the console/writable stream. * @param {Date} timestamp The timestamp to maybe format * @param {string} time The time format used for coloring - * @returns {string} + * @returns {string} */ timestamp(timestamp, time) { if (!this.useColors) return timestamp; @@ -260,7 +261,7 @@ class KlasaConsole extends Console { /** * Logs everything to the console/writable stream. - * @param {string} string The stuff we want to print. + * @param {string} string The data we want to print. * @param {string} message The message format used for coloring * @returns {string} */ diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000000..23300ae998 --- /dev/null +++ b/tslint.json @@ -0,0 +1,60 @@ +{ + "rules": { + "no-inferrable-types": [false], + "no-unused-expression": true, + "no-duplicate-variable": true, + "no-shadowed-variable": true, + "comment-format": [ + true, "check-space" + ], + "indent": [ + true, "tabs" + ], + "curly": false, + "class-name": true, + "semicolon": [true], + "triple-equals": true, + "eofline": true, + "no-bitwise": false, + "no-console": [false], + "member-access": [true, "check-accessor", "check-constructor"], + "no-consecutive-blank-lines": [true], + "no-parameter-properties": true, + "one-line": [ + false + ], + "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"], + "interface-name": [true, "always-prefix"], + "no-conditional-assignment": true, + "use-isnan": true, + "no-trailing-whitespace": true, + "quotemark": [true, "single", "avoid-escape"], + "no-use-before-declare": false, + "whitespace": [true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + }, + { + "call-signature": "onespace", + "index-signature": "onespace", + "parameter": "onespace", + "property-declaration": "onespace", + "variable-declaration": "onespace" + } + ] + } +} diff --git a/typings/index.d.ts b/typings/index.d.ts new file mode 100644 index 0000000000..e38ecfced1 --- /dev/null +++ b/typings/index.d.ts @@ -0,0 +1,1143 @@ +declare module 'klasa' { + + import { + Client, + ClientOptions, + Collection, + Snowflake, + MessageEmbed, + MessageCollector, + WebhookClient, + ClientUserGuildSettings, + ClientUserSettings, + Emoji, + User as DiscordUser, + Message as DiscordMessage, + MessageReaction, + GuildMember, + Guild as DiscordGuild, + UserResolvable, + Role, + Channel, + TextChannel as DiscordTextChannel, + VoiceChannel, + DMChannel as DiscordDMChannel, + GroupDMChannel as DiscordGroupDMChannel + } from 'discord.js'; + + export const version: string; + + class KlasaClient extends Client { + public constructor(options?: KlasaClientConfig); + public config: KlasaClientConfig; + public coreBaseDir: string; + public clientBaseDir: string; + public console: Console; + public argResolver: ArgResolver; + public commands: CommandStore; + public inhibitors: InhibitorStore; + public finalizers: FinalizerStore; + public monitors: MonitorStore; + public languages: LanguageStore; + public providers: ProviderStore; + public events: EventStore; + public extendables: ExtendableStore; + public pieceStores: Collection; + public commandMessages: Collection; + public permissionLevels: PermissionLevels; + public commandMessageLifetime: number; + public commandMessageSweep: number; + public ready: false; + public methods: { + Collection: typeof Collection; + Embed: typeof MessageEmbed; + MessageCollector: typeof MessageCollector; + Webhook: typeof WebhookClient; + CommandMessage: typeof CommandMessage; + util: object; + }; + public settings: StringMappedType>; + public application: object; + + public static readonly invite: string; + public static readonly owner: User; + public validatePermissionLevels(): PermissionLevels; + public registerStore(store: Store): KlasaClient; + public unregisterStore(store: Store): KlasaClient; + + public registerPiece(pieceName: string, store: Store): KlasaClient; + public unregisterPiece(pieceName: string): KlasaClient; + + public login(token: string): Promise; + private _ready(): void; + + public sweepCommandMessages(lifetime: number): number; + public defaultPermissionLevels: PermissionLevels; + + // Discord.js events + public on(event: string, listener: Function): this; + public on(event: 'channelCreate' | 'channelDelete', listener: (channel: Channel) => void): this; + public on(event: 'channelPinsUpdate', listener: (channel: Channel, time: Date) => void): this; + public on(event: 'channelUpdate', listener: (oldChannel: Channel, newChannel: Channel) => void): this; + public on(event: 'clientUserGuildSettingsUpdate', listener: (clientUserGuildSettings: ClientUserGuildSettings) => void): this; + public on(event: 'clientUserSettingsUpdate', listener: (clientUserSettings: ClientUserSettings) => void): this; + public on(event: 'clientUserGuildSettingsUpdate', listener: (clientUserGuildSettings: ClientUserGuildSettings) => void): this; + public on(event: 'debug' | 'warn', listener: (info: string) => void): this; + public on(event: 'disconnect', listener: (event: any) => void): this; + public on(event: 'emojiCreate | emojiDelete', listener: (emoji: Emoji) => void): this; + public on(event: 'emojiUpdate', listener: (oldEmoji: Emoji, newEmoji: Emoji) => void): this; + public on(event: 'error', listener: (error: Error) => void): this; + public on(event: 'guildBanAdd' | 'guildBanRemove', listener: (guild: Guild, user: User) => void): this; + public on(event: 'guildCreate' | 'guildDelete' | 'guildUnavailable', listener: (guild: Guild) => void): this; + public on(event: 'guildMemberAdd' | 'guildMemberAvailable' | 'guildMemberRemove', listener: (member: GuildMember) => void): this; + public on(event: 'guildMembersChunk', listener: (members: GuildMember[], guild: Guild) => void): this; + public on(event: 'guildMemberSpeaking', listener: (member: GuildMember, speaking: boolean) => void): this; + public on(event: 'guildMemberUpdate' | 'presenceUpdate' | 'voiceStateUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this; + public on(event: 'guildUpdate', listener: (oldGuild: Guild, newGuild: Guild) => void): this; + public on(event: 'message' | 'messageDelete' | 'messageReactionRemoveAll', listener: (message: Message) => void): this; + public on(event: 'messageDeleteBulk', listener: (messages: Collection) => void): this; + public on(event: 'messageReactionAdd' | 'messageReactionRemove', listener: (messageReaction: MessageReaction, user: User) => void): this; + public on(event: 'messageUpdate', listener: (oldMessage: Message, newMessage: Message) => void): this; + public on(event: 'ready' | 'reconnecting' | 'resume', listener: () => void): this; + public on(event: 'roleCreate' | 'roleDelete', listener: (role: Role) => void): this; + public on(event: 'roleUpdate', listener: (oldRole: Role, newRole: Role) => void): this; + public on(event: 'typingStart' | 'typingStop', listener: (channel: Channel, user: User) => void): this; + public on(event: 'userNoteUpdate', listener: (user: UserResolvable, oldNote: string, newNote: string) => void): this; + public on(event: 'userUpdate', listener: (oldUser: User, newUser: User) => void): this; + + // Klasa Command Events + public on(event: 'commandError', listener: (msg: Message, command: Command, params: any[], error: Error) => void): this; + public on(event: 'commandInhibited', listener: (msg: Message, command: Command, response: string|Error) => void): this; + + // Klasa Console Custom Events + public on(event: 'log', listener: (data: any, type: string) => void): this; + public on(event: 'wtf', listener: (failure: Error) => void): this; + public on(event: 'verbose', listener: (data: any) => void): this; + + // Discord.js events + public once(event: string, listener: Function): this; + public once(event: 'channelCreate' | 'channelDelete', listener: (channel: Channel) => void): this; + public once(event: 'channelPinsUpdate', listener: (channel: Channel, time: Date) => void): this; + public once(event: 'channelUpdate', listener: (oldChannel: Channel, newChannel: Channel) => void): this; + public once(event: 'clientUserGuildSettingsUpdate', listener: (clientUserGuildSettings: ClientUserGuildSettings) => void): this; + public once(event: 'clientUserSettingsUpdate', listener: (clientUserSettings: ClientUserSettings) => void): this; + public once(event: 'clientUserGuildSettingsUpdate', listener: (clientUserGuildSettings: ClientUserGuildSettings) => void): this; + public once(event: 'debug' | 'warn', listener: (info: string) => void): this; + public once(event: 'disconnect', listener: (event: any) => void): this; + public once(event: 'emojiCreate | emojiDelete', listener: (emoji: Emoji) => void): this; + public once(event: 'emojiUpdate', listener: (oldEmoji: Emoji, newEmoji: Emoji) => void): this; + public once(event: 'error', listener: (error: Error) => void): this; + public once(event: 'guildBanAdd' | 'guildBanRemove', listener: (guild: Guild, user: User) => void): this; + public once(event: 'guildCreate' | 'guildDelete' | 'guildUnavailable', listener: (guild: Guild) => void): this; + public once(event: 'guildMemberAdd' | 'guildMemberAvailable' | 'guildMemberRemove', listener: (member: GuildMember) => void): this; + public once(event: 'guildMembersChunk', listener: (members: GuildMember[], guild: Guild) => void): this; + public once(event: 'guildMemberSpeaking', listener: (member: GuildMember, speaking: boolean) => void): this; + public once(event: 'guildMemberUpdate' | 'presenceUpdate' | 'voiceStateUpdate', listener: (oldMember: GuildMember, newMember: GuildMember) => void): this; + public once(event: 'guildUpdate', listener: (oldGuild: Guild, newGuild: Guild) => void): this; + public once(event: 'message' | 'messageDelete' | 'messageReactionRemoveAll', listener: (message: Message) => void): this; + public once(event: 'messageDeleteBulk', listener: (messages: Collection) => void): this; + public once(event: 'messageReactionAdd' | 'messageReactionRemove', listener: (messageReaction: MessageReaction, user: User) => void): this; + public once(event: 'messageUpdate', listener: (oldMessage: Message, newMessage: Message) => void): this; + public once(event: 'ready' | 'reconnecting' | 'resume', listener: () => void): this; + public once(event: 'roleCreate' | 'roleDelete', listener: (role: Role) => void): this; + public once(event: 'roleUpdate', listener: (oldRole: Role, newRole: Role) => void): this; + public once(event: 'typingStart' | 'typingStop', listener: (channel: Channel, user: User) => void): this; + public once(event: 'userNoteUpdate', listener: (user: UserResolvable, oldNote: string, newNote: string) => void): this; + public once(event: 'userUpdate', listener: (oldUser: User, newUser: User) => void): this; + + // Klasa Command Events + public once(event: 'commandError', listener: (msg: Message, command: Command, params: any[], error: Error) => void): this; + public once(event: 'commandInhibited', listener: (msg: Message, command: Command, response: string|Error) => void): this; + + // Klasa Console Custom Events + public once(event: 'log', listener: (data: any, type: string) => void): this; + public once(event: 'wtf', listener: (failure: Error) => void): this; + public once(event: 'verbose', listener: (data: any) => void): this; + + } + + export { KlasaClient as Client }; + + export class Util { + public static codeBlock(lang: string, expression: string): string; + public static clean(text: string): string; + private static initClean(client: KlasaClient): void; + public static toTitleCase(str: string): string; + public static newError(error: Error, code: number): Error; + public static regExpEsc(str: string): string; + public static applyToClass(base: object, structure: object, skips: string[]): void; + } + + export class Resolver { + public constructor(client: KlasaClient); + public client: KlasaClient; + + public msg(input: Message|Snowflake, channel: Channel): Promise; + public user(input: User|GuildMember|Message|Snowflake): Promise; + public member(input: User|GuildMember|Snowflake, guild: Guild): Promise; + public channel(input: Channel|Snowflake): Promise; + public guild(input: Guild|Snowflake): Promise; + public role(input: Role|Snowflake, guild: Guild): Promise; + public boolean(input: boolean|string): Promise; + public string(input: string): Promise; + public integer(input: string|number): Promise; + public float(input: string|number): Promise; + public url(input: string): Promise; + + public static readonly regex: { + userOrMember: RegExp, + channel: RegExp, + role: RegExp, + snowflake: RegExp, + }; + } + + export class ArgResolver extends Resolver { + public piece(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public store(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public cmd(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public command(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public event(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public extendable(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public finalizer(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public inhibitor(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public monitor(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public language(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public provider(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public msg(input: string|Message, channel: Channel): Promise; + public msg(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public message(input: string|Message, channel: Channel): Promise; + public message(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public user(input: User|GuildMember|Message|Snowflake): Promise; + public user(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public mention(input: User|GuildMember|Message|Snowflake): Promise; + public mention(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public member(input: User|GuildMember|Snowflake, guild: Guild): Promise; + public member(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public channel(input: Channel|Snowflake): Promise; + public channel(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public guild(input: Guild|Snowflake): Promise; + public guild(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public role(input: Role|Snowflake, guild: Guild): Promise; + public role(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public literal(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public bool(input: boolean|string): Promise; + public bool(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public boolean(input: boolean|string): Promise; + public boolean(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public str(input: string): Promise; + public str(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public string(input: string): Promise; + public string(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public int(input: string|number): Promise; + public int(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public integer(input: string|number): Promise; + public integer(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public num(input: string|number): Promise; + public num(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public number(input: string|number): Promise; + public number(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public float(input: string|number): Promise; + public float(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public reg(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public regex(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + public regexp(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public url(input: string): Promise; + public url(arg: string, currentUsage: object, possible: number, repeat: boolean, msg: Message): Promise; + + public static minOrMax(value: number, min: number, max: number, currentUsage: object, possible: number, repeat: boolean, msg: Message, suffix: string): boolean; + } + + export class SettingResolver extends Resolver { + public command(data: any, guild: Guild, name: string): Promise; + public language(data: any, guild: Guild, name: string): Promise; + + public user(input: User|GuildMember|Message|Snowflake): Promise; + public user(data: any, guild: Guild, name: string): Promise; + + public channel(input: Channel|Snowflake): Promise; + public channel(data: any, guild: Guild, name: string): Promise; + + public textchannel(data: any, guild: Guild, name: string): Promise; + public voicechannel(data: any, guild: Guild, name: string): Promise; + + public guild(input: Guild|Snowflake): Promise; + public guild(data: any, guild: Guild, name: string): Promise; + + public role(input: Role|Snowflake, guild: Guild): Promise; + public role(data: any, guild: Guild, name: string): Promise; + + public boolean(input: boolean|string): Promise; + public boolean(data: any, guild: Guild, name: string): Promise; + + public string(input: string): Promise; + public string(data: any, guild: Guild, name: string, minMax: { min: number, max: number }): Promise; + + public integer(input: string|number): Promise; + public integer(data: any, guild: Guild, name: string, minMax: { min: number, max: number }): Promise; + + public float(input: string|number): Promise; + public float(data: any, guild: Guild, name: string, minMax: { min: number, max: number }): Promise; + + public url(input: string): Promise; + public url(data: any, guild: Guild, name: string): Promise; + + public static maxOrMin(guild: Guild, value: number, min: number, max: number, name: string, suffix: string): boolean; + } + + export class PermissionLevels extends Collection { + public constructor(levels: number); + public requiredLevels: number; + + public addLevel(level: number, brk: boolean, check: Function); + public set(level: number, obj: PermissionLevel): this; + public isValid(): boolean; + public debug(): string; + + public run(msg: Message, min: number): permissionLevelResponse; + } + + // Usage + export class ParsedUsage { + public constructor(client: KlasaClient, command: Command); + public readonly client: KlasaClient; + public names: string[]; + public commands: string; + public deliminatedUsage: string; + public usageString: string; + public parsedUsage: Tag[]; + public nearlyFullUsage: string; + + public fullUsage(msg: Message): string; + public static parseUsage(usageString: string): Tag[]; + public static tagOpen(usage: object, char: string): object; + public static tagClose(usage: object, char: string): object; + public static tagSpace(usage: object, char: string): object; + } + + export class Possible { + public constructor(regexResults: string[]); + public name: string; + public type: string; + public min: number; + public max: number; + public regex: RegExp; + + public static resolveLimit(limit: string, type: string): number; + } + + export class Tag { + public constructor(members: string, count: number, required: boolean); + public type: string; + public possibles: Possible[]; + + public static parseMembers(members: string, count: number): Possible[]; + public static parseTrueMembers(members: string): string[]; + } + + // Settings + export class CacheManager { + public constructor(client: KlasaClient); + public readonly cacheEngine: string; + public data: Collection|Provider; + + public get(key: string): object; + public getAll(): object[]; + public set(key: string, value: object): any; + public delete(key: string): any; + } + + export class SchemaManager extends CacheManager { + public constructor(client: KlasaClient); + public schema: object; + public defaults: object; + + public initSchema(): Promise; + public validateSchema(schema: object): void; + public add(key: string, options: AddOptions, force: boolean): Promise; + public remove(key: string, force: boolean): Promise; + private force(action: string, key: string): Promise; + } + + export class SettingGateway extends SchemaManager { + public constructor(store: SettingCache, type: T, validateFunction: Function, schema: object); + public readonly store: SettingCache; + public type: T; + public engine: string; + public sql: SQL; + public validate: Function; + public defaultDataSchema: object; + + public initSchema(): Promise; + public create(input: object|string): Promise; + public destroy(input: string): Promise; + public get(input: string): object; + public getResolved(input: object|string, guild: SettingGatewayGuildResolvable): Promise; + public sync(input: object|string): Promise; + public reset(input: object|string, key: string): Promise; + public update(input: object|string, object: object, guild: SettingGatewayGuildResolvable): object; + public ensureCreate(target: object|string): true; + public updateArray(input: object|string, action: 'add'|'remove', key: string, data: any): Promise; + private _resolveGuild(guild: Guild|TextChannel|VoiceChannel|Snowflake): Guild; + + public readonly client: KlasaClient; + public readonly resolver: Resolver; + public readonly provider: Provider; + } + + export class SettingCache { + public constructor(client: KlasaClient); + public client: KlasaClient; + public resolver: SettingResolver; + public guilds: SettingGateway<'guilds'>; + + public add(name: T, validateFunction: Function, schema: object): Promise>; + public validate(resolver: SettingResolver, guild: object|string); + + public readonly defaultDataSchema: { prefix: SchemaPiece, language: SchemaPiece, disabledCommands: SchemaPiece }; + } + + export class SQL { + public constructor(client: KlasaClient, gateway: SettingGateway); + public readonly client: KlasaClient; + public readonly gateway: SettingGateway; + + public buildSingleSQLSchema(value: SchemaPiece): string; + public buildSQLSchema(schema: object): string[]; + + public initDeserialize(): void; + public deserializer(data: SchemaPiece): void; + public updateColumns(schema: object, defaults: object, key: string): Promise; + + public readonly constants: object; + public readonly sanitizer: Function; + public readonly schema: object; + public readonly defaults: object; + public readonly provider: Provider; + } + + // Util + export class Colors { + public constructor(); + public CLOSE: ColorsClose; + public STYLES: ColorsStyles; + public TEXTS: ColorsTexts; + public BACKGROUNDS: ColorsBackgrounds; + + public static hexToRGB(hex: string): number[]; + public static hslToRGB(hsl: number[]): number[]; + public static hueToRGB(p: number, q: number, t: number): number; + public static formatArray(array: string[]): string|number[]; + + public format(input: string, type: { style: string|string[], background: string|number|string[], text: string|number|string[] }): string; + } + + class KlasaConsole extends Console { + public constructor(options: KlasaConsoleConfig); + public readonly stdout: NodeJS.WritableStream; + public readonly stderr: NodeJS.WritableStream; + public timestaamps: boolean|string; + public useColors: boolean; + public colors: boolean|KlasaConsoleColors; + + public write(data: any, type: string): void; + public log(...data: any[]): void; + public warn(...data: any[]): void; + public error(...data: any[]): void; + public debug(...data: any[]): void; + public verbose(...data: any[]): void; + public wtf(...data: any[]): void; + + public timestamp(timestamp: Date, time: string): string; + public messages(input: string, message: string): string; + + public static flatten(data: any, useColors: boolean): string; + } + + export { KlasaConsole as Console }; + + // Structures + export class CommandMessage { + public constructor(msg: Message, cmd: Command, prefix: string, prefixLength: number); + public readonly client: KlasaClient; + public msg: Message; + public cmd: Command; + public prefix: string; + public prefixLength: number; + public args: string[]; + public params: any[]; + public reprompted: false; + private _currentUsage: object; + private _repeat: boolean; + + private validateArgs(): Promise; + private multiPossibles(possible: number, validated: boolean): Promise; + + public static getArgs(cmdMsg: CommandMessage): string[]; + public static getQuotedStringArgs(cmdMsg: CommandMessage): string[]; + } + + export class Piece { + public reload(): Promise; + public unload(): void; + public enable(): Piece; + public disable(): Piece; + + public static applyToClass(structure: object, skips: string[]): void; + } + + export abstract class Command implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: CommandOptions); + public client: KlasaClient; + public type: 'command'; + + public enabled: boolean; + public name: string; + public aliases: string[]; + public runIn: string[]; + public botPerms: string[]; + public requiredSettings: string[]; + public cooldown: number; + public permLevel: number; + public description: string; + public usageDelim: string; + public extendedHelp: string; + public quotedStringSupport: boolean; + + public fullCategory: string[]; + public category: string; + public subCategory: string; + public usage: ParsedUsage; + private cooldowns: Map; + + public abstract run(msg: ProxyCommand, params: any[]): Promise; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Event implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: EventOptions); + public client: KlasaClient; + public type: 'event'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + private _run(param: any): void; + + public abstract run(...params: any[]): void; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Extendable implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: ExtendableOptions); + public client: KlasaClient; + public type: 'extendable'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + public appliesTo: string[]; + public target: boolean; + + public abstract extend(...params: any[]): any; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Finalizer implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: FinalizerOptions); + public client: KlasaClient; + public type: 'finalizer'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + public abstract run(msg: CommandMessage, mes: Message, start: number): void; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Inhibitor implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: InhibitorOptions); + public client: KlasaClient; + public type: 'inhibitor'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + public abstract run(msg: Message, cmd: Command): Promise; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Language implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: LanguageOptions); + public client: KlasaClient; + public type: 'language'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + public get(term: string, ...args: any[]): string|Function; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Monitor implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: MonitorOptions); + public client: KlasaClient; + public type: 'monitor'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + public ignoreBots: boolean; + public ignoreSelf: boolean; + + public abstract run(msg: Message): void; + public abstract init(): any; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export abstract class Provider implements Piece { + public constructor(client: KlasaClient, dir: string, file: string[], options: ProviderOptions); + public client: KlasaClient; + public type: 'monitor'; + + public enabled: boolean; + public name: string; + public dir: string; + public file: string; + + public description: string; + public sql: boolean; + + public abstract run(msg: Message): void; + public abstract init(): any; + public abstract shutdown(): Promise; + + public abstract enable(): Piece; + public abstract disable(): Piece; + public abstract reload(): Promise; + public abstract unload(): any; + } + + export class Store { + public init(): Promise; + public load(dir: string, file: string|string[]): Piece; + public loadAll(): Promise; + public resolve(name: Piece|string): Piece; + + public static applyToClass(structure: object, skips: string[]): void; + } + + export class CommandStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public aliases: Collection; + public coreDir: string; + public userDir: string; + public holds: Command; + public name: 'commands'; + + public get(name: string): Command; + public has(name: string): boolean; + public set(key: string, value: Command): this; + public set(command: Command): Command; + public delete(name: Command|string): boolean; + public clear(): void; + public load(dir: string, file: string[]): Command; + public loadAll(): Promise; + + public init(): any; + public resolve(): any; + + public static walk(store: CommandStore, dir: string, subs: string[]): Promise; + } + + export class EventStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Event; + public name: 'events'; + + public clear(): void; + public delete(name: Event|string): boolean; + public set(key: string, value: Event): this; + public set(event: Event): Event; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + export class ExtendableStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Extendable; + public name: 'extendables'; + + public delete(name: Extendable|string): boolean; + public clear(): void; + public set(key: string, value: Extendable): this; + public set(extendable: Extendable): Extendable; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + export class FinalizerStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Finalizer; + public name: 'finalizers'; + + public delete(name: Finalizer|string): boolean; + public run(msg: CommandMessage, mes: Message, start: number): void; + public set(key: string, value: Finalizer): this; + public set(finalizer: Finalizer): Finalizer; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + export class InhibitorStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Inhibitor; + public name: 'inhibitors'; + + public delete(name: Inhibitor|string): boolean; + public run(msg: Message, cmd: Command, selective: boolean): void; + public set(key: string, value: Inhibitor): this; + public set(inhibitor: Inhibitor): Inhibitor; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + export class LanguageStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Language; + public name: 'languages'; + + public readonly default: Language; + public delete(name: Language|string): boolean; + public set(key: string, value: Language): this; + public set(language: Language): Language; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + export class MonitorStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Monitor; + public name: 'monitors'; + + public delete(name: Monitor|string): boolean; + public run(msg: Message): void; + public set(key: string, value: Monitor): this; + public set(monitor: Monitor): Monitor; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + export class ProviderStore extends Collection implements Store { + public constructor(client: KlasaClient); + public client: KlasaClient; + public coreDir: string; + public userDir: string; + public holds: Provider; + public name: 'providers'; + + public delete(name: Provider|string): boolean; + public set(key: string, value: Provider): this; + public set(provider: Provider): Provider; + + public init(): any; + public load(): any; + public loadAll(): Promise; + public resolve(): any; + } + + type KlasaClientConfig = { + prefix: string; + permissionLevels: PermissionLevels; + clientBaseDir: string; + commandMessageLifetime: number; + commandMessageSweep: number; + provider: object; + console: KlasaConsoleConfig; + consoleEvents: KlasaConsoleEvents; + ignoreBots: boolean; + ignoreSelf: boolean; + prefixMention: RegExp; + cmdPrompt: boolean; + cmdEditing: boolean; + cmdLogging: boolean; + typing: boolean; + quotedStringSupport: boolean; + readyMessage: string|Function; + string: string; + } & ClientOptions; + + type KlasaConsoleConfig = { + stdout: NodeJS.WritableStream; + stderr: NodeJS.WritableStream; + useColor: boolean; + colors: Colors; + timestamps: boolean|string; + }; + + type KlasaConsoleEvents = { + log: boolean; + warn: boolean; + error: boolean; + debug: boolean; + verbose: boolean; + wtf: boolean; + }; + + type PermissionLevel = { + break: boolean; + check: Function; + }; + + type permissionLevelResponse = { + broke: boolean; + permission: boolean; + }; + + type ProxyCommand = CommandMessage & Message; + + type CommandOptions = { + enabled: boolean; + name: string; + aliases: string[]; + runIn: string[]; + botPerms: string[]; + requiredSettings: string[]; + cooldown: number; + permLevel: number; + description: string; + usage: string; + usageDelim: string; + extendedHelp: string; + quotedStringSupport: boolean; + }; + + type EventOptions = { + enabled: boolean; + name: string; + }; + + type ExtendableOptions = { + enabled: boolean; + name: string; + klasa: boolean; + }; + + type FinalizerOptions = { + enabled: boolean; + name: string; + }; + + type InhibitorOptions = { + enabled: boolean; + name: string; + spamProtection: boolean; + }; + + type LanguageOptions = { + enabled: boolean; + name: string; + }; + + type MonitorOptions = { + enabled: boolean; + name: string; + ignoreBots: boolean; + ignoreSelf: boolean; + }; + + type ProviderOptions = { + enabled: boolean; + name: string; + description: string; + sql: boolean; + }; + + type AddOptions = { + type: string; + default: any; + min: number; + max: number; + array: boolean; + sql: string; + }; + + type SchemaPiece = { + type: string; + default: any; + min: number; + max: number; + array: boolean; + sql: string; + }; + + type SettingGatewayGuildResolvable = Guild|Channel|Message|Role|Snowflake; + + type ColorsClose = { + normal: 0; + bold: 22; + dim: 22; + italic: 23; + underline: 24; + inverse: 27; + hidden: 28; + strikethrough: 29; + text: 39; + background: 49; + }; + + type ColorsStyles = { + normal: 0; + bold: 1; + dim: 2; + italic: 3; + underline: 4; + inverse: 7; + hidden: 8; + strikethrough: 9; + }; + + type ColorsTexts = { + black: 30; + red: 31; + green: 32; + yellow: 33; + blue: 34; + magenta: 35; + cyan: 36; + lightgray: 37; + lightgrey: 37; + gray: 90; + grey: 90; + lightred: 91; + lightgreen: 92; + lightyellow: 93; + lightblue: 94; + lightmagenta: 95; + lightcyan: 96; + white: 97; + }; + + type ColorsBackgrounds = { + black: 40; + red: 41; + green: 42; + yellow: 43; + blue: 44; + magenta: 45; + cyan: 46; + gray: 47; + grey: 47; + lightgray: 100; + lightgrey: 100; + lightred: 101; + lightgreen: 102; + lightyellow: 103; + lightblue: 104; + lightmagenta: 105; + lightcyan: 106; + white: 107; + }; + + type KlasaConsoleColors = { + debug: KlasaConsoleColorObjects; + error: KlasaConsoleColorObjects; + log: KlasaConsoleColorObjects; + verbose: KlasaConsoleColorObjects; + warn: KlasaConsoleColorObjects; + wtf: KlasaConsoleColorObjects; + }; + + type KlasaConsoleColorObjects = { + log: string; + message: KlasaConsoleMessageObject; + time: KlasaConsoleTimeObject; + }; + + type KlasaConsoleMessageObject = { + background: BackgroundColorTypes; + text: TextColorTypes; + style: StyleTypes; + }; + + type KlasaConsoleTimeObject = { + background: BackgroundColorTypes; + text: TextColorTypes; + style: StyleTypes; + }; + + type TextColorTypes = 'black'|'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'gray'|'grey'|'lightgray'|'lightgrey'|'lightred'|'lightgreen'|'lightyellow'|'lightblue'|'lightmagenta'|'lightcyan'|'white'|number[]|string[]; + + type BackgroundColorTypes = 'black'|'red'|'green'|'blue'|'magenta'|'cyan'|'gray'|'grey'|'lightgray'|'lightgrey'|'lightred'|'lightgreen'|'lightyellow'|'lightblue'|'lightmagenta'|'lightcyan'|'white'|number[]|string[]; + + type StyleTypes = 'normal'|'bold'|'dim'|'italic'|'underline'|'inverse'|'hidden'|'strikethrough'; + + type StringMappedType = { [key: string]: T }; + + type GuildSettings = StringMappedType; + type SchemaObject = StringMappedType; + type SchemaDefaults = StringMappedType; + + // Extended classes + type Message = { + guild: Guild; + guildSettings: GuildSettings; + hasAtLeastPermissionLevel: Promise; + language: Language; + reactable: Boolean; + send: Promise; + sendCode: Promise; + sendEmbed: Promise; + sendMessage: Promise; + sendFile: Promise; + sendFiles: Promise; + usableCommands: Promise>; + } & DiscordMessage; + + type Guild = { + language: Language; + settings: GuildSettings; + } & DiscordGuild; + + type User = { + sendCode: Promise; + sendEmbed: Promise; + sendMessage: Promise; + sendFile: Promise; + sendFiles: Promise; + } & DiscordUser; + + type TextChannel = { + attachable: boolean; + embedable: boolean; + postable: boolean; + language: Language; + sendCode: Promise; + sendEmbed: Promise; + sendMessage: Promise; + sendFile: Promise; + sendFiles: Promise; + } & DiscordTextChannel; + + type DMChannel = { + attachable: boolean; + embedable: boolean; + postable: boolean; + language: Language; + sendCode: Promise; + sendEmbed: Promise; + sendMessage: Promise; + sendFile: Promise; + sendFiles: Promise; + } & DiscordDMChannel; + + type GroupDMChannel = { + attachable: boolean; + embedable: boolean; + postable: boolean; + language: Language; + sendCode: Promise; + sendEmbed: Promise; + sendMessage: Promise; + sendFile: Promise; + sendFiles: Promise; + } & DiscordGroupDMChannel; + +}