Archived
JSDoc
This commit is contained in:
1 parent
6edbfbdb88
commit
6489edb253
8 files changed
+404
-54
No files matched your search
+44
-12
@@ -16,27 +16,57 @@ export declare interface Bot {
|
||||
on(event: "ERROR", listener: (e: any) => void): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class Class that represents your bot instance
|
||||
* @extends {EventEmitter}
|
||||
* @exports
|
||||
*/
|
||||
export class Bot extends EventEmitter {
|
||||
/**
|
||||
* Bot name
|
||||
* @type {string}
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Discord.js {@link Client} instance
|
||||
* @type {Client}
|
||||
*/
|
||||
client: Client;
|
||||
/**
|
||||
* Instance command manager
|
||||
* @type {CommandManager}
|
||||
*/
|
||||
commands: CommandManager;
|
||||
/**
|
||||
* Discord bot token
|
||||
* @type {string}
|
||||
*/
|
||||
token: string;
|
||||
/**
|
||||
* Discord API application ID
|
||||
* @type {string}
|
||||
*/
|
||||
applicationId: string;
|
||||
/**
|
||||
* Built-in messages configuration
|
||||
* @type {Object}
|
||||
*/
|
||||
messages: {
|
||||
/**
|
||||
* Help message configuration
|
||||
* @type {HelpMessageParams}
|
||||
*/
|
||||
help: HelpMessageParams;
|
||||
/**
|
||||
* {@link SystemMessageManager} storing messages' configuration
|
||||
* @type {SystemMessageManager}
|
||||
*/
|
||||
system: SystemMessageManager;
|
||||
};
|
||||
|
||||
/**
|
||||
* Bot instance initializer
|
||||
* @constructor
|
||||
* @param {InitOptions} options - instance properties
|
||||
* @param {string} options.name - name of your bot
|
||||
* @param {string} [options.prefix] - prefix used to call commands (if undefined, only slash commands will be available)
|
||||
* @param {string} [options.parameterSeparator=','] - used to get parameters from message (only prefix interactions)
|
||||
* @param {ClientOptions} [options.clientOptions] - client options from Discord.js
|
||||
* @param {string} options.token - bot token from Discord Developer Portal
|
||||
* @param {string} options.applicationId - Discord application ID used to register slash commands
|
||||
* @param {InitOptions} options - instance properties ({@link InitOptions})
|
||||
*/
|
||||
constructor(options: InitOptions) {
|
||||
super();
|
||||
@@ -80,10 +110,11 @@ export class Bot extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
* Starts your Discord bot
|
||||
* @param {number} [port] - if specified, the app will create a http server that will be listening on the specified port
|
||||
* @param {boolean} [register] - if true or undefined, the bot will register all slash commands in Discord API
|
||||
* @returns *Promise<boolean>*
|
||||
* @param {boolean} [register=true] - if *true* or *undefined*, the bot will register all slash commands in Discord API
|
||||
* @returns {Promise<boolean>} whether this operation has been completed successfully
|
||||
*/
|
||||
async start(port?: number, register?: boolean): Promise<boolean> {
|
||||
try {
|
||||
@@ -208,8 +239,9 @@ export class Bot extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers commands from instance CommandManager in Discord API
|
||||
* @returns *Promise<void>*
|
||||
* @method
|
||||
* Registers commands from {@link CommandManager} in Discord API
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async register(): Promise<void> {
|
||||
process.stdout.write("Registering commands... ");
|
||||
|
||||
Reference in new issue
Block a user