@sern/handler
Version:
A complete, customizable, typesafe, & reactive framework for discord bots.
140 lines • 4.65 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SernError = exports.PayloadType = exports.PluginType = exports.EventType = exports.CommandType = void 0;
/**
* @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)
* }
* })
* ```
*/
var CommandType;
(function (CommandType) {
CommandType[CommandType["Text"] = 1] = "Text";
CommandType[CommandType["Slash"] = 2] = "Slash";
CommandType[CommandType["Both"] = 3] = "Both";
CommandType[CommandType["CtxUser"] = 4] = "CtxUser";
CommandType[CommandType["CtxMsg"] = 8] = "CtxMsg";
CommandType[CommandType["Button"] = 16] = "Button";
CommandType[CommandType["StringSelect"] = 32] = "StringSelect";
CommandType[CommandType["Modal"] = 64] = "Modal";
CommandType[CommandType["UserSelect"] = 128] = "UserSelect";
CommandType[CommandType["RoleSelect"] = 256] = "RoleSelect";
CommandType[CommandType["MentionableSelect"] = 512] = "MentionableSelect";
CommandType[CommandType["ChannelSelect"] = 1024] = "ChannelSelect";
})(CommandType = exports.CommandType || (exports.CommandType = {}));
/**
* 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)
* }
* })
* ```
*/
var EventType;
(function (EventType) {
/**
* The EventType for handling discord events
*/
EventType[EventType["Discord"] = 0] = "Discord";
/**
* The EventType for handling sern events
*/
EventType[EventType["Sern"] = 1] = "Sern";
/**
* The EventType for handling external events.
* Could be for example, `process` events, database events
*/
EventType[EventType["External"] = 2] = "External";
})(EventType = exports.EventType || (exports.EventType = {}));
/**
* 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();
* }
* }
* ```
*/
var PluginType;
(function (PluginType) {
/**
* The PluginType for InitPlugins
*/
PluginType[PluginType["Init"] = 1] = "Init";
/**
* The PluginType for EventPlugins
*/
PluginType[PluginType["Control"] = 2] = "Control";
})(PluginType = exports.PluginType || (exports.PluginType = {}));
/**
* @deprecated - Use strings 'success' | 'failure' | 'warning'
* @enum { string }
*/
var PayloadType;
(function (PayloadType) {
PayloadType["Success"] = "success";
PayloadType["Failure"] = "failure";
PayloadType["Warning"] = "warning";
})(PayloadType = exports.PayloadType || (exports.PayloadType = {}));
/**
* @enum { string }
*/
var SernError;
(function (SernError) {
/**
* Throws when registering an invalid module.
* This means it is undefined or an invalid command type was provided
*/
SernError["InvalidModuleType"] = "Detected an unknown module type";
/**
* Attempted to lookup module in command module store. Nothing was found!
*/
SernError["UndefinedModule"] = "A module could not be detected";
/**
* Attempted to lookup module in command module store. Nothing was found!
*/
SernError["MismatchModule"] = "A module type mismatched with event emitted!";
/**
* Unsupported interaction at this moment.
*/
SernError["NotSupportedInteraction"] = "This interaction is not supported.";
/**
* One plugin called `controller.stop()` (end command execution / loading)
*/
SernError["PluginFailure"] = "A plugin failed to call controller.next()";
/**
* A crash that occurs when accessing an invalid property of Context
*/
SernError["MismatchEvent"] = "You cannot use message when an interaction fired or vice versa";
/**
* Unsupported feature attempted to access at this time
*/
SernError["NotSupportedYet"] = "This feature is not supported yet";
/**
* Required Dependency not found
*/
SernError["MissingRequired"] = "@sern/client is required but was not found";
})(SernError = exports.SernError || (exports.SernError = {}));
//# sourceMappingURL=enums.js.map