UNPKG

commandbot

Version:

A framework that helps you create your own Discord bot easier.

74 lines (73 loc) 2.28 kB
import { Guild } from "discord.js"; import { CommandManager } from "./CommandManager.js"; /** * Prefix scope types * @type */ export declare type ScopeResolvable = string | Guild; /** * Maps server IDs with command prefixes and allows to manage them * @class * @experimental This feature should be fully functional but it doesn't store its data in any kind of local storage or cache. All informations get lost after restarting the application. It is possible to create a store for that data (exporting to a file or in some kind of database) and then load it every time the application starts. */ export declare class PrefixManager { /** * Prefixes data * @type {Map<string, string>} * @private * @readonly */ private readonly _prefixes; /** * Global scope identifier * @type {string} * @private * @readonly */ private readonly _global; /** * Command manager associated with the object * @type {CommandManager} * @public * @readonly */ readonly manager: CommandManager; /** * @constructor * @param manager - manager attached to this object * @param {?string} [defaultPrefix] - default global prefix */ constructor(manager: CommandManager, defaultPrefix?: string); /** * Manager global prefix * @type {?string} */ get globalPrefix(): string | null; /** * Manager data * @type {Readonly<Map<string, string>>} */ get prefixes(): any; /** * Get prefix for a specified scope * @param {ScopeResolvable} scope - guild object or ID * @returns {?string} a prefix used in given scope * @public */ get(scope?: ScopeResolvable): string | null; /** * Set prefix for a specific scope * @param {string} prefix - new prefix * @param {?ScopeResolvable} [scope] - guild string or ID * @return {void} * @public */ set(prefix: string, scope?: ScopeResolvable): void; /** * Remove prefix for the specified scope * @param {?ScopeResolvable} [scope] - guild string or ID * @return {boolean} * @public */ remove(scope?: ScopeResolvable): boolean; }