π―Award experience to server members
Awarding a member or a role through the built-in Guilded EXP system.
Award a specific member
// Detect when an interaction is created.
client.on('interactionCreate', async interaction => {
if (interaction instanceof CommandInteraction) {
const member = await interaction.member;
// Award the author of the message 1000 EXP.
// The amount of EXP is limited to 1000.
await member?.award(1000);
// OR
await client.rest.guilds.awardMember(interaction.guildID, member?.id, 1000);
}
})Award multiple members
// Detect when an interaction is created.
client.on('interactionCreate', async interaction => {
if (interaction instanceof CommandInteraction) {
const member = await interaction.member;
// Award 2 members of the guild 1000 EXP.
// The amount of EXP is limited to 1000.
(await interaction.guild)?.bulkAwardXP({
amount: 1000,
userIDs: ["dOW30kPd", "ArbX9wnA"]
});
// OR
(await client.rest.guilds)?.bulkAwardXP(interaction.guildID, {
amount: 1000,
userIDs: ["dOW30kPd", "ArbX9wnA"]
});
}
})Award a specific role
Set the XP of a specific member
Last updated
Was this helpful?