Bot class

const bot = new Bot(addon: Addon);

constructor

The constructor of the Bot class requires one argument, which is the Addon class of the addon where to create the bot for.

Properties

username

The username of the bot.

id

The user id of the bot and is a Twitter snowflake.

avatarURL

The url of the avatar of the bot.

tag

The username of the bot including the discriminator.

created

An instance of the NodeJS built-in Date class which represents the date when the bot was created.

createdTimestamp

A number which represents the timestamp of the date when the bot was created.

Functions

setActivity

bot.setActivity(activity: string) : Promise<void>;

Updates the activity of the bot and returns a Promise which gets fulfilled once the activity of the bot has been updated.

setActivityType

bot.setActivityType(activityType: string) : Promise<void>;

Updates the activity type of the bot. This will decide whether the bot is 'Playing' or 'Watching' the activity for example. The function returns a Promise which gets fulfilled once the activity type of the bot has been updated.

setStreamingURL

bot.setStreamingURL(streamURL: string) : Promise<void>;

Sets a streaming url for the activity of the bot. This will show the users which stream the bot is streaming. This must be a YouTube or Twitch stream. Other streams won't be allowed by the Discord API. To add a streaming url, it is required to set the activity type to streaming using the setActivityType function. The function returns a Promise which gets fulfilled once the stream url has been changed.

setStatusType

bot.setStatusType(statusType: string) : Promise<void>;

Changes the status of the bot and shows whether the bot is online or idle for example. The function returns a Promise which gets fulfilled once the status type has been changed.

setUsername

bot.setUsername(username: string) : Promise<void>;

Changes the username of the bot. The function returns a Promise which gets fulfilled once the username of the bot has been changed. Changing the username may also change the discriminator of the bot.

setAvatar

bot.setAvatar(avatar: string | Buffer) : Promise<void>;

Changes the avatar of the bot. The function returns a Promise which gets fulfilled once the avatar of the bot has been changed.

Last updated