Bot class
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
Updates the activity of the bot and returns a Promise
which gets fulfilled once the activity of the bot has been updated.
Argument | Description |
---|---|
activity | A string which represents the activity of the bot. |
setActivityType
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.
Argument | Description |
---|---|
activityType | A string which defines the activity type of the bot. Possible activity types are: |
setStreamingURL
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.
Argument | Description |
---|---|
streamURL | The url of the stream which should be shown in the activity status of the bot. This must be a YouTube or Twitch url. |
setStatusType
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.
Argument | Description |
---|---|
statusType | A string which defines the status type of the bot. Possible status types are: |
setUsername
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.
Argument | Description |
---|---|
username | The new username for the bot. The value must be a string. |
setAvatar
Changes the avatar of the bot. The function returns a Promise
which gets fulfilled once the avatar of the bot has been changed.
Argument | Description |
---|---|
avatar | A url of the image, the path of the image or an instance of the NodeJS built-in Buffer class which defines the avatar you want to give the bot. |
Last updated