🎒
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

Was this helpful?

Reactions

They're great to add a bit of personality to messages and are easy to deal with!

Sometimes you want to add a bit of a touch of personality, or even interactiveness with the user when responding to a message. Reactions are there for you! You can add any reaction you want to a message, for example, using interaction commands, you can do it this way:

client.on("interactionCreate", async interaction => {
    if (!(interaction instanceof CommandInteraction)) return;
    if (interaction.data.name === "hi") {
        const message = await interaction.createMessage({ content: "Hi!" });
        await message.createReaction(90001206) // wave emoji;
    }
});

As easy as it sounds like, right?

But! If you have a message and want to remove a reaction from it, you can do it this way

// We assume that you have a declared "message" constant in this scope
await message.deleteReaction(90001206) // removes the wave emoji;

Though, this only deletes the wave emoji that has been added by your app.

If you want to target a specific user and remove their reaction, you'll have to pass their user ID in method arguments.

// We assume that you have a declared "message" constant in this scope
await message.deleteReaction(90001206, "their user id") // removes the wave emoji;

Like this :)

Overall, it is pretty easy to put and remove any reaction from a message! You can still do it manually by using REST, if you miss some information: not having a message instance.

By either, getting the message through REST with:

client.rest.channels.getMessage(channelID, messageID);

and then performing your action on it, or, just performing it directly through REST:

client.rest.channels.createReaction(
channelID, 
channelType, 
targetID,
reaction
);
client.rest.channels.deleteReaction(
channelID, 
channelType, 
targetID,
reaction, 
targetUserID? (optional)
);
PreviousPermissions & RolesNextData & Analytics

Last updated 4 months ago

Was this helpful?

😰