UNPKG

larakazagumo

Version:

A shoukaku wrapper with built-in queue support.

87 lines (86 loc) 3.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VoiceState = exports.KazagumoError = exports.KazagumoPlugin = exports.PlayerState = exports.State = exports.SupportedSources = exports.Events = exports.SourceIDs = exports.escapeRegExp = void 0; const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); exports.escapeRegExp = escapeRegExp; exports.SourceIDs = { youtube: 'yt', youtube_music: 'ytm', soundcloud: 'sc', }; exports.Events = { // Player events PlayerDestroy: 'playerDestroy', PlayerCreate: 'playerCreate', PlayerStart: 'playerStart', PlayerEnd: 'playerEnd', PlayerEmpty: 'playerEmpty', PlayerClosed: 'playerClosed', PlayerUpdate: 'playerUpdate', PlayerException: 'playerException', PlayerError: 'playerError', PlayerResumed: 'playerResumed', PlayerStuck: 'playerStuck', PlayerResolveError: 'playerResolveError', PlayerMoved: 'playerMoved', QueueUpdate: 'queueUpdate', // Kazagumo events Debug: 'debug', }; exports.SupportedSources = [ 'bandcamp', 'beam', 'getyarn', 'http', 'local', 'nico', 'soundcloud', 'stream', 'twitch', 'vimeo', 'youtube', 'spotify', ]; var State; (function (State) { State[State["CONNECTING"] = 0] = "CONNECTING"; State[State["NEARLY"] = 1] = "NEARLY"; State[State["CONNECTED"] = 2] = "CONNECTED"; State[State["RECONNECTING"] = 3] = "RECONNECTING"; State[State["DISCONNECTING"] = 4] = "DISCONNECTING"; State[State["DISCONNECTED"] = 5] = "DISCONNECTED"; })(State || (exports.State = State = {})); var PlayerState; (function (PlayerState) { PlayerState[PlayerState["CONNECTING"] = 0] = "CONNECTING"; PlayerState[PlayerState["CONNECTED"] = 1] = "CONNECTED"; PlayerState[PlayerState["DISCONNECTING"] = 2] = "DISCONNECTING"; PlayerState[PlayerState["DISCONNECTED"] = 3] = "DISCONNECTED"; PlayerState[PlayerState["DESTROYING"] = 4] = "DESTROYING"; PlayerState[PlayerState["DESTROYED"] = 5] = "DESTROYED"; })(PlayerState || (exports.PlayerState = PlayerState = {})); class KazagumoPlugin { load(kazagumo) { throw new KazagumoError(1, 'Plugin must implement load()'); } unload(kazagumo) { throw new KazagumoError(1, 'Plugin must implement unload()'); } } exports.KazagumoPlugin = KazagumoPlugin; /* tslint:disable:max-classes-per-file */ class KazagumoError extends Error { constructor(code, message) { super(message); this.code = code; this.message = message; } } exports.KazagumoError = KazagumoError; var VoiceState; (function (VoiceState) { VoiceState[VoiceState["SESSION_READY"] = 0] = "SESSION_READY"; VoiceState[VoiceState["SESSION_ID_MISSING"] = 1] = "SESSION_ID_MISSING"; VoiceState[VoiceState["SESSION_ENDPOINT_MISSING"] = 2] = "SESSION_ENDPOINT_MISSING"; VoiceState[VoiceState["SESSION_FAILED_UPDATE"] = 3] = "SESSION_FAILED_UPDATE"; })(VoiceState || (exports.VoiceState = VoiceState = {}));