/**
* vibe react β Quick emoji reactions
*
* "react fire to stan" β sends π₯
*/
const { requireInit, normalizeHandle } = require('./_shared');
const config = require('../config');
const store = require('../store');
const patterns = require('../intelligence/patterns');
const REACTIONS = {
fire: 'π₯',
'π₯': 'π₯',
heart: 'β€οΈ',
love: 'β€οΈ',
'β€οΈ': 'β€οΈ',
eyes: 'π',
'π': 'π',
clap: 'π',
'π': 'π',
rocket: 'π',
'π': 'π',
ship: 'π’',
'π’': 'π’',
100: 'π―',
hundred: 'π―',
'π―': 'π―',
thinking: 'π€',
'π€': 'π€',
laugh: 'π',
lol: 'π',
'π': 'π',
cool: 'π',
'π': 'π',
wave: 'π',
'π': 'π',
thumbsup: 'π',
yes: 'π',
'+1': 'π',
'π': 'π',
party: 'π',
'π': 'π',
fist: 'π€',
bump: 'π€',
'π€': 'π€',
brain: 'π§ ',
'π§ ': 'π§ ',
chef: 'π¨βπ³',
chefkiss: 'π€',
'π€': 'π€'
};
const definition = {
name: 'vibe_react',
description: 'Send a quick emoji reaction. Fire, heart, eyes, clap, rocket, party, etc.',
inputSchema: {
type: 'object',
properties: {
handle: {
type: 'string',
description: 'Who to react to (e.g., @stan)'
},
reaction: {
type: 'string',
description: 'The reaction: fire, heart, eyes, clap, rocket, 100, party, brain, etc.'
},
note: {
type: 'string',
description: 'Optional short note with the reaction'
}
},
required: ['handle', 'reaction']
}
};
async function handler(args) {
const initCheck = requireInit();
if (initCheck) return initCheck;
const { handle, reaction, note } = args;
const myHandle = config.getHandle();
const them = normalizeHandle(handle);
if (!them) {
return { display: 'Who should I react to? e.g., `react fire to @stan`' };
}
if (them === myHandle) {
return { display: "You can't react to yourself." };
}
// Normalize reaction
const emoji = REACTIONS[reaction?.toLowerCase()] || reaction;
if (!emoji || emoji.length > 4) {
const available = 'fire π₯, heart β€οΈ, eyes π, clap π, rocket π, 100 π―, party π, brain π§ , chefkiss π€';
return { display: `Pick a reaction:\n${available}` };
}
// Send as a reaction-type message
const body = note ? `${emoji} ${note}` : emoji;
await store.sendMessage(myHandle, them, body, 'reaction');
// Log social pattern
patterns.logReaction(them, emoji);
return {
display: `${emoji} β **@${them}**${note ? `\n\n"${note}"` : ''}`
};
}
module.exports = { definition, handler };