
@botkit@hollo.social

ALT text details
Automatically liking mentions
It is simple to automatically like mentions of your bot. You can use the onMention event handler and the Message.like() method together:
bot.onMention = async (session, message) => {
await message.like();
};
ALT text details
Liking a message
You can like a message by calling the like() method:
const message = await session.publish(
text`This message will be liked.`
);
await message.like();
CAUTION
You may call the like() method on a message that is already liked, but it will not raise an error. Under the hood, such a call actually sends multiple Like activities to the fediverse, whose behavior is undefined—some servers may ignore the duplicated activities, some servers may allow them and count them as multiple likes.
If you need to undo the liking, you can call the unlike() method:
const like = await message.like();
await like.unlike();