Member class
The Member class extends the Zyno Bot Addons User class.
constructor
The constructor of the Member class requires two arguments. The first argument must be an instance of the Discord.js GuildMember class and provides the data of the member. The second argument must be an instance of the Zyno Bot Addons Addon class and defines the addon where the member class should be created for.
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.
guild
An instance of the Guild class and defines the guild the member is active in.
guildId
The id of the guild the member is active in.
roles
An instance of the Save class and provides the roles the member has.
Save<roleId, Role>
nickname
The nickname that has been set for the member in the guild. If no nickname has been set, this will result in a value of null
.
displayName
The name that is visible in the guild for this member. If a nickname is set, this will be their nickname. Otherwise this will be their username.
permissions
An instance of the Discord.js PermissionsBitField class which provides which permissions the member has.
color
An object which provides the color codes of the color of the highest role the member has.
joined
An instance of the built-in NodeJS Date class which represents the time the member joined the Discord server.
joinedTimestamp
A number which represents the timestamp of the time when the member joined the Discord server.
manageable
A boolean which defines whether the bot is higher in terms of hierarchy according to the role position and ownership of the Discord server.
moderatable
A boolean which defines wheter the bot can moderate the member or not.
bannable
A boolean which defines whether the member can be banned or not.
kickable
A boolean which defines whether the member can be kicked or not.
voiceConnected
A boolean which defines whether the member is currently connected to a voice channel or not.
voice
An instance of the VoiceState class which defines the current voice state of the member.
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.
getInviteInfo
Provides the information about the amount of members the member has invited, how many have left and by whom the member was invited. The function will return the following object:
getWarns
Gets the warns the member has received in the guild. The function returns an array which includes objects which represent the warn.
getTickets
Gets the open tickets of the member in the guild. The funcntion returns an instance of the Save class which provides the ticket channels.
Save<channelId, TextChannel>
getEconomy
Gets the economy balance of the member. The function returns an instance of the EconomyBalance class where it's possible to view and edit the balances.
getLevel
Gets the level information of the member. The function returns an instance of the Level class where it's possible to view and edit level statistics of the member.
setTimeout
Gives the member a timeout for a certain amount of time. The function returns a Promise
which returns an instannce of the Member class with the updated data once the timeout has been given.
Argument | Description |
---|---|
dateResolvable | The duration of the timeout the member receives. This must be a number which defines the time in miliseconds, an instance of the Date class where the timestamp gets substracted of the current timestamp and the difference is used as the slow mode time or a string which defines the time like |
reason | The reason you want to give the member a timeout. This must be a string between 1-512 characters, but is not required. |
removeTimeout
Removes the timeout of the member if the member has a timeout. The function returns a Promise
which returns an instance of the Member class with the updated data once the timeout has been removed.
Argument | Description |
---|---|
reason | The reason you want to remove the member a timeout. This must be a string between 1-512 characters, but is not required. |
hasTimeout
Returns a boolean which defines whether the member has a timeout or not.
timeoutUntil
Returns a number which represents the timestamp of the time when the timeout of a member ends. If the member doesn't have a timeout, the function will return a value of null
.
kick
Kicks the member from the guild. The function returns a Promise
which returns an instance of the Member class with the updated data of the member once the member has been kicked.
Argument | Description |
---|---|
reason | The reason you want to kick the member. This must be a string between 1-512 characters, but is not required. |
ban
Bans the member from the guild. The function returns a Promise
which returns an instance of the Member class with the updated data of the member once the member has been banned.
Argument | Description |
---|---|
options | An object which provides the ban information. |
The options object may contain the following information:
reason
: The reason you want to ban the member. This must be a string between 1-512 characters.deleteMessages
: The time frame where the messages sent by the member should be deleted. The max time frame is 1 week. This must be a number which defines the time in miliseconds, an instance of the Date class where the timestamp gets substracted of the current timestamp and the difference is used as the slow mode time or a string which defines the time like1 hour
.
update
Updates the member in case changes have been made to it. The function returns a Promise
which returns an instance of the Member class with the updated data once the member has been updated.
addRole
Adds a role or multiple roles to the member. The function returns a Promise
which returns an instance of the Member class with the updated data once the roles have been given to the member.
Argument | Description |
---|---|
role | A string which represents a role id, instance of the Role class or an array with a string which represents a role id or an instance of the Role class which represents the role(s) the member should receive. |
reason | The reason you want to give the member this role(s). This must be a string between 1-512 characters, but is not required. |
removeRole
Removes a role or multiple roles from the member. The function returns a Promise
which returns an instance of the Member class with the updated data once the roles have been removed from the member.
Argument | Description |
---|---|
role | A string which represents a role id, instance of the Role class or an array with a string which represents a role id or an instance of the Role class which represents the role(s) which should be removed from the member. |
reason | The reason you want to remove this role(s) from the member. This must be a string between 1-512 characters, but is not required. |
setRole
Removes all the member's roles and adds a role or multiple roles to the member. The function returns a Promise
which returns an instance of the Member class with the updated data once the roles of the member have been overwritten.
Argument | Description |
---|---|
role | A string which represents a role id, instance of the Role class or an array with a string which represents a role id or an instance of the Role class which represents the role(s) the member should have. |
reason | The reason you want to overwrite the member's role(s). This must be a string between 1-512 characters, but is not required. |
isBannable
Returns a boolean which defines whether the member can be banned or not.
isKickable
Returns a boolean which defines whether the member can be kicked or not.
isMutable
Returns a boolean which defines whether the member can be muted or not.
Last updated