@guardbot/framework 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -26
- package/build/{index.mjs → index.cjs} +451 -334
- package/build/index.cjs.map +1 -0
- package/build/{index.d.mts → index.d.cts} +149 -97
- package/build/index.d.ts +149 -97
- package/build/index.js +420 -371
- package/build/index.js.map +1 -0
- package/package.json +29 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/core/FrameworkClient.ts","../src/utils/files.ts","../src/utils/helpers.ts","../src/utils/perms.ts","../src/core/FrameworkError.ts","../src/modules/AutocompletersModule.ts","../src/modules/ListenersModule.ts","../src/modules/CommandsModule.ts","../src/builders/autocompleters/Autocompleter.ts","../src/types/commands.ts","../src/builders/commands/ContextCommand.ts","../src/builders/commands/BaseCommand.ts","../src/builders/commands/MessageCommand.ts","../src/builders/commands/SlashCommand.ts","../src/builders/listeners/Listener.ts","../src/extensions/index.ts","../src/extensions/Message.ts"],"sourcesContent":["export { FrameworkClient } from './core/FrameworkClient';\nexport { Autocompleter } from './builders/autocompleters/Autocompleter';\nexport { ContextCommand } from './builders/commands/ContextCommand';\nexport { MessageCommand } from './builders/commands/MessageCommand';\nexport { SlashCommand } from './builders/commands/SlashCommand';\nexport { Listener } from './builders/listeners/Listener';\nimport './extensions';\n\n\nexport type {\n FrameworkAutocompleter,\n FrameworkCommand,\n FrameworkSlashCommand,\n FrameworkMessageCommand,\n FrameworkContextCommand,\n FrameworkListener,\n} from './types';\n\n\nexport {\n SlashCommandAttachmentOption as AttachmentOption,\n SlashCommandBooleanOption as BooleanOption,\n SlashCommandChannelOption as ChannelOption,\n SlashCommandIntegerOption as IntegerOption,\n SlashCommandMentionableOption as MentionableOption,\n SlashCommandNumberOption as NumberOption,\n SlashCommandRoleOption as RoleOption,\n SlashCommandStringOption as StringOption,\n SlashCommandUserOption as UserOption,\n SlashCommandSubcommandBuilder as SubcommandBuilder,\n SlashCommandSubcommandGroupBuilder as SubcommandGroupBuilder,\n} from 'discord.js';","import { FrameworkAutocompleter, FrameworkClientOptions, FrameworkCommand, FrameworkListener } from '../types';\nimport { ClientEvents, Collection, Client as DiscordClient } from 'discord.js';\nimport AutocompletersModule from '../modules/AutocompletersModule';\nimport ListenersModule from '../modules/ListenersModule';\nimport CommandsModule from '../modules/CommandsModule';\nimport { dirExists, resolvePath } from '../utils';\n\n\nexport class FrameworkClient<Ready extends boolean = boolean> extends DiscordClient<Ready> {\n public prefix: string;\n public developers: string[];\n public rootDir: string;\n public commandsDir: string;\n public listenersDir: string;\n public autocompletersDir: string;\n private _inited = false;\n\n public autocompleters: Collection<string, FrameworkAutocompleter> = new Collection();\n public events: Collection<string, FrameworkListener<keyof ClientEvents>> = new Collection();\n public aliases: Collection<string, string> = new Collection();\n public commands: Collection<string, FrameworkCommand> = new Collection();\n public cooldowns: Collection<string, Collection<string, number>> = new Collection();\n\n public commandsModule: CommandsModule;\n public listenersModule: ListenersModule;\n public autocompletersModule: AutocompletersModule;\n\n constructor(frameworkOptions: FrameworkClientOptions) {\n super(frameworkOptions.clientOptions);\n\n this.prefix = frameworkOptions.prefix ?? '!';\n this.developers = [...(frameworkOptions.developers || [])];\n\n this.rootDir = frameworkOptions.rootDir ?? (dirExists('./src') ? './src' : './');\n this.commandsDir = resolvePath(this.rootDir, frameworkOptions.commandsDir ?? 'commands');\n this.listenersDir = resolvePath(this.rootDir, frameworkOptions.listenersDir ?? 'listeners');\n this.autocompletersDir = resolvePath(this.rootDir, frameworkOptions.autocompletersDir ?? 'autocompleters');\n\n this.commandsModule = new CommandsModule(this);\n this.listenersModule = new ListenersModule(this);\n this.autocompletersModule = new AutocompletersModule(this);\n\n this.routeInteractions();\n this.once('clientReady', async () => {\n if (frameworkOptions.registerOnStart && frameworkOptions.guildsToRegister?.length) {\n await this.commandsModule.registerOnStart(frameworkOptions.guildsToRegister);\n }\n });\n }\n \n public async init() {\n this._inited = true;\n await this.listenersModule.loadAll();\n await this.autocompletersModule.loadAll();\n await this.commandsModule.loadAll();\n }\n\n public async start(token: string) {\n if (!this._inited) await this.init();\n await this.login(token);\n }\n\n private routeInteractions() {\n this.on('interactionCreate', (interaction) => {\n if (interaction.isAnySelectMenu()) return this.emit('selectMenuInteraction', interaction);\n else if (interaction.isModalSubmit()) return this.emit('modalSubmitInteraction', interaction);\n else if (interaction.isButton()) return this.emit('buttonInteraction', interaction);\n });\n }\n}","import path from 'node:path';\nimport url from 'node:url';\nimport fs from 'node:fs';\n\n\nexport async function listFiles(dir: string): Promise<string[]> {\n if (!fs.existsSync(dir)) return [];\n \n const files: string[] = [];\n const items = fs.readdirSync(dir, { withFileTypes: true });\n \n for (const item of items) {\n const fullPath = path.join(dir, item.name);\n if (item.isDirectory()) files.push(...(await listFiles(fullPath)));\n else if (item.name.endsWith('.js') || item.name.endsWith('.ts')) files.push(fullPath);\n }\n return files;\n}\n\nexport function assertDir(dir: string, name: string) {\n if (!fs.existsSync(dir)) {\n throw new Error(`Invalid ${name}: ${dir} does not exist`);\n }\n}\n\nexport function dirExists(dir: string) {\n return fs.existsSync(dir);\n}\n\nexport function resolvePath(...paths: string[]) {\n return path.resolve(...paths);\n}\n\nexport function pathToFileURL(filepath: string) {\n return url.pathToFileURL(filepath);\n}","import { APIApplicationCommandOption, ApplicationIntegrationType, InteractionContextType, SlashCommandBuilder } from 'discord.js';\nimport { CommandType, CommandContext, IntegrationType, TimestampTypes, SlashOptionsInput } from '../types';\n\n\nexport function unixTimestamp(date: Date|number, type: TimestampTypes = 'f'): string {\n return `<t:${Math.floor(new Date(date).valueOf() / 1000)}:${type}>`\n}\n\nexport function createPrefixRegex(userId: string, prefix?: string) {\n return new RegExp(`^(<@!?${userId}>${prefix ? `|${prefix.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}` : ''})\\\\s*`);\n}\n\nexport function normalizeCommandName(name: string, type: CommandType): string {\n if (type === 'ContextUser' || type === 'ContextMessage') return name;\n return name.trim().toLowerCase().replace(/\\s+/g, '-');\n}\n\nexport function resolveCommandContexts(contexts?: CommandContext[]) {\n return (contexts?.length \n ? contexts.map(c => (typeof c === 'string' ? InteractionContextType[c] : c))\n : [InteractionContextType.Guild]\n );\n}\n\nexport function resolveIntegrationTypes(types?: IntegrationType[]) {\n return (types?.length\n ? types.map(t => (typeof t === 'string' ? ApplicationIntegrationType[t] : t))\n : [ApplicationIntegrationType.GuildInstall]\n );\n}\n\nexport function normalizeOptions(options: SlashOptionsInput | undefined): APIApplicationCommandOption[] {\n if (!options || !options?.length) return [];\n\n if (typeof options === 'function') {\n const built = options(new SlashCommandBuilder());\n return built.options?.map(o => o.toJSON()) ?? [];\n }\n\n if (Array.isArray(options)) {\n return options.map(o => ('toJSON' in o ? o.toJSON() : o));\n }\n\n return [];\n}","import { GuildMember, GuildTextBasedChannel, PermissionResolvable, PermissionsBitField } from 'discord.js';\n\n\nexport function isPermissionResolvable(option: any): option is PermissionResolvable {\n try {\n PermissionsBitField.resolve(option);\n return true;\n } catch { return false; };\n}\n\nexport function resolvePermissions(member: GuildMember, channel?: GuildTextBasedChannel | null): PermissionsBitField {\n return (channel && member.permissionsIn(channel)) ?? member.permissions;\n}\n\nexport function formatPermissions(perms: string[]): string {\n return perms.map(\n p =>`\\`${p.replace(/([A-Z])/g, (m, l, i) => (i === 0 ? l : ` ${l}`))}\\``\n ).join(', ');\n}","import { inspect } from 'util';\n\ntype FrameworkErrorName = (\n 'NoOptions' | 'InvalidOption' | 'InvalidType' | 'InvalidValue' | 'InvalidValues' |\n 'UnknownComponent' | 'ComponentLoadError' | 'ComponentAlreadyLoaded' |\n 'AppCommandRegister'\n);\n\nconst messages: Record<FrameworkErrorName, (...values: any[]) => string> = {\n NoOptions: () => `No options object was provided.`,\n InvalidOption: (name: string) => `No \"${name}\" option was provided.`,\n InvalidType: (name: string, expected: string, actual: string) => `Expected \"${name}\" to be of type \"${expected}\", but got \"${actual}\".`,\n InvalidValue: (name: string, expected: string[]) => `Expected \"${name}\" to be any one of the listed values: ${expected.map(v => `\"${v}\"`).join(' | ')}`,\n InvalidValues: (name: string, expected: string[]) => `Expected \"${name}\" to contain only the listed values: ${expected.map(v => `\"${v}\"`).join(' | ')}`,\n UnknownComponent: (type: string, id: string) => `Encountered an error as there is no \"${type}\" loaded with the id \"${id}\".`,\n ComponentLoadError: (type: string, error: Error) => `Encountered an error while loading the \"${type}\": \\n${inspect(error)}`,\n ComponentAlreadyLoaded: (type: string, id: string) => `Encountered an error as a \"${type}\" with the id \"${id}\" is already loaded.`,\n AppCommandRegister: (error: Error, guildId?: string) => `Encountered an error while registering commands ${guildId ? `to guild \"${guildId}\"` : ''}: \\n${inspect(error)}`,\n};\n\nexport class FrameworkError extends Error {\n constructor(id: FrameworkErrorName, ...values: any[]) {\n super(messages[id](...values));\n this.name = `FrameworkError [${id}]`;\n }\n}\n\nexport class FrameworkTypeError extends TypeError {\n constructor(id: FrameworkErrorName, ...values: any[]) {\n super(messages[id](...values));\n this.name = `FrameworkTypeError [${id}]`;\n }\n}","import { listFiles, pathToFileURL, resolvePath } from '../utils';\nimport { FrameworkError } from '../core/FrameworkError';\nimport { FrameworkClient } from '../core/FrameworkClient';\nimport { FrameworkAutocompleter } from '../types';\nimport { Interaction } from 'discord.js';\nimport EventEmitter from 'events';\n\n\n/**\n * @class AutocompletersModule\n * @fires AutocompletersModule#execute\n * @fires AutocompletersModule#success\n * @fires AutocompletersModule#error\n * @fires AutocompletersModule#unknown\n */\nexport default class AutocompletersModule extends EventEmitter {\n private client: FrameworkClient<true>;\n constructor(client: FrameworkClient) {\n super();\n this.client = client as FrameworkClient<true>;\n this.client.on('interactionCreate', (interaction) => this._handleInteraction(interaction));\n }\n\n async load(filepath: string, reload: boolean = false) {\n const module = await import(pathToFileURL(filepath).href + `?update=${Date.now()}`);\n const completer: FrameworkAutocompleter = module.autocomplete ?? module.default?.default ?? module.default ?? module;\n\n if (typeof completer !== 'object' || !completer.name || completer.disabled) return false;\n if (!reload && this.client.autocompleters.has(completer.id)) throw new FrameworkError('ComponentAlreadyLoaded', 'autocomplete', completer.id);\n\n completer.filepath = filepath;\n this.client.autocompleters.set(completer.id, completer);\n return true;\n }\n\n async loadAll() {\n const files = await listFiles(this.client.autocompletersDir);\n\n for (const file of files) {\n try {\n await this.load(resolvePath(file));\n } catch (error) {\n this.client.emit('error', new FrameworkError('ComponentLoadError', 'autocomplete', error));\n }\n }\n }\n\n async reload(id: string) {\n const completer = this.client.autocompleters.get(id);\n if (!completer) throw new FrameworkError('UnknownComponent', 'autocomplete', id);\n\n this.unload(id, true);\n await this.load(completer.filepath, true);\n }\n\n private unload(id: string, reload: boolean = false) {\n if (!this.client.autocompleters.has(id)) throw new FrameworkError('UnknownComponent', 'autocomplete', id);\n const completer = this.client.autocompleters.get(id)!;\n\n delete require.cache[require.resolve(completer.filepath)];\n if (!reload) this.client.autocompleters.delete(id);\n }\n\n\n private async _handleInteraction(interaction: Interaction) {\n if (!interaction.isAutocomplete()) return;\n\n const option = interaction.options.getFocused(true);\n const command = this.client.commands.get(`Slash:${interaction.commandName}`);\n const completer = this.client.autocompleters.get(option.name);\n\n if (!command || command.commandType !== 'Slash') {\n this.emit('unknown', interaction);\n return;\n }\n\n if (!interaction.inCachedGuild()) return;\n const allowed = !completer?.commands?.length || completer.commands.includes(command.name);\n\n if (completer && !completer.disabled && allowed) {\n try {\n this.emit('execute', { interaction, command, completer });\n await completer.execute(this.client, interaction, command, option.value);\n this.emit('success', { interaction, command, completer });\n } catch (error) {\n this.emit('error', { interaction, command, completer, error });\n }\n }\n else if (typeof command.autocomplete === 'function' && !command.disabled) {\n try {\n this.emit('execute', { interaction, command, completer });\n await command.autocomplete(this.client, interaction);\n this.emit('success', { interaction, command, completer });\n } catch (error) {\n this.emit('error', { interaction, command, completer, error });\n }\n }\n else {\n this.emit('unknown', interaction);\n }\n }\n}\n\n\n/**\n * Emitted when a completer is executed\n * @event AutocompletersModule#execute\n * @param {FrameworkSlashCommand} context.command The command\n * @param {FrameworkAutocompleter} context.completer The autocompleter\n * @param {AutocompleteInteraction} context.interaction The autocomplete interaction\n */\n\n/**\n * Emitted when a completer finishes execution successfully\n * @event AutocompletersModule#success\n * @param {FrameworkSlashCommand} context.command The command\n * @param {FrameworkAutocompleter} context.completer The autocompleter\n * @param {AutocompleteInteraction} context.interaction The autocomplete interaction\n */\n\n/**\n * Emitted when a completer throws an error\n * @event AutocompletersModule#error\n * @param {FrameworkSlashCommand} context.command The command\n * @param {FrameworkAutocompleter} context.completer The autocompleter\n * @param {AutocompleteInteraction} context.interaction The autocomplete interaction\n * @param {Error} context.error The error\n */\n\n/**\n * Emitted when an interaction arrives with a completer that is not loaded\n * @event AutocompletersModule#unknown\n * @param {AutocompleteInteraction} interaction The interaction\n */","import { listFiles, pathToFileURL, resolvePath } from '../utils';\nimport { FrameworkClient } from '../core/FrameworkClient';\nimport { FrameworkError } from '../core/FrameworkError';\nimport { FrameworkListener } from '../types';\n\n\nexport default class ListenerModule {\n private client: FrameworkClient<true>;\n constructor(client: FrameworkClient) {\n this.client = client as FrameworkClient<true>;\n }\n\n async load(filepath: string, reload: boolean = false) {\n const module = await import(pathToFileURL(filepath).href + `?update=${Date.now()}`);\n const listener: FrameworkListener = module?.listener ?? module?.default?.default ?? module?.default ?? module;\n\n if (typeof listener !== 'object' || !listener.name || listener.disabled) return false;\n if (!reload && this.client.events.has(listener.id)) throw new FrameworkError('ComponentAlreadyLoaded', 'listener', listener.id);\n\n listener.filepath = filepath;\n listener._execute = (...args) => listener.execute(...args);\n \n this.client[listener.once ? 'once' : 'on'](listener.name, listener._execute);\n this.client.events.set(listener.id, listener);\n return true;\n }\n\n async loadAll() {\n const files = await listFiles(this.client.listenersDir);\n\n for (const file of files) {\n try {\n await this.load(resolvePath(file));\n } catch (error) {\n this.client.emit('error', new FrameworkError('ComponentLoadError', 'listener', error));\n }\n }\n }\n\n async reload(id: string) {\n if (!this.client.events.has(id)) throw new FrameworkError('UnknownComponent', 'listener', id);\n const listener = this.client.events.get(id)!;\n\n this.unload(id, true);\n await this.load(listener.filepath, true);\n }\n\n private unload(id: string, reload: boolean = false) {\n if (!this.client.events.has(id)) throw new FrameworkError('UnknownComponent', 'listener', id);\n const listener = this.client.events.get(id)!;\n\n if (listener._execute) this.client.off(listener.name, listener._execute);\n delete require.cache[require.resolve(listener.filepath)];\n if (!reload) this.client.events.delete(id);\n }\n}","import { listFiles, resolveCommandContexts, resolveIntegrationTypes, unixTimestamp, createPrefixRegex, pathToFileURL, resolvePath, resolvePermissions, formatPermissions } from '../utils';\nimport { FrameworkCommand, FrameworkSlashCommand, FrameworkContextCommand, CommandCustomHandlers, CommandMiddleware } from '../types';\nimport { ApplicationCommandType, Collection, Interaction, Message, MessageFlags } from 'discord.js';\nimport { FrameworkClient } from '../core/FrameworkClient';\nimport { FrameworkError } from '../core/FrameworkError';\nimport EventEmitter from 'events';\n\n\n/**\n * @class CommandsModule\n * @fires CommandsModule#execute\n * @fires CommandsModule#success\n * @fires CommandsModule#error\n * @fires CommandsModule#unknown\n */\nexport default class CommandsModule extends EventEmitter {\n private client: FrameworkClient<true>;\n private handlers: CommandCustomHandlers = {};\n private middleware?: CommandMiddleware;\n private prefixRegex?: RegExp;\n\n constructor(client: FrameworkClient) {\n super();\n this.client = client as FrameworkClient<true>;\n this.client.on('messageCreate', (message) => this._handleMessage(message));\n this.client.on('interactionCreate', (interaction) => this._handleInteraction(interaction));\n }\n\n setHandler<K extends keyof CommandCustomHandlers>(key: K, callback: NonNullable<CommandCustomHandlers[K]>) {\n this.handlers[key] = callback;\n return true;\n }\n\n setMiddleware(callback: CommandMiddleware) {\n this.middleware = callback;\n return true;\n }\n\n\n async load(filepath: string, reload: boolean = false) {\n const module = await import(pathToFileURL(filepath).href + `?update=${Date.now()}`);\n const command: FrameworkCommand = module?.command ?? module?.default?.default ?? module?.default ?? module;\n\n if (typeof command !== 'object' || !command.name || command.disabled) return false;\n if (!reload && this.client.commands.has(command.id)) throw new FrameworkError('ComponentAlreadyLoaded', 'command', command.id);\n\n command.filepath = filepath;\n this.client.commands.set(command.id, command);\n\n if (command.commandType === 'Message' && Array.isArray(command.aliases)) command.aliases.forEach((alias: any) => {\n if (typeof alias === 'string' && !this.client.aliases.get(alias)) this.client.aliases.set(alias, command.id);\n });\n return true;\n }\n\n async loadAll() {\n const files = await listFiles(this.client.commandsDir);\n\n for (const file of files) {\n try {\n await this.load(resolvePath(file));\n } catch (error) {\n this.client.emit('error', new FrameworkError('ComponentLoadError', 'commands', error));\n }\n }\n }\n \n async reload(id: string) {\n if (!this.client.commands.has(id)) throw new FrameworkError('UnknownComponent', 'commands', id);\n const command = this.client.commands.get(id)!;\n\n this.unload(id, true);\n await this.load(command.filepath, true);\n }\n\n private unload(id: string, reload: boolean = false) {\n if (!this.client.commands.has(id)) throw new FrameworkError('UnknownComponent', 'commands', id);\n const command = this.client.commands.get(id)!;\n \n delete require.cache[require.resolve(command.filepath)];\n if (!reload) this.client.commands.delete(id);\n }\n\n\n async registerOnStart(guildIds: string[], commands?: Collection<string, FrameworkCommand>) {\n for (const guildId of guildIds) {\n try {\n await this.publishGuild(guildId, commands);\n } catch (error) {\n this.client.emit('error', new FrameworkError('AppCommandRegister', error, guildId));\n }\n }\n }\n\n async publishGlobal(commands?: Collection<string, FrameworkCommand>) {\n if (!this.client.application) return false;\n const commandsToSet = (commands ?? this.client.commands).filter(c => c.commandType !== 'Message' && c.commandScope !== 'guild' && !c.disabled).map((c: any) => this._getCommandData(c));\n return this.client.application.commands.set(commandsToSet);\n }\n\n async publishGuild(guildId: string, commands?: Collection<string, FrameworkCommand>) {\n const commandsToSet = (commands ?? this.client.commands).filter(c => c.commandType !== 'Message' && c.commandScope !== 'global' && !c.disabled).map((c: any) => this._getCommandData(c));\n const guild = await this.client.guilds.fetch({ guild: guildId, force: false });\n if (guild) guild.commands.set(commandsToSet);\n }\n\n\n private async _handleMessage(message: Message) {\n if (!message.content?.length || message.author.bot) return;\n if (!this.prefixRegex) this.prefixRegex = createPrefixRegex(message.client.user.id, this.client.prefix);\n\n if (!this.prefixRegex.test(message.content.toLowerCase())) return;\n const matchedPrefix = message.content.toLowerCase().match(this.prefixRegex)?.[1];\n if (!matchedPrefix) return;\n\n const args = (message.content || '').slice(matchedPrefix.length).trim().split(/ +/);\n const commandName = args.shift()?.toLowerCase();\n if (!commandName) return;\n\n const commandId = `Message:${commandName}`;\n const command = this.client.commands.get(commandId) || this.client.commands.get(this.client.aliases.get(commandName) || '');\n if (!command || command.commandType !== 'Message' || command.disabled || (command.devOnly && !this.client.developers.includes(message.author.id))) return;\n if ((!message.inGuild() && !command.contexts.includes('BotDM')) || (message.inGuild() && !command.contexts.includes('Guild'))) return;\n\n if (this.middleware) {\n const shouldContinue = await this.middleware(message, command);\n if (!shouldContinue) return;\n }\n\n\n if (message.inGuild()) {\n const [executer, clientMember] = await Promise.all([\n command.memberPermissions ? message.guild.members.fetch({ user: message.author.id, force: false }) : null,\n command.clientPermissions ? message.guild.members.fetchMe({ force: false }) : null,\n ]);\n if ((command.memberPermissions && !executer) || (command.clientPermissions && !clientMember)) return;\n\n if (command.memberPermissions) {\n const memberPerms = resolvePermissions(executer!, message.channel);\n if (!memberPerms.has(command.memberPermissions)) {\n const missing = memberPerms.missing(command.memberPermissions);\n\n if (typeof this.handlers.onMemberPermissions === 'function') return this.handlers.onMemberPermissions(message, command, missing);\n return message.reply({ content: 'You don\\'t have the required permission(s) to use this command.' }).then(m => {\n setTimeout(() => m.delete().catch(e => null), 10000);\n }).catch(() => null);\n }\n }\n\n if (command.clientPermissions) {\n const clientPerms = resolvePermissions(clientMember!, message.channel);\n if (!clientPerms.has(command.clientPermissions)) { \n const missing = clientPerms.missing(command.clientPermissions);\n\n if (typeof this.handlers.onClientPermissions === 'function') return this.handlers.onClientPermissions(message, command, missing);\n return message.reply({ content: `${clientMember!.displayName} requires ${formatPermissions(missing)} permission(s) to run this command.` }).then(m => {\n setTimeout(() => m.delete().catch(e => null), 10000);\n }).catch(() => null);\n }\n }\n }\n\n if (command.cooldown && command.cooldown > 1000) {\n if (!this.client.cooldowns.has(commandId)) this.client.cooldowns.set(commandId, new Collection());\n const commandCooldowns = this.client.cooldowns.get(commandId);\n \n if (commandCooldowns) {\n if (commandCooldowns.has(message.author.id)) {\n const expiresAt = new Date((commandCooldowns.get(message.author.id) || 0) + command.cooldown).valueOf();\n const now = Date.now();\n\n if (expiresAt - now > 1000) {\n if (typeof this.handlers.onCooldown === 'function') return this.handlers.onCooldown(message, command, new Date(expiresAt));\n return message.reply({ content: `Slow down and try the Command Again **${unixTimestamp(new Date(expiresAt), 'R')}**.` }).then(m => {\n setTimeout(() => m.delete().catch(e => null), expiresAt - Date.now());\n });\n }\n }\n commandCooldowns.set(message.author.id, new Date().valueOf());\n setTimeout(() => commandCooldowns.delete(message.author.id), command.cooldown);\n }\n }\n\n\n try {\n this.emit('execute', { context: message, command });\n if (message.inGuild() && command.contexts.includes('Guild')) { \n await command.execute(this.client, message, args);\n } \n else if (!message.inGuild() && command.contexts.includes('BotDM')) {\n await command.execute(this.client, message as any, args);\n }\n this.emit('success', { context: message, command });\n } catch (error) {\n this.emit('error', { context: message, command, error });\n }\n }\n\n\n private async _handleInteraction(interaction: Interaction) {\n if (!interaction.isChatInputCommand() && !interaction.isContextMenuCommand()) return;\n\n const commandId = `${this._getCommandId(interaction)}:${interaction.commandName}`;\n const command = this.client.commands.get(commandId);\n if (!command || command.disabled || command.commandType === 'Message') {\n this.emit('unknown', interaction);\n return;\n }\n\n if (this.middleware) {\n const shouldContinue = await this.middleware(interaction, command);\n if (!shouldContinue) return;\n }\n\n\n if (!interaction.inCachedGuild() && (command.commandContexts?.includes('Guild') || command.commandContexts?.includes(0))) return;\n if (command.clientPermissions && interaction.inCachedGuild()) {\n const clientMember = await interaction.guild.members.fetchMe({ force: false });\n const clientPerms = resolvePermissions(clientMember, interaction.channel);\n\n if (!clientPerms.has(command.clientPermissions)) {\n const missing = clientPerms.missing(command.clientPermissions);\n if (typeof this.handlers.onClientPermissions === 'function') return this.handlers.onClientPermissions(interaction, command, missing);\n return interaction.reply({ content: `${clientMember.displayName} requires ${formatPermissions(missing)} permission(s) to run this command.`, flags: MessageFlags.Ephemeral });\n }\n }\n \n\n if (command.cooldown && command.cooldown > 1000) {\n if (!this.client.cooldowns.has(commandId)) this.client.cooldowns.set(commandId, new Collection());\n const commandCooldowns = this.client.cooldowns.get(commandId);\n \n if (commandCooldowns) {\n if (commandCooldowns.has(interaction.user.id)) {\n const expiresAt = new Date((commandCooldowns.get(interaction.user.id) || 0) + command.cooldown).valueOf();\n \n if (expiresAt - Date.now() > 1000) {\n if (typeof this.handlers.onCooldown === 'function') return this.handlers.onCooldown(interaction, command, new Date(expiresAt));\n return await interaction.reply({ content: `Slow down and try the Command Again **${unixTimestamp(new Date(expiresAt), 'R')}**.`, flags: MessageFlags.Ephemeral });\n }\n }\n commandCooldowns.set(interaction.user.id, new Date().valueOf());\n setTimeout(() => commandCooldowns.delete(interaction.user.id), command.cooldown);\n }\n }\n\n\n try {\n this.emit('execute', { context: interaction, command });\n await command.execute(this.client, interaction as any);\n this.emit('success', { context: interaction, command });\n } catch (error) {\n this.emit('error', { context: interaction, command, error });\n }\n }\n\n\n private _getCommandId(interaction: Interaction) {\n if (interaction.isChatInputCommand()) return 'Slash';\n else if (interaction.isUserContextMenuCommand()) return 'ContextUser';\n else if (interaction.isMessageContextMenuCommand()) return 'ContextMessage';\n return 'unknown';\n }\n\n private _getCommandData(command: (FrameworkSlashCommand | FrameworkContextCommand)) {\n const base = {\n name: command.name,\n defaultMemberPermissions: command.memberPermissions ?? null,\n contexts: resolveCommandContexts(command.commandContexts),\n integrationTypes: resolveIntegrationTypes(command.integrationTypes),\n nameLocalizations: command.nameLocalizations,\n descriptionLocalizations: command.descriptionLocalizations,\n };\n\n if (command.commandType === 'Slash') {\n return {\n ...base,\n type: ApplicationCommandType.ChatInput as const,\n description: command.description,\n options: command.options,\n };\n } else if (command.commandType === 'ContextMessage') {\n return {\n ...base,\n type: ApplicationCommandType.Message as const,\n };\n }\n\n return {\n ...base,\n type: ApplicationCommandType.User as const,\n };\n } \n}\n\n\n/**\n * Emitted when a command is executed\n * @event CommandsModule#execute\n * @param {FrameworkCommand} context.command The command\n * @param {Message|CommandInteraction} context.context The interaction / message\n */\n\n/**\n * Emitted when a command finishes execution successfully\n * @event CommandsModule#success\n * @param {FrameworkCommand} context.command The command\n * @param {Message|CommandInteraction} context.context The interaction / message\n */\n\n/**\n * Emitted when a command throws an error\n * @event CommandsModule#error\n * @param {FrameworkCommand} context.command The command\n * @param {Message|CommandInteraction} context.context The interaction / message\n * @param {any} context.error The error\n */\n\n/**\n * Emitted when an interaction arrives with a command that is not loaded\n * @event CommandsModule#unknown\n * @param {CommandInteraction} interaction The interaction\n */","import { FrameworkError, FrameworkTypeError } from '../../core/FrameworkError';\nimport { AutocompleterOptions } from '../../types';\n\n\nexport function Autocompleter(options: AutocompleterOptions) {\n \n if (!options) throw new FrameworkError('NoOptions');\n if (typeof options !== 'object') throw new FrameworkTypeError('InvalidType', 'options', 'object', typeof options);\n \n if (!options.name || !options.name?.length) throw new FrameworkError('InvalidOption', 'name');\n if (typeof options.name !== 'string') throw new FrameworkTypeError('InvalidType', 'name', 'string', typeof options.name);\n\n if (!options.execute) throw new FrameworkError('InvalidOption', 'execute');\n if (typeof options.execute !== 'function') throw new FrameworkTypeError('InvalidType', 'execute', 'function', typeof options.execute);\n \n if (options.commands && !Array.isArray(options.commands)) throw new FrameworkTypeError('InvalidType', 'commands', 'string[]', typeof options.commands);\n if (options.disabled !== undefined && typeof options.disabled !== 'boolean') throw new FrameworkTypeError('InvalidType', 'disabled', 'boolean', typeof options.disabled);\n\n return {\n id: options.name,\n name: options.name,\n disabled: options.disabled ?? false,\n execute: options.execute,\n }\n}","import { \n APIApplicationCommandOption, AutocompleteInteraction, ChatInputCommandInteraction, CommandInteraction, LocalizationMap, Message, \n MessageContextMenuCommandInteraction, PermissionResolvable, PermissionsString, SlashCommandOptionsOnlyBuilder, UserContextMenuCommandInteraction,\n} from 'discord.js';\nimport { FrameworkClient } from '../core/FrameworkClient';\n\n\nexport const CommandTypes = ['Slash', 'Message', 'ContextMessage', 'ContextUser'] as const;\nexport const CommandContexts = ['Guild', 'BotDM', 'PrivateChannel', 0, 1, 2] as const;\nexport const IntegrationTypes = ['GuildInstall', 'UserInstall', 0, 1] as const;\nexport const CommandScopes = ['default', 'guild', 'global'] as const;\nexport const MessageCommandContexts = ['Guild', 'BotDM'] as const;\n\nexport type CommandType = typeof CommandTypes[number];\nexport type CommandContext = typeof CommandContexts[number];\nexport type IntegrationType = typeof IntegrationTypes[number];\nexport type CommandScope = typeof CommandScopes[number];\n\ntype Result = unknown | void;\ntype MessageCommandContext = typeof MessageCommandContexts[number];\n\n\nexport interface BaseCommandOptions {\n /** The Name of the Command */\n name: string;\n /** The Description of the Command */\n description: string;\n /** The Type of the Command */\n commandType: CommandType;\n /** The Cooldown of the Command (in MS) */\n cooldown?: number;\n /** Permissions required by the User to use this Command */\n memberPermissions?: PermissionResolvable;\n /** Permissions required by the Application Client to execute this Command */\n clientPermissions?: PermissionResolvable;\n /** Whether this command is Disabled */\n disabled?: boolean;\n}\n\ninterface BaseAppCommandOptions extends BaseCommandOptions {\n /**\n * Where this Application Command can be registered\n * - `default` - In both Guild & Global Commands\n * - `guild` - In only Guild Commands\n * - `global` - In only Global Commands\n */\n commandScope: CommandScope;\n /**\n * Where this Application Command can be used\n * - `Guild` | `(0)` - In Guilds\n * - `BotDM` | `(1)` - In Application DMs\n * - `PrivateChannel` | `(2)` - In Other's DMs & Group DMs\n */\n commandContexts?: CommandContext[];\n /**\n * Where this Application Command can be integrated\n * - `GuildInstall` | `(0)` - App is installable to servers\n * - `UserInstall` | `(1)` - App is installable to users\n */\n integrationTypes?: IntegrationType[];\n /** The Name Localizations of the Command */\n nameLocalizations?: LocalizationMap;\n /** The Description Localizations of the Command */\n descriptionLocalizations?: LocalizationMap;\n}\n\n\ntype InferMessage<C> = (C extends MessageCommandContext[]\n ? 'Guild' extends C[number] \n ? 'BotDM' extends C[number] \n ? Message<boolean> : Message<true>\n : Message<false>\n : Message<boolean>\n);\n\nexport interface MessageCommandOptions<C extends MessageCommandContext[] | undefined = ['Guild']> extends BaseCommandOptions {\n commandType: 'Message';\n /** The Aliases of the Command */\n aliases?: string[];\n /** The Usage of the Command */\n usage?: string;\n /** Whether the command is Developer Only */\n devOnly?: boolean;\n /**\n * Where this Message Command can be used\n * - `BotDM` - In Application DMs\n * - `Guild` - In Guilds\n */\n contexts?: C;\n execute: (client: FrameworkClient<true>, message: InferMessage<C>, args: string[]) => Promise<Result> | Result;\n}\n\n\nexport type SlashOptionsInput = (\n | APIApplicationCommandOption[]\n | { toJSON(): APIApplicationCommandOption }[]\n | ((builder: SlashCommandOptionsOnlyBuilder) => SlashCommandOptionsOnlyBuilder)\n);\n\nexport interface SlashCommandOptions extends BaseAppCommandOptions {\n commandType: 'Slash';\n /** The Application Command Options of this Command */\n options?: SlashOptionsInput;\n execute: (client: FrameworkClient<true>, interaction: ChatInputCommandInteraction<'cached'>) => Promise<Result> | Result;\n autocomplete?: (client: FrameworkClient<true>, interaction: AutocompleteInteraction<'cached'>) => Promise<Result> | Result;\n}\n\n\nexport interface ContextMessageCommandOptions extends Omit<BaseAppCommandOptions, 'description'> {\n commandType: 'ContextMessage';\n /** The Description of the Command */\n description?: string;\n execute: (client: FrameworkClient<true>, interaction: MessageContextMenuCommandInteraction<'cached'>) => Promise<Result> | Result;\n}\n\nexport interface ContextUserCommandOptions extends Omit<BaseAppCommandOptions, 'description'> {\n commandType: 'ContextUser';\n /** The Description of the Command */\n description?: string;\n execute: (client: FrameworkClient<true>, interaction: UserContextMenuCommandInteraction<'cached'>) => Promise<Result> | Result;\n}\nexport type ContextCommandOptions = (ContextMessageCommandOptions | ContextUserCommandOptions);\n\n\ninterface BaseCommandMeta {\n id: string;\n filepath: string;\n disabled: boolean;\n}\n\nexport type FrameworkSlashCommand = SlashCommandOptions & BaseCommandMeta & {\n options: APIApplicationCommandOption[];\n};\nexport type FrameworkMessageCommand = MessageCommandOptions & BaseCommandMeta & {\n devOnly: boolean;\n contexts: MessageCommandContext[];\n};\nexport type FrameworkContextCommand = ContextCommandOptions & BaseCommandMeta;\nexport type FrameworkCommand = (FrameworkSlashCommand | FrameworkMessageCommand | FrameworkContextCommand);\n\n\nexport type CommandMiddleware = (context: Message | CommandInteraction, command: FrameworkCommand) => Promise<boolean> | boolean;\nexport interface CommandCustomHandlers {\n onCooldown?: (context: Message | CommandInteraction, command: FrameworkCommand, expirationTime: Date) => any;\n onMemberPermissions?: (context: Message, command: FrameworkCommand, missingPermissions: PermissionsString[]) => any;\n onClientPermissions?: (context: Message | CommandInteraction, command: FrameworkCommand, missingPermissions: PermissionsString[]) => any;\n}","import { ContextCommandOptions, CommandTypes, CommandScopes, CommandContexts, IntegrationTypes } from '../../types';\nimport { ApplicationIntegrationType, InteractionContextType } from 'discord.js';\nimport { FrameworkError, FrameworkTypeError } from '../../core/FrameworkError';\nimport { BaseCommand } from './BaseCommand';\n\n\nexport function ContextCommand(options: ContextCommandOptions) {\n\n if (!options.commandType) throw new FrameworkError('InvalidOption', 'commandType');\n if (options.commandType !== CommandTypes[2] && options.commandType !== CommandTypes[3]) throw new FrameworkError('InvalidValue', 'commandType', CommandTypes);\n\n if (!options.commandScope) throw new FrameworkError('InvalidOption', 'commandScope');\n if (typeof options.commandScope !== 'string' || !CommandScopes.includes(options.commandScope)) throw new FrameworkError('InvalidValue', 'commandScope', CommandScopes);\n\n if (options.commandContexts && !Array.isArray(options.commandContexts)) throw new FrameworkTypeError('InvalidType', 'commandContexts', 'Array', typeof options.commandContexts);\n if (options.commandContexts && options.commandContexts.some(c => !CommandContexts.includes(c))) throw new FrameworkError('InvalidValues', 'commandContexts', CommandContexts);\n\n if (options.integrationTypes && !Array.isArray(options.integrationTypes)) throw new FrameworkTypeError('InvalidType', 'integrationTypes', 'Array', typeof options.integrationTypes);\n if (options.integrationTypes && options.integrationTypes.some(c => !IntegrationTypes.includes(c))) throw new FrameworkError('InvalidValues', 'integrationTypes', IntegrationTypes);\n\n if (!options.execute) throw new FrameworkError('InvalidOption', 'execute');\n if (typeof options.execute !== 'function') throw new FrameworkTypeError('InvalidType', 'execute', 'function', typeof options.execute);\n\n if (!options.commandContexts || !options.commandContexts.length) options.commandContexts = [InteractionContextType.Guild];\n if (!options.integrationTypes || !options.integrationTypes.length) options.integrationTypes = [ApplicationIntegrationType.GuildInstall];\n\n return BaseCommand({\n ...options,\n commandType: options.commandType,\n description: options.description ?? 'no description',\n });\n}","import { FrameworkError, FrameworkTypeError } from '../../core/FrameworkError';\nimport { isPermissionResolvable, normalizeCommandName } from '../../utils';\nimport { BaseCommandOptions, CommandTypes } from '../../types';\n\n\nexport function BaseCommand(options: BaseCommandOptions) {\n\n if (!options) throw new FrameworkError('NoOptions');\n if (typeof options !== 'object') throw new FrameworkTypeError('InvalidType', 'options', 'object', typeof options);\n\n if (!options.name || !options.name?.length) throw new FrameworkError('InvalidOption', 'name');\n if (typeof options.name !== 'string') throw new FrameworkTypeError('InvalidType', 'name', 'string', typeof options.name);\n\n if (!options.description || !options.description?.length) throw new FrameworkError('InvalidOption', 'description');\n if (typeof options.description !== 'string') throw new FrameworkTypeError('InvalidType', 'description', 'string', typeof options.description);\n\n if (!options.commandType) throw new FrameworkError('InvalidOption', 'commandType');\n if (!CommandTypes.includes(options.commandType)) throw new FrameworkError('InvalidValue', 'commandType', CommandTypes);\n\n if (options.memberPermissions !== undefined && !isPermissionResolvable(options.memberPermissions)) {\n throw new FrameworkTypeError('InvalidType', 'memberPermissions', 'PermissionResolvable', typeof options.memberPermissions);\n }\n if (options.clientPermissions !== undefined && !isPermissionResolvable(options.clientPermissions)) {\n throw new FrameworkTypeError('InvalidType', 'clientPermissions', 'PermissionResolvable', typeof options.clientPermissions);\n }\n\n if (options.cooldown && typeof options.cooldown !== 'number') throw new FrameworkTypeError('InvalidType', 'cooldown', 'number', typeof options.cooldown);\n if (options.disabled !== undefined && typeof options.disabled !== 'boolean') throw new FrameworkTypeError('InvalidType', 'disabled', 'boolean', typeof options.disabled);\n\n return {\n ...options,\n id: `${options.commandType}:${options.name}`,\n name: normalizeCommandName(options.name, options.commandType),\n description: options.description,\n commandType: options.commandType,\n memberPermissions: options.memberPermissions ?? undefined,\n clientPermissions: options.clientPermissions ?? undefined,\n cooldown: options.cooldown ?? undefined,\n disabled: options.disabled ?? false,\n };\n}","import { MessageCommandOptions as CommandOptions, MessageCommandContexts } from '../../types';\nimport { FrameworkError, FrameworkTypeError } from '../../core/FrameworkError';\nimport { BaseCommand } from './BaseCommand';\n\n\ntype MessageCommandOptions = Omit<CommandOptions, 'commandType'>;\nexport function MessageCommand(options: MessageCommandOptions) {\n\n if (options.aliases && !Array.isArray(options.aliases)) throw new FrameworkTypeError('InvalidType', 'aliases', 'array', typeof options.aliases);\n if (options.usage && typeof options.usage !== 'string') throw new FrameworkTypeError('InvalidType', 'usage', 'string', typeof options.usage);\n \n if (options.contexts && !Array.isArray(options.contexts)) throw new FrameworkTypeError('InvalidType', 'contexts', 'array', typeof options.contexts);\n if (options.contexts && options.contexts.some(c => !MessageCommandContexts.includes(c))) throw new FrameworkError('InvalidValues', 'contexts', MessageCommandContexts);\n\n if (!options.execute) throw new FrameworkError('InvalidOption', 'execute');\n if (typeof options.execute !== 'function') throw new FrameworkTypeError('InvalidType', 'execute', 'function', typeof options.execute);\n if (options.devOnly !== undefined && typeof options.devOnly !== 'boolean') throw new FrameworkTypeError('InvalidType', 'devOnly', 'boolean', typeof options.devOnly);\n\n if (!options.contexts) options.contexts = ['Guild'];\n if (options.devOnly === undefined) options.devOnly = false;\n\n return BaseCommand({\n ...options,\n commandType: 'Message',\n });\n}","import { CommandScopes, CommandContexts, IntegrationTypes, SlashCommandOptions as CommandOptions } from '../../types';\nimport { ApplicationIntegrationType, InteractionContextType } from 'discord.js';\nimport { FrameworkError, FrameworkTypeError } from '../../core/FrameworkError';\nimport { normalizeOptions } from '../../utils';\nimport { BaseCommand } from './BaseCommand';\n\n\ntype SlashCommandOptions = Omit<CommandOptions, 'commandType'>;\nexport function SlashCommand(options: SlashCommandOptions) {\n\n if (!options.commandScope) throw new FrameworkError('InvalidOption', 'commandScope');\n if (typeof options.commandScope !== 'string' || !CommandScopes.includes(options.commandScope)) throw new FrameworkError('InvalidValue', 'commandScope', CommandScopes);\n\n if (options.commandContexts && !Array.isArray(options.commandContexts)) throw new FrameworkTypeError('InvalidType', 'commandContexts', 'Array', typeof options.commandContexts);\n if (options.commandContexts && options.commandContexts.some(c => !CommandContexts.includes(c))) throw new FrameworkError('InvalidValues', 'commandContexts', CommandContexts);\n\n if (options.integrationTypes && !Array.isArray(options.integrationTypes)) throw new FrameworkTypeError('InvalidType', 'integrationTypes', 'Array', typeof options.integrationTypes);\n if (options.integrationTypes && options.integrationTypes.some(c => !IntegrationTypes.includes(c))) throw new FrameworkError('InvalidValues', 'integrationTypes', IntegrationTypes);\n\n if (!options.execute) throw new FrameworkError('InvalidOption', 'execute');\n if (typeof options.execute !== 'function') throw new FrameworkTypeError('InvalidType', 'execute', 'function', typeof options.execute);\n\n options.options = normalizeOptions(options.options);\n if (!options.commandContexts || !options.commandContexts.length) options.commandContexts = [InteractionContextType.Guild];\n if (!options.integrationTypes || !options.integrationTypes.length) options.integrationTypes = [ApplicationIntegrationType.GuildInstall];\n \n return BaseCommand({\n ...options,\n commandType: 'Slash',\n });\n}","import { FrameworkError, FrameworkTypeError } from '../../core/FrameworkError';\nimport { ListenerOptions } from '../../types';\nimport { ClientEvents } from 'discord.js';\n\n\nexport function Listener<T extends keyof ClientEvents>(options: ListenerOptions<T>) {\n\n if (!options) throw new FrameworkError('NoOptions');\n if (typeof options !== 'object') throw new FrameworkTypeError('InvalidType', 'options', 'object', typeof options);\n\n if (!options.name || !options.name?.length) throw new FrameworkError('InvalidOption', 'name');\n if (typeof options.name !== 'string') throw new FrameworkTypeError('InvalidType', 'name', 'string', typeof options.name);\n\n if (!options.execute) throw new FrameworkError('InvalidOption', 'execute');\n if (typeof options.execute !== 'function') throw new FrameworkTypeError('InvalidType', 'execute', 'function', typeof options.execute);\n\n if (options.once !== undefined && typeof options.once !== 'boolean') throw new FrameworkTypeError('InvalidType', 'once', 'boolean', typeof options.once);\n if (options.disabled !== undefined && typeof options.disabled !== 'boolean') throw new FrameworkTypeError('InvalidType', 'disabled', 'boolean', typeof options.disabled);\n\n return {\n id: `Client:${options.name}`,\n name: options.name,\n once: options.once ?? false,\n disabled: options.disabled ?? false,\n execute: options.execute,\n } \n}","import { Message } from 'discord.js';\nimport * as MessageExtensions from './Message';\n\nObject.defineProperties(Message.prototype, {\n prefix: { get: MessageExtensions.prefix, configurable: true },\n isDeveloper: { value: MessageExtensions.isDeveloper, writable: true, configurable: true },\n awaitMemberResponse: { value: MessageExtensions.awaitMemberResponse, writable: true, configurable: true },\n createModalSubmitCollector: { value: MessageExtensions.createModalSubmitCollector, writable: true, configurable: true },\n awaitModalSubmitComponent: { value: MessageExtensions.awaitModalSubmitComponent, writable: true, configurable: true },\n});","import { Message, MessageCollector, Message as DiscordMessage, InteractionCollector, InteractionType, ModalSubmitInteraction } from 'discord.js';\nimport { AwaitMemberResponseOptions, ModalCollectorOptions } from '../types';\n\nexport function prefix(this: Message) {\n return this.client.prefix;\n}\n\nexport function isDeveloper(this: Message) {\n return this.client.developers.includes(this.author.id);\n}\n\nexport function awaitMemberResponse(this: Message, options: AwaitMemberResponseOptions = {}) {\n return new Promise<DiscordMessage>((resolve, reject) => {\n if (!this.channel) {\n return reject(new Error('Channel not available for this message.'));\n }\n\n const collector = new MessageCollector(this.channel, {\n time: 60000,\n filter: (m) => m.author.id === this.author.id && (m.content || '').length > 0,\n ...options,\n max: 1\n });\n\n collector.on('end', (messages, reason) => {\n const message = messages.first();\n if (message) {\n if (options.deleteMessage) message.delete().catch(() => null);\n resolve(message);\n } else {\n reject(new Error(reason));\n }\n });\n })\n}\n\nexport function createModalSubmitCollector(this: Message, options: ModalCollectorOptions = {}) {\n return new InteractionCollector<ModalSubmitInteraction>(this.client, { \n ...options, \n interactionType: InteractionType.ModalSubmit, \n message: this\n });\n}\n\nexport function awaitModalSubmitComponent(this: Message, options: ModalCollectorOptions = {}) {\n return new Promise<ModalSubmitInteraction>((resolve, reject) => {\n const collector = new InteractionCollector<ModalSubmitInteraction>(this.client, {\n time: 60000, \n filter: (i) => i.user.id === this.author.id, \n ...options, \n interactionType: InteractionType.ModalSubmit, \n message: this, \n max: 1\n });\n\n collector.on('end', (interactions, reason) => {\n const interaction = interactions.first();\n if (interaction) resolve(interaction);\n else reject(new Error(reason));\n })\n })\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,kBAAkE;;;ACDlE,uBAAiB;AACjB,sBAAgB;AAChB,qBAAe;AAGf,eAAsB,UAAU,KAAgC;AAC9D,MAAI,CAAC,eAAAC,QAAG,WAAW,GAAG,EAAG,QAAO,CAAC;AAEjC,QAAM,QAAkB,CAAC;AACzB,QAAM,QAAQ,eAAAA,QAAG,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;AAEzD,aAAW,QAAQ,OAAO;AACxB,UAAM,WAAW,iBAAAC,QAAK,KAAK,KAAK,KAAK,IAAI;AACzC,QAAI,KAAK,YAAY,EAAG,OAAM,KAAK,GAAI,MAAM,UAAU,QAAQ,CAAE;AAAA,aACxD,KAAK,KAAK,SAAS,KAAK,KAAK,KAAK,KAAK,SAAS,KAAK,EAAG,OAAM,KAAK,QAAQ;AAAA,EACtF;AACA,SAAO;AACT;AAQO,SAAS,UAAU,KAAa;AACrC,SAAO,eAAAC,QAAG,WAAW,GAAG;AAC1B;AAEO,SAAS,eAAe,OAAiB;AAC9C,SAAO,iBAAAC,QAAK,QAAQ,GAAG,KAA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CAAC;AACH;;;AD1DA,OAAO,iBAAiB,wBAAQ,WAAW;AAAA,EACzC,QAAQ,EAAE,KAAuB,QAAQ,cAAc,KAAK;AAAA,EAC5D,aAAa,EAAE,OAAyB,aAAa,UAAU,MAAM,cAAc,KAAK;AAAA,EACxF,qBAAqB,EAAE,OAAyB,qBAAqB,UAAU,MAAM,cAAc,KAAK;AAAA,EACxG,4BAA4B,EAAE,OAAyB,4BAA4B,UAAU,MAAM,cAAc,KAAK;AAAA,EACtH,2BAA2B,EAAE,OAAyB,2BAA2B,UAAU,MAAM,cAAc,KAAK;AACtH,CAAC;;;AhBUD,IAAAC,kBAYO;","names":["import_discord","fs","path","fs","path","url","prefix","import_discord","EventEmitter","module","module","import_discord","import_events","EventEmitter","module","DiscordClient","import_discord","import_discord","import_discord","import_discord","messages","import_discord"]}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import {
|
|
2
|
+
import { PermissionResolvable, LocalizationMap, APIApplicationCommandOption, SlashCommandOptionsOnlyBuilder, Message, CommandInteraction, PermissionsString, ChatInputCommandInteraction, AutocompleteInteraction, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, ClientEvents, Collection, ModalSubmitInteraction, MessageCollectorOptions, InteractionCollectorOptions, ClientOptions, Client } from 'discord.js';
|
|
3
3
|
export { SlashCommandAttachmentOption as AttachmentOption, SlashCommandBooleanOption as BooleanOption, SlashCommandChannelOption as ChannelOption, SlashCommandIntegerOption as IntegerOption, SlashCommandMentionableOption as MentionableOption, SlashCommandNumberOption as NumberOption, SlashCommandRoleOption as RoleOption, SlashCommandStringOption as StringOption, SlashCommandSubcommandBuilder as SubcommandBuilder, SlashCommandSubcommandGroupBuilder as SubcommandGroupBuilder, SlashCommandUserOption as UserOption } from 'discord.js';
|
|
4
4
|
import EventEmitter from 'events';
|
|
5
5
|
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
declare const CommandTypes: readonly ["Slash", "Message", "ContextMessage", "ContextUser"];
|
|
7
|
+
declare const CommandContexts: readonly ["Guild", "BotDM", "PrivateChannel", 0, 1, 2];
|
|
8
|
+
declare const IntegrationTypes: readonly ["GuildInstall", "UserInstall", 0, 1];
|
|
9
|
+
declare const CommandScopes: readonly ["default", "guild", "global"];
|
|
10
|
+
declare const MessageCommandContexts: readonly ["Guild", "BotDM"];
|
|
11
|
+
type CommandType = typeof CommandTypes[number];
|
|
12
|
+
type CommandContext = typeof CommandContexts[number];
|
|
13
|
+
type IntegrationType = typeof IntegrationTypes[number];
|
|
14
|
+
type CommandScope = typeof CommandScopes[number];
|
|
15
|
+
type Result$2 = unknown | void;
|
|
16
|
+
type MessageCommandContext = typeof MessageCommandContexts[number];
|
|
14
17
|
interface BaseCommandOptions {
|
|
15
18
|
/** The Name of the Command */
|
|
16
19
|
name: string;
|
|
17
20
|
/** The Description of the Command */
|
|
18
21
|
description: string;
|
|
19
22
|
/** The Type of the Command */
|
|
20
|
-
commandType:
|
|
23
|
+
commandType: CommandType;
|
|
21
24
|
/** The Cooldown of the Command (in MS) */
|
|
22
25
|
cooldown?: number;
|
|
23
26
|
/** Permissions required by the User to use this Command */
|
|
24
27
|
memberPermissions?: PermissionResolvable;
|
|
25
28
|
/** Permissions required by the Application Client to execute this Command */
|
|
26
29
|
clientPermissions?: PermissionResolvable;
|
|
27
|
-
/** Whether this command is
|
|
30
|
+
/** Whether this command is Disabled */
|
|
28
31
|
disabled?: boolean;
|
|
29
32
|
}
|
|
30
33
|
interface BaseAppCommandOptions extends BaseCommandOptions {
|
|
@@ -34,26 +37,27 @@ interface BaseAppCommandOptions extends BaseCommandOptions {
|
|
|
34
37
|
* - `guild` - In only Guild Commands
|
|
35
38
|
* - `global` - In only Global Commands
|
|
36
39
|
*/
|
|
37
|
-
commandScope:
|
|
40
|
+
commandScope: CommandScope;
|
|
38
41
|
/**
|
|
39
42
|
* Where this Application Command can be used
|
|
40
43
|
* - `Guild` | `(0)` - In Guilds
|
|
41
44
|
* - `BotDM` | `(1)` - In Application DMs
|
|
42
45
|
* - `PrivateChannel` | `(2)` - In Other's DMs & Group DMs
|
|
43
46
|
*/
|
|
44
|
-
commandContexts?:
|
|
47
|
+
commandContexts?: CommandContext[];
|
|
45
48
|
/**
|
|
46
49
|
* Where this Application Command can be integrated
|
|
47
50
|
* - `GuildInstall` | `(0)` - App is installable to servers
|
|
48
51
|
* - `UserInstall` | `(1)` - App is installable to users
|
|
49
52
|
*/
|
|
50
|
-
integrationTypes?:
|
|
53
|
+
integrationTypes?: IntegrationType[];
|
|
51
54
|
/** The Name Localizations of the Command */
|
|
52
55
|
nameLocalizations?: LocalizationMap;
|
|
53
56
|
/** The Description Localizations of the Command */
|
|
54
57
|
descriptionLocalizations?: LocalizationMap;
|
|
55
58
|
}
|
|
56
|
-
|
|
59
|
+
type InferMessage<C> = (C extends MessageCommandContext[] ? 'Guild' extends C[number] ? 'BotDM' extends C[number] ? Message<boolean> : Message<true> : Message<false> : Message<boolean>);
|
|
60
|
+
interface MessageCommandOptions$1<C extends MessageCommandContext[] | undefined = ['Guild']> extends BaseCommandOptions {
|
|
57
61
|
commandType: 'Message';
|
|
58
62
|
/** The Aliases of the Command */
|
|
59
63
|
aliases?: string[];
|
|
@@ -62,53 +66,110 @@ interface MessageCommandOptions$1 extends BaseCommandOptions {
|
|
|
62
66
|
/** Whether the command is Developer Only */
|
|
63
67
|
devOnly?: boolean;
|
|
64
68
|
/**
|
|
65
|
-
* Where this
|
|
69
|
+
* Where this Message Command can be used
|
|
66
70
|
* - `BotDM` - In Application DMs
|
|
67
71
|
* - `Guild` - In Guilds
|
|
68
72
|
*/
|
|
69
|
-
contexts?:
|
|
70
|
-
execute: (client: FrameworkClient<true>, message:
|
|
73
|
+
contexts?: C;
|
|
74
|
+
execute: (client: FrameworkClient<true>, message: InferMessage<C>, args: string[]) => Promise<Result$2> | Result$2;
|
|
71
75
|
}
|
|
76
|
+
type SlashOptionsInput = (APIApplicationCommandOption[] | {
|
|
77
|
+
toJSON(): APIApplicationCommandOption;
|
|
78
|
+
}[] | ((builder: SlashCommandOptionsOnlyBuilder) => SlashCommandOptionsOnlyBuilder));
|
|
72
79
|
interface SlashCommandOptions$1 extends BaseAppCommandOptions {
|
|
73
80
|
commandType: 'Slash';
|
|
74
81
|
/** The Application Command Options of this Command */
|
|
75
|
-
options?:
|
|
76
|
-
execute: (client: FrameworkClient<true>, interaction: ChatInputCommandInteraction) => Promise<
|
|
77
|
-
autocomplete?: (client: FrameworkClient<true>, interaction: AutocompleteInteraction) => Promise<
|
|
82
|
+
options?: SlashOptionsInput;
|
|
83
|
+
execute: (client: FrameworkClient<true>, interaction: ChatInputCommandInteraction<'cached'>) => Promise<Result$2> | Result$2;
|
|
84
|
+
autocomplete?: (client: FrameworkClient<true>, interaction: AutocompleteInteraction<'cached'>) => Promise<Result$2> | Result$2;
|
|
78
85
|
}
|
|
79
|
-
interface
|
|
80
|
-
commandType: 'ContextMessage'
|
|
81
|
-
|
|
86
|
+
interface ContextMessageCommandOptions extends Omit<BaseAppCommandOptions, 'description'> {
|
|
87
|
+
commandType: 'ContextMessage';
|
|
88
|
+
/** The Description of the Command */
|
|
89
|
+
description?: string;
|
|
90
|
+
execute: (client: FrameworkClient<true>, interaction: MessageContextMenuCommandInteraction<'cached'>) => Promise<Result$2> | Result$2;
|
|
82
91
|
}
|
|
83
|
-
interface
|
|
92
|
+
interface ContextUserCommandOptions extends Omit<BaseAppCommandOptions, 'description'> {
|
|
93
|
+
commandType: 'ContextUser';
|
|
94
|
+
/** The Description of the Command */
|
|
95
|
+
description?: string;
|
|
96
|
+
execute: (client: FrameworkClient<true>, interaction: UserContextMenuCommandInteraction<'cached'>) => Promise<Result$2> | Result$2;
|
|
97
|
+
}
|
|
98
|
+
type ContextCommandOptions = (ContextMessageCommandOptions | ContextUserCommandOptions);
|
|
99
|
+
interface BaseCommandMeta {
|
|
84
100
|
id: string;
|
|
85
101
|
filepath: string;
|
|
86
102
|
disabled: boolean;
|
|
87
103
|
}
|
|
88
|
-
type FrameworkSlashCommand = SlashCommandOptions$1 &
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
type FrameworkSlashCommand = SlashCommandOptions$1 & BaseCommandMeta & {
|
|
105
|
+
options: APIApplicationCommandOption[];
|
|
106
|
+
};
|
|
107
|
+
type FrameworkMessageCommand = MessageCommandOptions$1 & BaseCommandMeta & {
|
|
91
108
|
devOnly: boolean;
|
|
92
|
-
contexts:
|
|
109
|
+
contexts: MessageCommandContext[];
|
|
93
110
|
};
|
|
111
|
+
type FrameworkContextCommand = ContextCommandOptions & BaseCommandMeta;
|
|
94
112
|
type FrameworkCommand = (FrameworkSlashCommand | FrameworkMessageCommand | FrameworkContextCommand);
|
|
95
|
-
|
|
113
|
+
type CommandMiddleware = (context: Message | CommandInteraction, command: FrameworkCommand) => Promise<boolean> | boolean;
|
|
114
|
+
interface CommandCustomHandlers {
|
|
96
115
|
onCooldown?: (context: Message | CommandInteraction, command: FrameworkCommand, expirationTime: Date) => any;
|
|
97
116
|
onMemberPermissions?: (context: Message, command: FrameworkCommand, missingPermissions: PermissionsString[]) => any;
|
|
98
117
|
onClientPermissions?: (context: Message | CommandInteraction, command: FrameworkCommand, missingPermissions: PermissionsString[]) => any;
|
|
99
|
-
MessageCommandInterceptor?: (message: Message) => Promise<boolean>;
|
|
100
|
-
InteractionCommandInterceptor?: (interaction: Interaction) => Promise<boolean>;
|
|
101
118
|
}
|
|
102
|
-
|
|
119
|
+
|
|
120
|
+
type Result$1 = unknown | void;
|
|
121
|
+
interface ListenerOptions<T extends keyof ClientEvents = keyof ClientEvents> {
|
|
122
|
+
/** Name of the Listener */
|
|
123
|
+
name: T;
|
|
124
|
+
/** Whether to execute only once */
|
|
125
|
+
once?: boolean;
|
|
126
|
+
/** Whether the Listener is disabled */
|
|
127
|
+
disabled?: boolean;
|
|
128
|
+
/** Handles the execution of the Listener */
|
|
129
|
+
execute: (...args: ClientEvents[T]) => Promise<Result$1> | Result$1;
|
|
130
|
+
}
|
|
131
|
+
interface BaseListenerMeta {
|
|
132
|
+
id: string;
|
|
133
|
+
filepath: string;
|
|
134
|
+
}
|
|
135
|
+
interface FrameworkListener<T extends keyof ClientEvents = keyof ClientEvents> extends BaseListenerMeta {
|
|
136
|
+
name: T;
|
|
137
|
+
once: boolean;
|
|
138
|
+
disabled: boolean;
|
|
139
|
+
execute: (...args: ClientEvents[T]) => Promise<Result$1> | Result$1;
|
|
140
|
+
_execute?: (...args: ClientEvents[T]) => Promise<Result$1> | Result$1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type Result = unknown | void;
|
|
144
|
+
interface AutocompleterOptions {
|
|
145
|
+
/** Name of the Autocompleter */
|
|
146
|
+
name: string;
|
|
147
|
+
/** Whether the Autocompleter is disabled */
|
|
148
|
+
disabled?: boolean;
|
|
149
|
+
/** Command Names the Autocompleter applies to */
|
|
150
|
+
commands?: string[];
|
|
151
|
+
/** Handle the execution of the Autocompleter */
|
|
152
|
+
execute: (client: FrameworkClient<true>, interaction: AutocompleteInteraction<'cached'>, command: FrameworkSlashCommand, value: string) => Promise<Result> | Result;
|
|
153
|
+
}
|
|
154
|
+
interface BaseAutocompleterMeta {
|
|
155
|
+
id: string;
|
|
156
|
+
filepath: string;
|
|
157
|
+
}
|
|
158
|
+
interface FrameworkAutocompleter extends BaseAutocompleterMeta {
|
|
159
|
+
name: string;
|
|
160
|
+
disabled: boolean;
|
|
161
|
+
commands?: string[];
|
|
162
|
+
execute: (client: FrameworkClient<true>, interaction: AutocompleteInteraction<'cached'>, command: FrameworkSlashCommand, value: string) => Promise<Result> | Result;
|
|
163
|
+
}
|
|
103
164
|
|
|
104
165
|
/**
|
|
105
|
-
* @class
|
|
106
|
-
* @fires
|
|
107
|
-
* @fires
|
|
108
|
-
* @fires
|
|
109
|
-
* @fires
|
|
166
|
+
* @class AutocompletersModule
|
|
167
|
+
* @fires AutocompletersModule#execute
|
|
168
|
+
* @fires AutocompletersModule#success
|
|
169
|
+
* @fires AutocompletersModule#error
|
|
170
|
+
* @fires AutocompletersModule#unknown
|
|
110
171
|
*/
|
|
111
|
-
declare class
|
|
172
|
+
declare class AutocompletersModule extends EventEmitter {
|
|
112
173
|
private client;
|
|
113
174
|
constructor(client: FrameworkClient);
|
|
114
175
|
load(filepath: string, reload?: boolean): Promise<boolean>;
|
|
@@ -136,11 +197,12 @@ declare class ListenerModule {
|
|
|
136
197
|
*/
|
|
137
198
|
declare class CommandsModule extends EventEmitter {
|
|
138
199
|
private client;
|
|
139
|
-
private
|
|
200
|
+
private handlers;
|
|
201
|
+
private middleware?;
|
|
202
|
+
private prefixRegex?;
|
|
140
203
|
constructor(client: FrameworkClient);
|
|
141
|
-
setHandler<K extends
|
|
142
|
-
|
|
143
|
-
setInteractionInterceptor(callback: (interaction: Interaction) => Promise<boolean>): (interaction: Interaction) => Promise<boolean>;
|
|
204
|
+
setHandler<K extends keyof CommandCustomHandlers>(key: K, callback: NonNullable<CommandCustomHandlers[K]>): boolean;
|
|
205
|
+
setMiddleware(callback: CommandMiddleware): boolean;
|
|
144
206
|
load(filepath: string, reload?: boolean): Promise<boolean>;
|
|
145
207
|
loadAll(): Promise<void>;
|
|
146
208
|
reload(id: string): Promise<void>;
|
|
@@ -156,54 +218,10 @@ declare class CommandsModule extends EventEmitter {
|
|
|
156
218
|
private _getCommandData;
|
|
157
219
|
}
|
|
158
220
|
|
|
159
|
-
interface ListenerOptions<T extends keyof ClientEvents = keyof ClientEvents> {
|
|
160
|
-
/** Name of the Listener. */
|
|
161
|
-
name: T;
|
|
162
|
-
/** Wheather to execute the function only Once. */
|
|
163
|
-
once?: boolean;
|
|
164
|
-
/** Whether the Listener is disabled. */
|
|
165
|
-
disabled?: boolean;
|
|
166
|
-
/** Handles the execution of the Listener */
|
|
167
|
-
execute: (...args: ClientEvents[T]) => Promise<boolean>;
|
|
168
|
-
}
|
|
169
|
-
interface FrameworkListener<T extends keyof ClientEvents = keyof ClientEvents> {
|
|
170
|
-
id: string;
|
|
171
|
-
filepath: string;
|
|
172
|
-
name: T;
|
|
173
|
-
once: boolean;
|
|
174
|
-
disabled: boolean;
|
|
175
|
-
execute: (...args: ClientEvents[T]) => Promise<boolean>;
|
|
176
|
-
_execute?: (...args: ClientEvents[T]) => Promise<boolean>;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
interface FrameworkClientOptions {
|
|
180
|
-
clientOptions: ClientOptions;
|
|
181
|
-
rootDir?: string;
|
|
182
|
-
developers?: string[];
|
|
183
|
-
prefix?: string;
|
|
184
|
-
registerOnStart?: boolean;
|
|
185
|
-
guildsToRegister?: string[];
|
|
186
|
-
}
|
|
187
|
-
interface AutocompleterOptions {
|
|
188
|
-
/** Name of the Autocompleter. */
|
|
189
|
-
name: string;
|
|
190
|
-
/** Whether the Autocompleter is disabled. */
|
|
191
|
-
disabled?: boolean;
|
|
192
|
-
/** Handle the execution of the Autocompleter. */
|
|
193
|
-
execute: (client: FrameworkClient<true>, interaction: AutocompleteInteraction, command: FrameworkSlashCommand, value: string) => Promise<unknown>;
|
|
194
|
-
}
|
|
195
|
-
interface FrameworkAutocompleter {
|
|
196
|
-
id: string;
|
|
197
|
-
filepath: string;
|
|
198
|
-
name: string;
|
|
199
|
-
disabled: boolean;
|
|
200
|
-
execute: (client: FrameworkClient<true>, interaction: AutocompleteInteraction, command: FrameworkSlashCommand, value: string) => Promise<unknown>;
|
|
201
|
-
}
|
|
202
221
|
type ModalCollectorOptions = InteractionCollectorOptions<ModalSubmitInteraction>;
|
|
203
222
|
interface AwaitMemberResponseOptions extends MessageCollectorOptions {
|
|
204
223
|
deleteMessage?: boolean;
|
|
205
224
|
}
|
|
206
|
-
|
|
207
225
|
declare module 'discord.js' {
|
|
208
226
|
interface ClientEvents {
|
|
209
227
|
buttonInteraction: [interaction: ButtonInteraction];
|
|
@@ -212,15 +230,15 @@ declare module 'discord.js' {
|
|
|
212
230
|
}
|
|
213
231
|
interface Client {
|
|
214
232
|
prefix: string;
|
|
215
|
-
developers: string[];
|
|
216
|
-
autocomplete: Collection<string, FrameworkAutocompleter>;
|
|
233
|
+
developers: readonly string[];
|
|
217
234
|
aliases: Collection<string, string>;
|
|
218
235
|
commands: Collection<string, FrameworkCommand>;
|
|
219
236
|
cooldowns: Collection<string, Collection<string, number>>;
|
|
220
237
|
events: Collection<string, FrameworkListener<keyof ClientEvents>>;
|
|
221
|
-
|
|
238
|
+
autocompleters: Collection<string, FrameworkAutocompleter>;
|
|
222
239
|
commandsModule: CommandsModule;
|
|
223
|
-
|
|
240
|
+
listenersModule: ListenerModule;
|
|
241
|
+
autocompletersModule: AutocompletersModule;
|
|
224
242
|
}
|
|
225
243
|
interface Message {
|
|
226
244
|
prefix: string;
|
|
@@ -231,18 +249,52 @@ declare module 'discord.js' {
|
|
|
231
249
|
}
|
|
232
250
|
}
|
|
233
251
|
|
|
252
|
+
interface FrameworkClientOptions {
|
|
253
|
+
clientOptions: ClientOptions;
|
|
254
|
+
developers?: readonly string[];
|
|
255
|
+
prefix?: string;
|
|
256
|
+
registerOnStart?: boolean;
|
|
257
|
+
guildsToRegister?: string[];
|
|
258
|
+
rootDir?: string;
|
|
259
|
+
commandsDir?: string;
|
|
260
|
+
listenersDir?: string;
|
|
261
|
+
autocompletersDir?: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare class FrameworkClient<Ready extends boolean = boolean> extends Client<Ready> {
|
|
265
|
+
prefix: string;
|
|
266
|
+
developers: string[];
|
|
267
|
+
rootDir: string;
|
|
268
|
+
commandsDir: string;
|
|
269
|
+
listenersDir: string;
|
|
270
|
+
autocompletersDir: string;
|
|
271
|
+
private _inited;
|
|
272
|
+
autocompleters: Collection<string, FrameworkAutocompleter>;
|
|
273
|
+
events: Collection<string, FrameworkListener<keyof ClientEvents>>;
|
|
274
|
+
aliases: Collection<string, string>;
|
|
275
|
+
commands: Collection<string, FrameworkCommand>;
|
|
276
|
+
cooldowns: Collection<string, Collection<string, number>>;
|
|
277
|
+
commandsModule: CommandsModule;
|
|
278
|
+
listenersModule: ListenerModule;
|
|
279
|
+
autocompletersModule: AutocompletersModule;
|
|
280
|
+
constructor(frameworkOptions: FrameworkClientOptions);
|
|
281
|
+
init(): Promise<void>;
|
|
282
|
+
start(token: string): Promise<void>;
|
|
283
|
+
private routeInteractions;
|
|
284
|
+
}
|
|
285
|
+
|
|
234
286
|
declare function Autocompleter(options: AutocompleterOptions): {
|
|
235
287
|
id: string;
|
|
236
288
|
name: string;
|
|
237
289
|
disabled: boolean;
|
|
238
|
-
execute: (client: FrameworkClient<true>, interaction: discord_js.AutocompleteInteraction
|
|
290
|
+
execute: (client: FrameworkClient<true>, interaction: discord_js.AutocompleteInteraction<"cached">, command: FrameworkSlashCommand, value: string) => Promise<unknown> | unknown;
|
|
239
291
|
};
|
|
240
292
|
|
|
241
293
|
declare function ContextCommand(options: ContextCommandOptions): {
|
|
242
294
|
id: string;
|
|
243
295
|
name: string;
|
|
244
296
|
description: string;
|
|
245
|
-
commandType: "Slash" | "Message" | "
|
|
297
|
+
commandType: "Slash" | "Message" | "ContextMessage" | "ContextUser";
|
|
246
298
|
memberPermissions: discord_js.PermissionResolvable | undefined;
|
|
247
299
|
clientPermissions: discord_js.PermissionResolvable | undefined;
|
|
248
300
|
cooldown: number | undefined;
|
|
@@ -254,7 +306,7 @@ declare function MessageCommand(options: MessageCommandOptions): {
|
|
|
254
306
|
id: string;
|
|
255
307
|
name: string;
|
|
256
308
|
description: string;
|
|
257
|
-
commandType: "Slash" | "Message" | "
|
|
309
|
+
commandType: "Slash" | "Message" | "ContextMessage" | "ContextUser";
|
|
258
310
|
memberPermissions: discord_js.PermissionResolvable | undefined;
|
|
259
311
|
clientPermissions: discord_js.PermissionResolvable | undefined;
|
|
260
312
|
cooldown: number | undefined;
|
|
@@ -266,7 +318,7 @@ declare function SlashCommand(options: SlashCommandOptions): {
|
|
|
266
318
|
id: string;
|
|
267
319
|
name: string;
|
|
268
320
|
description: string;
|
|
269
|
-
commandType: "Slash" | "Message" | "
|
|
321
|
+
commandType: "Slash" | "Message" | "ContextMessage" | "ContextUser";
|
|
270
322
|
memberPermissions: discord_js.PermissionResolvable | undefined;
|
|
271
323
|
clientPermissions: discord_js.PermissionResolvable | undefined;
|
|
272
324
|
cooldown: number | undefined;
|
|
@@ -278,7 +330,7 @@ declare function Listener<T extends keyof ClientEvents>(options: ListenerOptions
|
|
|
278
330
|
name: T;
|
|
279
331
|
once: boolean;
|
|
280
332
|
disabled: boolean;
|
|
281
|
-
execute: (...args: ClientEvents[T]) => Promise<
|
|
333
|
+
execute: (...args: ClientEvents[T]) => Promise<unknown> | unknown;
|
|
282
334
|
};
|
|
283
335
|
|
|
284
|
-
export { Autocompleter,
|
|
336
|
+
export { Autocompleter, ContextCommand, type FrameworkAutocompleter, FrameworkClient, type FrameworkCommand, type FrameworkContextCommand, type FrameworkListener, type FrameworkMessageCommand, type FrameworkSlashCommand, Listener, MessageCommand, SlashCommand };
|