Level class

const level = new Level(client: Client, guildMember: GuildMember);

constructor

The Level class requires two arguments. The first argument must be an instance of the Discord.js Client class which represents the bot. The second argument must be an instance of the Discord.js GuildMember class which represents the member where to get the level info from.

Properties

xp

A number which represents the amount of XP the member has in the level system.

level

A number which represents the level the member has in the level system.

messages

A number which represents the amount of messages the member has sent when the bot was online.

Functions

setXP

level.setXP(amount: number) : Promise<Level>;

Changes the amount of XP the member has. It automatically updates the level of the member if necessary. The function returns a Promise which returns an instance of the Level class with the updated data.

ArgumentDescription

amount

A number which represents the new amount of XP the member should have.

setLevel

level.setLevel(amount: number) : Promise<Level>;

Changes the level the member has. It automatically updates the amount of XP of the member if necessary to the required amount for this level. The function returns a Promise which returns an instance of the Level class with the updated data.

ArgumentDescription

amount

A number which represents the new level the member should have.

Last updated