To add ranks and achievements, you need to do it from the Guild where you want to add them. To do this, you need to obtain your Guild from the cache, like this:
const guild = levelManager.guilds.cache.get('GUILD_ID');
Once you have obtained the Guild, you can add ranks and achievements to the Guild using the appendRank
and appendAchievement
methods, respectively.
guild.appendRank('RANK');
guild.appendAchievement('ACHIEVEMENT');
Each of these methods returns a promise, so you can use await to wait
for them to resolve.
await guild.appendRank('RANK');
await guild.appendAchievement('ACHIEVEMENT');
It's important to know that ranks and achievements are stored in each individual Guild, so if you want to add an achievement to all Guilds, you will need to do it in each one of them, as they are independent.
Each of these methods requires an object of type RankBuilder
and AchievementBuilder
, respectively.
const rank = new RankBuilder()
.setNameplate('Bronze')
.setColor('#CD7F32')
.setPriority(1)
.setMin(1)
.setMax(10)
const achievement = new AchievementBuilder()
.setName('First Message')
.setDescription("You've sent your first message!")
.setThumbnail('https://i.imgur.com/0X2uqfT.png')
.setReward(10)
.setType(AchievementType.OneTime)
.setProgress([0, 1])
await guild.appendRank(rank);
await guild.appendAchievement(achievement);