BotKit by Fedify :botkit:'s avatar
BotKit by Fedify :botkit:

@botkit@hollo.social

We're excited to introduce emoji reactions in the upcoming 0.2.0 release!

With the new Message.react() method, your bot can now react to messages using standard Unicode :

await message.react(emoji`👍`);

support is also included, allowing your bot to react with server-specific emojis:

const emojis = bot.addCustomEmojis({
  // Use a remote image URL:
  yesBlob: {
    url: "https://cdn3.emoji.gg/emojis/68238-yesblob.png",
    mediaType: "image/png",
  },
  // Use a local image file:
  noBlob: {
    file: `${import.meta.dirname}/emojis/no_blob.png`,
    mediaType: "image/webp",
  },
});

await message.react(emojis.yesBlob);

Reactions can be removed using the AuthorizedReaction.unreact() method:

const reaction = await message.react(emoji`❤️`);
await reaction.unreact();

Want to try these features now? You can install the development version from JSR today:

deno add jsr:@fedify/botkit@0.2.0-dev.84+c997c6a6

We're looking forward to seeing how your bots express themselves with this new feature!

BotKit by Fedify :botkit:'s avatar
BotKit by Fedify :botkit:

@botkit@hollo.social · Reply to BotKit by Fedify :botkit:'s post

Continuing our emoji reaction feature announcement, we're also introducing two new event handlers—Bot.onReact and Bot.onUnreact—that let your bot respond when users react to posts:

// When someone adds an emoji reaction to a post
bot.onReact = async (session, reaction) => {
  // Only respond when the reaction is to your bot's post
  if (reaction.message.actor.id?.href === session.actorId.href) {
    console.log(`${reaction.actor.preferredUsername} reacted with ${reaction.emoji}`);
    
    // You can respond differently based on the emoji
    if (reaction.emoji === "❤️") {
      await session.publish(
        text`Thanks for the love, ${reaction.actor}!`,
        { visibility: "direct" }
      );
    }
  }
};
// When someone removes their emoji reaction
bot.onUnreact = async (session, reaction) => {
  if (reaction.message.actor.id?.href === session.actorId.href) {
    console.log(`${reaction.actor.preferredUsername} removed their ${reaction.emoji} reaction`);
    
    // Optional: respond to reaction removal
    await session.publish(
      text`I noticed you removed your ${reaction.emoji} reaction, ${reaction.actor}.`,
      { visibility: "direct" }
    );
  }
};

These event handlers open up interesting interaction possibilities—your bot can now track popular reactions, respond to specific emoji feedback, or create interactive experiences based on reactions.

Want to try these features now? You can install the development version from JSR today:

deno add jsr:@fedify/botkit@0.2.0-dev.86+cdbb52a2

The full documentation for these features will be available when BotKit 0.2.0 is officially released!