Skill: wwjjhh1995/telegram-topic-rename (version 1.0.0)

--- name: telegram-topic-rename description: Rename Telegram forum topics and change icons via Bot API. Use when user asks to name/rename a topic, change topic title, update topic icon, or says "命名这个topic", "给话题起个名", "换个图标". Requires TELEGRAM_BOT_TOKEN environment variable. --- # Telegram Topic Rename / Telegram 话题命名 Rename Telegram forum topics and optionally change their icons. 重命名 Telegram 论坛话题，可选更换图标。 ## Setup / 配置 Set `TELEGRAM_BOT_TOKEN` in your environment or OpenClaw config: 在环境变量或 OpenClaw 配置中设置 `TELEGRAM_BOT_TOKEN`： ```bash export TELEGRAM_BOT_TOKEN="your-bot-token" ``` ## Usage / 使用方法 ### Get topic info / 获取话题信息 Extract from session context: - `chat_id`: User ID (private) or group ID - `thread_id`: From `message_thread_id` or session key 从会话上下文提取： - `chat_id`：用户 ID（私聊）或群组 ID - `thread_id`：从 `message_thread_id` 或 session key 获取 ### Run the script / 运行脚本 ```bash # Rename only / 仅改名 scripts/rename-topic.sh <chat_id> <thread_id> "新名称" # Rename + change icon (emoji shortcut) / 改名 + 换图标（emoji 快捷方式） scripts/rename-topic.sh <chat_id> <thread_id> "新名称" 🤖 # Rename + change icon (full ID) / 改名 + 换图标（完整 ID） scripts/rename-topic.sh <chat_id> <thread_id> "新名称" 5309832892262654231 # List available icons / 列出可用图标 scripts/rename-topic.sh --icons ``` ### Naming rules / 命名规则 - **Length / 长度**: ≤10 characters / 字符 - **Style / 风格**: Concise, capture the core theme / 简洁，抓住核心主题 - **Auto-icon / 自动选图标**: Match icon to topic theme (see references/icons.md) ## Icon quick reference / 图标速查 | Theme / 主题 | Icon | |-------------|------| | AI / 机器人 | 🤖 | | Code / 编程 | 💻 | | Science / 科学 | 🔬 | | Work / 工作 | 💼 | | Notes / 笔记 | 📝 | | Chat / 闲聊 | 💬 | | Games / 游戏 | 🎮 | | Music / 音乐 | 🎵 | | Ideas / 想法 | 💡 | | Fire / 热门 | 🔥 | Full list: See [references/icons.md](references/icons.md) 完整列表：见 [references/icons.md](references/icons.md)

path: references/icons.md
content: # Telegram Topic Icons Reference / Telegram 话题图标参考

> Data source: Telegram Bot API `getForumTopicIconStickers`  
> 数据来源：Telegram Bot API `getForumTopicIconStickers`  
> Last updated / 最后更新：2026-02-07  
> Total: 112 free icons (no Premium required) / 共 112 个免费图标（无需 Premium）

## Quick Reference / 速查表

Use `icon_custom_emoji_id` parameter to set icons.

直接使用 `icon_custom_emoji_id` 参数设置图标。

### Work/Office 工作/办公
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 📝 | `5373251851074415873` | Notes/Writing 笔记/写作 |
| 📆 | `5433614043006903194` | Schedule/Calendar 日程/计划 |
| 📁 | `5357315181649076022` | Files/Archive 文件/归档 |
| 🔎 | `5309965701241379366` | Search 搜索/查找 |
| 📈 | `5350305691942788490` | Growth/Up 增长/上升 |
| 📉 | `5350713563512052787` | Down/Loss 下降/亏损 |
| 💼 | `5348227245599105972` | Business/Work 商务/工作 |
| 🖨 | `5386379624773066504` | Print/Office 打印/办公 |
| ✍️ | `5238156910363950406` | Sign/Create 签名/创作 |

### Tech/Code 科技/编程
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 💻 | `5350554349074391003` | Code/Tech 编程/技术 |
| 📱 | `5409357944619802453` | Phone/App 手机/App |
| 🤖 | `5309832892262654231` | AI/Robot AI/机器人 |
| 🧠 | `5237889595894414384` | Think/Brain 思考/智慧 |
| 🧮 | `5355127101970194557` | Calculate/Algo 计算/算法 |

### Science/Research 科学/研究
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🔬 | `5377580546748588396` | Research/Lab 研究/实验 |
| 🔭 | `5368585403467048206` | Astronomy 天文/探索 |
| 🧪 | `5411138633765757782` | Chemistry/Test 化学/测试 |
| 🦠 | `5312424913615723286` | Virus/Health 病毒/健康 |

### News/Announcements 新闻/公告
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 📰 | `5434144690511290129` | News 新闻/资讯 |
| 📣 | `5309984423003823246` | Announcement 公告/通知 |
| 🗣 | `5370870893004203704` | Speech 演讲/发言 |
| 🎙 | `5377544228505134960` | Podcast/Record 播客/录音 |
| 🎤 | `5382003830487523366` | Sing/Speak 唱歌/发言 |

### Status/Markers 状态/标记
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| ⚡️ | `5312016608254762256` | Urgent/Energy 紧急/能量 |
| 🔥 | `5312241539987020022` | Hot/Trending 热门/火爆 |
| ⭐️ | `5235579393115438657` | Favorite/Featured 收藏/精选 |
| ✅ | `5237699328843200968` | Done/Confirmed 完成/确认 |
| ❓ | `5377316857231450742` | Question/Help 疑问/帮助 |
| ❗️ | `5379748062124056162` | Warning/Attention 注意/警告 |
| ‼️ | `5377498341074542641` | Double emphasis 双重强调 |
| ⁉️ | `5377438129928020693` | Surprised question 惊讶疑问 |
| 🔝 | `5418085807791545980` | Top/Best 置顶/最佳 |
| 🆒 | `5420216386448270341` | Cool/Trendy 酷/潮流 |
| 🔞 | `5420331611830886484` | Adult content 成人内容 |

### Ideas/Creative 创意/想法
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 💡 | `5312536423851630001` | Inspiration/Idea 灵感/创意 |
| 🔮 | `5350367161514732241` | Predict/Mystery 预测/神秘 |
| 🎨 | `5310039132297242441` | Art/Design 艺术/设计 |

### Education 学习/教育
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 📚 | `5350481781306958339` | Books/Reading 阅读/书籍 |
| 🎓 | `5357419403325481346` | Graduate/Academic 毕业/学术 |

### Communication 沟通/社交
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 💬 | `5417915203100613993` | Chat/Discussion 聊天/讨论 |

### Finance/Shopping 金融/购物
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 💰 | `5350452584119279096` | Money/Wealth 金钱/财富 |
| 💸 | `5309929258443874898` | Spend/Expense 花钱/支出 |
| 🪙 | `5377690785674175481` | Coin/Token 硬币/代币 |
| 💱 | `5310107765874632305` | Exchange/Forex 汇率/外汇 |
| 💎 | `5309958691854754293` | Precious/Diamond 珍贵/钻石 |
| 🛒 | `5431492767249342908` | Shopping/Cart 购物/电商 |
| 🛍 | `5350699789551935589` | Shopping bag 购物袋 |
| 👜 | `5377478880577724584` | Bag/Purse 包包 |
| 👠 | `5368741306484925109` | Fashion/Heels 时尚/高跟鞋 |

### Entertainment 娱乐/游戏
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🎮 | `5309950797704865693` | Games/Esports 游戏/电竞 |
| 🎬 | `5368653135101310687` | Movies/Video 电影/视频 |
| 🎵 | `5310045076531978942` | Music/Songs 音乐/歌曲 |
| 🎶 | `5377317729109811382` | Melody 旋律 |
| 📺 | `5350513667144163474` | TV/Streaming 电视/直播 |
| 🎭 | `5350658016700013471` | Theater/Drama 戏剧/表演 |
| 🪩 | `5350751634102166060` | Disco 迪斯科 |
| 🎟 | `5377624166436445368` | Tickets/Events 门票/活动 |

### Sports 运动
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| ⚽️ | `5375159220280762629` | Soccer 足球 |
| 🏀 | `5384327463629233871` | Basketball 篮球 |
| 🏁 | `5408906741125490282` | Racing/Finish 赛车/终点 |
| 💃 | `5357370526597653193` | Dance (F) 舞蹈(女) |
| 🕺 | `5357298525765902091` | Dance (M) 舞蹈(男) |

### Travel/Transport 旅行/交通
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| ✈️ | `5348436127038579546` | Flight/Travel 飞行/旅行 |
| 🚗 | `5312322066328853156` | Car/Driving 汽车/出行 |
| 🚂 | `5350497316203668441` | Train 火车 |
| 🛥 | `5350422527938141909` | Boat/Yacht 船/游艇 |
| 🧳 | `5357120306097956843` | Luggage/Travel 行李/旅行 |
| 🛃 | `5372819184658949787` | Customs 海关/出入境 |
| 🏖 | `5310303848311562896` | Beach/Vacation 海滩/度假 |
| 🏕 | `5350648297189023928` | Camping/Outdoor 露营/户外 |
| 🏔 | `5418196338774907917` | Mountain/Hiking 山/登山 |
| ⛅️ | `5350424168615649565` | Weather/Cloudy 天气/多云 |

### Family/Life 家庭/生活
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🏠 | `5312486108309757006` | Home/House 家/房子 |
| 👨‍👩‍👧‍👦 | `5386435923204382258` | Family 家庭/亲子 |
| 👶 | `5377675010259297233` | Baby/Parenting 婴儿/育儿 |
| 🤰 | `5386609083400856174` | Pregnancy 怀孕 |

### Emotions 情感
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| ❤️ | `5312138559556164615` | Love/Like 喜欢/爱 |
| 💘 | `5310029292527164639` | Romance 恋爱/心动 |

### Food/Drinks 食物/饮料
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| ☕️ | `5350392020785437399` | Coffee/Break 咖啡/休息 |
| 🍔 | `5350403544182694064` | Fast food 快餐 |
| 🍕 | `5350444672789519765` | Pizza 披萨 |
| 🍣 | `5350406176997646350` | Japanese/Sushi 日料/寿司 |
| 🍹 | `5350520238444126134` | Drinks/Cocktail 饮料/鸡尾酒 |
| 🍽 | `5350344462612570293` | Dining/Restaurant 餐饮/用餐 |
| 🍓 | `5310157398516703416` | Fruit/Strawberry 水果/草莓 |
| 🎂 | `5310132165583840589` | Birthday/Cake 生日/蛋糕 |

### Health/Medical 健康/医疗
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🩺 | `5350307998340226571` | Medical/Diagnose 医疗/诊断 |
| 💊 | `5310094636159607472` | Pills/Medicine 药物 |
| 💉 | `5310139157790596888` | Vaccine/Injection 疫苗/注射 |
| 🧼 | `5377468357907849200` | Hygiene/Clean 清洁/卫生 |

### Celebration 节日/庆祝
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🎉 | `5310228579009699834` | Party/Celebration 庆祝/派对 |
| 🏆 | `5312315739842026755` | Champion/Victory 冠军/胜利 |
| 🎖 | `5238027455754680851` | Honor/Medal 荣誉/勋章 |
| 🎄 | `5312054580060625569` | Christmas 圣诞节 |
| 🎃 | `5309744892677727325` | Halloween 万圣节 |

### Characters/Roles 人物/角色
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 👑 | `5357107601584693888` | King/VIP 王者/VIP |
| 👀 | `5357121491508928442` | Watch/Preview 关注/预告 |
| 🎩 | `5357504778685392027` | Gentleman/Magic 绅士/魔术 |
| 🤡 | `5238234236955148254` | Funny/Clown 搞笑/小丑 |
| 👮‍♂️ | `5377494501373780436` | Security/Rules 安全/规则 |
| 🏴‍☠️ | `5386395194029515402` | Pirate/Rebel 海盗/叛逆 |
| 🪖 | `5357188789351490453` | Military 军事 |

### Animals 动物
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🐈 | `5235912661102773458` | Cat 猫 |
| 🐟 | `5384574037701696503` | Fish 鱼 |
| 🦄 | `5413625003218313783` | Unicorn/Fantasy 独角兽/梦幻 |
| 🦮 | `5237999392438371490` | Dog 狗 |

### Beauty/Fashion 美容/时尚
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 💄 | `5310262535021142850` | Makeup 化妆/美妆 |
| 💅 | `5368808634392257474` | Nails 美甲 |
| 🫦 | `5357185426392096577` | Lips 唇 |

### Other 其他
| Emoji | ID | Use / 用途 |
|-------|-----|------|
| 🏛 | `5350548830041415279` | Government 政府/机构 |
| 🗳 | `5350387571199319521` | Vote/Election 投票/选举 |
| 🪪 | `5418115271267197333` | ID Card 身份证 |


path: scripts/rename-topic.sh
content: #!/bin/bash
# Rename Telegram forum topic (with optional icon)
# 重命名 Telegram 论坛话题（可选更换图标）
#
# Usage / 用法:
#   ./rename-topic.sh <chat_id> <thread_id> <new_name> [icon]
#   ./rename-topic.sh --icons  # Show available icons / 显示可用图标
#
# Icon can be / 图标可以是:
#   - Emoji (from the map below / 下面的映射表)
#   - Full custom_emoji_id (19-digit number / 19位数字)
#   - Omitted to keep current icon / 省略则保持当前图标
#
# Requires / 需要: TELEGRAM_BOT_TOKEN environment variable
#
# Data source: Telegram Bot API getForumTopicIconStickers (2026-02-07)

# Get token from environment
BOT_TOKEN="${TELEGRAM_BOT_TOKEN:-}"

if [ -z "$BOT_TOKEN" ] && [ "$1" != "--icons" ]; then
  echo "Error: TELEGRAM_BOT_TOKEN not set"
  echo "错误：未设置 TELEGRAM_BOT_TOKEN"
  echo ""
  echo "Set it in your environment or OpenClaw config:"
  echo "在环境变量或 OpenClaw 配置中设置："
  echo "  export TELEGRAM_BOT_TOKEN=\"your-bot-token\""
  exit 1
fi

# Hardcoded emoji → ID mapping (112 icons, verified from API)
declare -A ICON_MAP=(
  ["📰"]="5434144690511290129"
  ["💡"]="5312536423851630001"
  ["⚡️"]="5312016608254762256"
  ["🎙"]="5377544228505134960"
  ["🔝"]="5418085807791545980"
  ["🗣"]="5370870893004203704"
  ["🆒"]="5420216386448270341"
  ["❗️"]="5379748062124056162"
  ["📝"]="5373251851074415873"
  ["📆"]="5433614043006903194"
  ["📁"]="5357315181649076022"
  ["🔎"]="5309965701241379366"
  ["📣"]="5309984423003823246"
  ["🔥"]="5312241539987020022"
  ["❤️"]="5312138559556164615"
  ["❓"]="5377316857231450742"
  ["📈"]="5350305691942788490"
  ["📉"]="5350713563512052787"
  ["💎"]="5309958691854754293"
  ["💰"]="5350452584119279096"
  ["💸"]="5309929258443874898"
  ["🪙"]="5377690785674175481"
  ["💱"]="5310107765874632305"
  ["⁉️"]="5377438129928020693"
  ["🎮"]="5309950797704865693"
  ["💻"]="5350554349074391003"
  ["📱"]="5409357944619802453"
  ["🚗"]="5312322066328853156"
  ["🏠"]="5312486108309757006"
  ["💘"]="5310029292527164639"
  ["🎉"]="5310228579009699834"
  ["‼️"]="5377498341074542641"
  ["🏆"]="5312315739842026755"
  ["🏁"]="5408906741125490282"
  ["🎬"]="5368653135101310687"
  ["🎵"]="5310045076531978942"
  ["🔞"]="5420331611830886484"
  ["📚"]="5350481781306958339"
  ["👑"]="5357107601584693888"
  ["⚽️"]="5375159220280762629"
  ["🏀"]="5384327463629233871"
  ["📺"]="5350513667144163474"
  ["👀"]="5357121491508928442"
  ["🫦"]="5357185426392096577"
  ["🍓"]="5310157398516703416"
  ["💄"]="5310262535021142850"
  ["👠"]="5368741306484925109"
  ["✈️"]="5348436127038579546"
  ["🧳"]="5357120306097956843"
  ["🏖"]="5310303848311562896"
  ["⛅️"]="5350424168615649565"
  ["🦄"]="5413625003218313783"
  ["🛍"]="5350699789551935589"
  ["👜"]="5377478880577724584"
  ["🛒"]="5431492767249342908"
  ["🚂"]="5350497316203668441"
  ["🛥"]="5350422527938141909"
  ["🏔"]="5418196338774907917"
  ["🏕"]="5350648297189023928"
  ["🤖"]="5309832892262654231"
  ["🪩"]="5350751634102166060"
  ["🎟"]="5377624166436445368"
  ["🏴‍☠️"]="5386395194029515402"
  ["🗳"]="5350387571199319521"
  ["🎓"]="5357419403325481346"
  ["🔭"]="5368585403467048206"
  ["🔬"]="5377580546748588396"
  ["🎶"]="5377317729109811382"
  ["🎤"]="5382003830487523366"
  ["🕺"]="5357298525765902091"
  ["💃"]="5357370526597653193"
  ["🪖"]="5357188789351490453"
  ["💼"]="5348227245599105972"
  ["🧪"]="5411138633765757782"
  ["👨‍👩‍👧‍👦"]="5386435923204382258"
  ["👶"]="5377675010259297233"
  ["🤰"]="5386609083400856174"
  ["💅"]="5368808634392257474"
  ["🏛"]="5350548830041415279"
  ["🧮"]="5355127101970194557"
  ["🖨"]="5386379624773066504"
  ["👮‍♂️"]="5377494501373780436"
  ["🩺"]="5350307998340226571"
  ["💊"]="5310094636159607472"
  ["💉"]="5310139157790596888"
  ["🧼"]="5377468357907849200"
  ["🪪"]="5418115271267197333"
  ["🛃"]="5372819184658949787"
  ["🍽"]="5350344462612570293"
  ["🐟"]="5384574037701696503"
  ["🎨"]="5310039132297242441"
  ["🎭"]="5350658016700013471"
  ["🎩"]="5357504778685392027"
  ["🔮"]="5350367161514732241"
  ["🍹"]="5350520238444126134"
  ["🎂"]="5310132165583840589"
  ["☕️"]="5350392020785437399"
  ["🍣"]="5350406176997646350"
  ["🍔"]="5350403544182694064"
  ["🍕"]="5350444672789519765"
  ["🦠"]="5312424913615723286"
  ["💬"]="5417915203100613993"
  ["🎄"]="5312054580060625569"
  ["🎃"]="5309744892677727325"
  ["✍️"]="5238156910363950406"
  ["⭐️"]="5235579393115438657"
  ["✅"]="5237699328843200968"
  ["🎖"]="5238027455754680851"
  ["🤡"]="5238234236955148254"
  ["🧠"]="5237889595894414384"
  ["🦮"]="5237999392438371490"
  ["🐈"]="5235912661102773458"
)

show_icons() {
  echo "Available icons (112) / 可用图标 (112个):"
  echo ""
  echo "【News/Status 新闻/状态】📰 📣 ❗️ ‼️ ⁉️ ❓ 🔝 🆒 🔞 ⭐️ ✅"
  echo "【Energy/Weather 能量/天气】🔥 ⚡️ ⛅️ 🏔"
  echo "【Ideas 创意/想法】💡 🔮 🎨"
  echo "【Work/Office 工作/办公】📝 📆 📁 🔎 📈 📉 💼 🖨 ✍️"
  echo "【Tech/Code 科技/编程】💻 📱 🤖 🧠 🧮"
  echo "【Science 科学/研究】🔬 🔭 🧪 🦠"
  echo "【Education 学习/教育】📚 🎓"
  echo "【Communication 沟通/社交】💬 🗣 🎙 🎤"
  echo "【Finance/Shopping 金融/购物】💰 💸 🪙 💱 💎 🛒 🛍 👜 👠"
  echo "【Entertainment 娱乐/游戏】🎮 🎬 🎵 🎶 📺 🎭 🪩 🎟"
  echo "【Sports 运动】⚽️ 🏀 🏁 💃 🕺"
  echo "【Travel 旅行/交通】✈️ 🚗 🚂 🛥 🧳 🛃 🏖 🏕"
  echo "【Family/Life 家庭/生活】🏠 👨‍👩‍👧‍👦 👶 🤰"
  echo "【Emotions 情感】❤️ 💘"
  echo "【Food/Drinks 食物/饮料】☕️ 🍔 🍕 🍣 🍹 🍽 🍓 🎂"
  echo "【Health 健康/医疗】🩺 💊 💉 🧼"
  echo "【Celebration 节日/庆祝】🎉 🏆 🎖 🎄 🎃"
  echo "【Characters 人物/角色】👑 👀 🎩 🤡 👮‍♂️ 🏴‍☠️ 🪖"
  echo "【Animals 动物】🐈 🐟 🦄 🦮"
  echo "【Beauty 美容】💄 💅 🫦"
  echo "【Other 其他】🏛 🗳 🪪"
}

# Check for --icons flag
if [ "$1" == "--icons" ]; then
  show_icons
  exit 0
fi

CHAT_ID="$1"
THREAD_ID="$2"
NAME="$3"
ICON="$4"

if [ -z "$CHAT_ID" ] || [ -z "$THREAD_ID" ] || [ -z "$NAME" ]; then
  echo "Usage / 用法: $0 <chat_id> <thread_id> <new_name> [icon]"
  echo "              $0 --icons  # Show available icons / 显示可用图标"
  echo ""
  echo "Examples / 示例:"
  echo "  $0 288536750 145417 'Test Topic' 💻"
  echo "  $0 288536750 145417 '测试话题' 5350554349074391003"
  exit 1
fi

# Check name length
CHAR_COUNT=$(echo -n "$NAME" | wc -m)
if [ "$CHAR_COUNT" -gt 10 ]; then
  echo "Warning: Name is $CHAR_COUNT chars, exceeds 10 char limit"
  echo "警告：名称 $CHAR_COUNT 字符，超过 10 字符限制"
fi

# Build curl arguments
CURL_ARGS=(-s "https://api.telegram.org/bot${BOT_TOKEN}/editForumTopic")
CURL_ARGS+=(-d "chat_id=${CHAT_ID}")
CURL_ARGS+=(-d "message_thread_id=${THREAD_ID}")
CURL_ARGS+=(--data-urlencode "name=${NAME}")

# Add icon if provided
if [ -n "$ICON" ]; then
  # Check if it's a 19-digit ID
  if [[ "$ICON" =~ ^[0-9]{19}$ ]]; then
    ICON_ID="$ICON"
  elif [ -n "${ICON_MAP[$ICON]}" ]; then
    ICON_ID="${ICON_MAP[$ICON]}"
  else
    echo "Warning: Icon '$ICON' not found, skipping icon change"
    echo "警告：图标 '$ICON' 未找到，跳过图标更换"
    ICON_ID=""
  fi
  
  if [ -n "$ICON_ID" ]; then
    CURL_ARGS+=(-d "icon_custom_emoji_id=${ICON_ID}")
    echo "Using icon ID / 使用图标 ID: $ICON_ID"
  fi
fi

# Execute
curl "${CURL_ARGS[@]}" | jq .


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)