User class
constructor
The User class provides two required arguments. The first is a Discord.js user which is an instance of the User class. The second argument is the addon where to create the user for and has to be an instance of the Addon class. The third argument is a boolean which defines if the User class already reached a loop or not. If this is not the case, the User class will cache the User so you will be able to get the information later back.
Properties
id
The id of the user and is a Twitter snowflake.
string
Returns the user mention as a string.
username
The username of the user.
tag
The username with their discriminator. Only available for users who haven't changed their username yet. Otherwise their tag will be their username with the discriminator 0
.
discriminator
The number behind the tag of the user. Only available for users who haven't changed their username yet. Otherwise this will return the character 0
.
created
An instance of the default Date class which defines the time when the user was created.
createdTimestamp
A number which represents the timestamp of when the user was created.
bot
A boolean which defines whether the user is a bot or not.
system
A boolean which defines whether the user is the Discord system or not.
addon
The Addon class of the addon which is using the User class.
bitfield
The permissions the addon has as a bitfield number which is using the User class.
Functions
avatarURL
Returns the url of the avatar of the user based on the image options which were provided.
Argument | Description |
---|---|
options | An object of image options which includes the criteria the avatar url has to meet. |
The image options object may contain the following information:
dynamic
: A boolean which defines whether the avatar image should be dynamic if possible or not.size
: A number which defines the size of the image. The size number must be a valid result of the mention math formula below with0 <= x <= 8
.extension
: The file extension of the image. Valid extensions arepng
,jpeg
,jpg
,webp
andgif
.
bannerURL
Returns the url of the banner of the user based on the image options which were provided.
Argument | Description |
---|---|
options | An object of image options which includes the criteria the banner url has to meet. |
The image options object may contain the following information:
dynamic
: A boolean which defines whether the banner image should be dynamic if possible or not.size
: A number which defines the size of the image. The size number must be a valid result of the mention math formula below with0 <= x <= 8
.extension
: The file extension of the image. Valid extensions arepng
,jpeg
,jpg
,webp
andgif
.
update
Updates the information of the user manually if the user changed something about themselves, like their username for example. The function returns a Promise
which will return the User class once it's fulfilled.
sendDM
Sends a DM to the user. The function returns a Promise
which returns an instance of the Message class when the DM message has been sent to the user.
Argument | Description |
---|---|
content | The content of the message the bot should send. The content must be a string, an Embed class, the ActionRowBuilder class, the ButtonBuilder class, the SelectMenuBuilder class or an object which provides the message its content. |
The object of the message may contain the following information:
content
: A string of the content of the message.embeds
: An array with the Embed class.files
: An array with a string which represents a file url or an object when uploading a file.components
: An array with the Discord.js ActionRowBuilder class.
The file object data may contain the following information:
name
: The name of the file you want to uploadattachment
: The path of the file you want to uploaddescription
: The description of the file
getDMChannel
Gets the DM channel where you can interact with the user. The function returns a Promise
which returns the DMChannel class once it's fulfilled.
getMembers
Returns a Save class which has all the Member classes of the user. It only shows the classes of the Member of the guilds the member and bot have in common.
Last updated