Skip to content

Class: Bot

Hierarchy

  • Client

Bot

Constructors

constructor

new Bot(options?)

Creates a new bot

Parameters

Name Type Description
options BotOptions Options for your bot

Overrides

Client.constructor

Properties

owners

owners: string[]

The owner(s) of this bot


db

db: Keyv<any>

A keyv instance for quick key-value storage


modules

modules: Module[]

The currently loaded modules


commands

commands: CommandManager

Manages this bot's commands

Methods

login

login(token): Promise<string>

Logs in to discord

Parameters

Name Type Description
token string Your bot token

Returns

Promise<string>

The bot token you logged in with

Example

const bot = new Bot({ intents: 513 });
await bot.login('TOTALLYMYTOKEN')

Overrides

Client.login


connect

connect(token): Promise<Bot>

Client.login: chainable edition

Parameters

Name Type Description
token string Your bot token

Returns

Promise<Bot>

The bot this was called on

Example

const bot = await new Bot({ intents: 513 }).connect('ABSOLUTELYMYTOKEN');

_onInteractionCreate

_onInteractionCreate(interaction): Promise<any>

The default command handler. You'll need to call this if you want your own code to run for interactions, but you also want the default handling.

Parameters

Name Type Description
interaction Interaction<"cached"> The interaction to be handled

Returns

Promise<any>

The return value of the command's .function

Example

bot.on('interactionCreate', interaction => {
  console.log(interaction);
  bot._onInteractionCreate(interaction);
});
Back to top