🎒
TouchGuild Guide
Get back Home
  • TouchGuild's Docs
  • Introduction
  • Privacy Policy
  • 📝Installation & Preparation
  • âš’ī¸Setting up an application
  • 🤖Creating your application
  • Intents
  • Application Commands
    • Registering
    • Command Interactions
    • Components
  • đŸ“ŦManaging messages
    • â„šī¸Tips
    • Original Message concept & how it works
    • Creating embeds
  • Permissions & Roles
  • 😰Reactions
  • Data & Analytics
  • Managing members
    • đŸ’¯Award experience to server members
    • đŸĻĩBan, unban & kick server members
Powered by GitBook
On this page
  • Award a specific member
  • Award multiple members
  • Award a specific role
  • Set the XP of a specific member

Was this helpful?

  1. Managing members

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

// Detect when an interaction is created.
client.on('interactionCreate', async interaction => {
    if (interaction instanceof CommandInteraction) {
        const member = await interaction.member;
        const roleID = 35447832; // constant: your role ID that you want to award.
    
        // Award the role that is declared as roleID.
        await client.rest.guilds.awardRole(interaction.guildID, roleID, 1000);
    }
})

Set the XP of a specific member

// Detect when an interaction is created.
client.on('interactionCreate', async interaction => {
    const member = await interaction.member;
    // Set the EXP of the author to 1000000000.
    // The amount of EXP is limited to 1000000000 (Guilded API limitations).
    await message.guild.setMemberXP(interaction.memberID, 1000000000);
})
PreviousData & AnalyticsNextBan, unban & kick server members

Last updated 7 months ago

Was this helpful?

đŸ’¯