mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-11 12:18:59 +00:00
feat(telegram): remap reaction emojis and add /reactions command
Remap status reaction emojis for clarity (tool: 🔥→✍, error: 😱→💔) and reduce overlap between statuses. Add /reactions command to show emoji legend table to users.
This commit is contained in:
1 parent
173f1cea53
commit
a1323e0d1d
2 files changed
+37
-7
No files matched your search
@@ -85,6 +85,7 @@ func (c *Channel) handleBotCommand(ctx context.Context, message *telego.Message,
|
||||
"/stopall — Stop all running tasks\n" +
|
||||
"/reset — Reset conversation history\n" +
|
||||
"/status — Show bot status\n" +
|
||||
"/reactions — Show reaction emoji legend\n" +
|
||||
"/tasks — List team tasks\n" +
|
||||
"/task_detail <id> — View task detail\n" +
|
||||
"/subagents — List subagent tasks\n" +
|
||||
@@ -226,6 +227,18 @@ func (c *Channel) handleBotCommand(ctx context.Context, message *telego.Message,
|
||||
case "/writers":
|
||||
c.handleListWriters(ctx, chatID, chatIDStr, isGroup, setThread)
|
||||
return true
|
||||
|
||||
case "/reactions":
|
||||
var lines string
|
||||
for _, r := range reactionLegend {
|
||||
lines += fmt.Sprintf("%s %s\n", r.Emoji, r.Desc)
|
||||
}
|
||||
reactText := fmt.Sprintf("<b>Reaction Emoji Legend</b>\n\n<pre>%s</pre>\nReaction level: <b>%s</b>", lines, c.config.ReactionLevel)
|
||||
msg := tu.Message(chatIDObj, reactText)
|
||||
msg.ParseMode = telego.ModeHTML
|
||||
setThread(msg)
|
||||
c.bot.SendMessage(ctx, msg)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
@@ -41,15 +41,32 @@ var telegramSupportedEmojis = map[string]bool{
|
||||
// First emoji is preferred; fallback to next if chat restricts it.
|
||||
// Ref: TS src/telegram/status-reaction-variants.ts
|
||||
var statusReactionVariants = map[string][]string{
|
||||
"queued": {"👀", "👍", "🔥"},
|
||||
"queued": {"👀", "🙏", "🤝"},
|
||||
"thinking": {"🤔", "🤓", "👀"},
|
||||
"tool": {"🔥", "⚡", "👍"},
|
||||
"coding": {"👨\u200d💻", "🔥", "⚡"},
|
||||
"web": {"⚡", "🔥", "👍"},
|
||||
"tool": {"✍", "⚡", "🔥"},
|
||||
"coding": {"👨\u200d💻", "✍", "🤓"},
|
||||
"web": {"⚡", "🌚", "🔥"},
|
||||
"done": {"👍", "🎉", "💯"},
|
||||
"error": {"😱", "😨", "🤯"},
|
||||
"stallSoft": {"🥱", "😴", "🤔"},
|
||||
"stallHard": {"😨", "😱", "⚡"},
|
||||
"error": {"💔", "😱", "😨"},
|
||||
"stallSoft": {"🥱", "😴", "😐"},
|
||||
"stallHard": {"😨", "🤯", "😱"},
|
||||
}
|
||||
|
||||
// ReactionLegend returns the primary emoji for each status, used by the /reactions command.
|
||||
var reactionLegend = []struct {
|
||||
Status string
|
||||
Emoji string
|
||||
Desc string
|
||||
}{
|
||||
{"queued", "👀", "Queued — waiting to process"},
|
||||
{"thinking", "🤔", "Thinking — processing your request"},
|
||||
{"tool", "✍", "Tool — executing a tool"},
|
||||
{"coding", "👨\u200d💻", "Coding — running code"},
|
||||
{"web", "⚡", "Web — browsing / API call"},
|
||||
{"done", "👍", "Done — completed"},
|
||||
{"error", "💔", "Error — something went wrong"},
|
||||
{"stallSoft", "🥱", "Stall — no activity for 10s"},
|
||||
{"stallHard", "😨", "Stall — no activity for 30s"},
|
||||
}
|
||||
|
||||
// resolveReactionEmoji picks the first supported emoji for a given status.
|
||||
|
||||
Reference in new issue
Block a user