UNPKG

@sern/handler

Version:

A complete, customizable, typesafe, & reactive framework for discord bots.

132 lines (131 loc) 3.25 kB
/** * @since 1.0.0 * A bitfield that discriminates command modules * @enum { number } * @example * ```ts * export default commandModule({ * // highlight-next-line * type : CommandType.Text, * name : 'a text command' * execute(message) { * console.log(message.content) * } * }) * ``` */ export declare enum CommandType { Text = 1, Slash = 2, Both = 3, CtxUser = 4, CtxMsg = 8, Button = 16, StringSelect = 32, Modal = 64, UserSelect = 128, RoleSelect = 256, MentionableSelect = 512, ChannelSelect = 1024 } /** * A bitfield that discriminates event modules * @enum { number } * @example * ```ts * export default eventModule({ * //highlight-next-line * type : EventType.Discord, * name : 'guildMemberAdd' * execute(member : GuildMember) { * console.log(member) * } * }) * ``` */ export declare enum EventType { /** * The EventType for handling discord events */ Discord = 0, /** * The EventType for handling sern events */ Sern = 1, /** * The EventType for handling external events. * Could be for example, `process` events, database events */ External = 2 } /** * A bitfield that discriminates plugins * @enum { number } * @example * ```ts * export default function myPlugin() : EventPlugin<CommandType.Text> { * //highlight-next-line * type : PluginType.Event, * execute([ctx, args], controller) { * return controller.next(); * } * } * ``` */ export declare enum PluginType { /** * The PluginType for InitPlugins */ Init = 1, /** * The PluginType for EventPlugins */ Control = 2 } /** * @deprecated - Use strings 'success' | 'failure' | 'warning' * @enum { string } */ export declare enum PayloadType { Success = "success", Failure = "failure", Warning = "warning" } /** * @enum { string } */ export declare const enum SernError { /** * Throws when registering an invalid module. * This means it is undefined or an invalid command type was provided */ InvalidModuleType = "Detected an unknown module type", /** * Attempted to lookup module in command module store. Nothing was found! */ UndefinedModule = "A module could not be detected", /** * Attempted to lookup module in command module store. Nothing was found! */ MismatchModule = "A module type mismatched with event emitted!", /** * Unsupported interaction at this moment. */ NotSupportedInteraction = "This interaction is not supported.", /** * One plugin called `controller.stop()` (end command execution / loading) */ PluginFailure = "A plugin failed to call controller.next()", /** * A crash that occurs when accessing an invalid property of Context */ MismatchEvent = "You cannot use message when an interaction fired or vice versa", /** * Unsupported feature attempted to access at this time */ NotSupportedYet = "This feature is not supported yet", /** * Required Dependency not found */ MissingRequired = "@sern/client is required but was not found" }