OpenPet
Virtual pet game. Each user gets one pet, tracked by {platform}_{userId}.
State
Pets stored in tamagotchi/pets/{platform}_{userId}.json:
CODEBLOCK0
Create tamagotchi/pets/ directory if missing.
Commands
| Trigger | Action |
|---|
| INLINECODE3 , INLINECODE4 | Show stats + ASCII art |
| INLINECODE5 |
hunger -30, happiness +5 |
|
play with pet | happiness +25, energy -20 |
|
pet sleep | energy +40, happiness +5 |
|
name pet [name] | Set pet name |
|
new pet | Reset (only if dead or confirm) |
|
pet help | Show commands |
New User Flow
- 1. Any pet command from unknown user → create egg
- First interaction → hatch to blob
- Show welcome message + commands
Stats Display
CODEBLOCK1
Use sprites from references/sprites.json. Mood = happy (≥70), neutral (40-69), sad (<40).
Evolution
| Stage | Requirement |
|---|
| egg → blob | First interaction |
| blob → cat |
age ≥10, feedings ≥15, plays ≥10 |
| cat → dragon | age ≥30, feedings ≥50, plays ≥40 |
Check evolution after each interaction. Announce with fanfare.
Death
Pet dies if: hunger ≥ 100 OR INLINECODE13
BUT if immortalMode: true in config, pets don't die — they just get very sad and hungry. Stats cap at 99/1 instead of triggering death. Default is immortal mode ON.
Show memorial (if death enabled), offer new pet to restart.
Decay (Cron)
Set up cron job openpet-tick every 2 hours:
- - hunger +15, happiness -10, energy -5
- Clamp all stats 0-100
- Check death conditions
- Alert owner if critical (hunger >80 or happiness <20)
- Increment age daily
Platform Detection
Extract from message context:
- - Discord: INLINECODE17
- WhatsApp: INLINECODE18
- Telegram: INLINECODE19
- Signal: INLINECODE20
Alerts
Send to user's origin platform when:
- - Pet is hungry (>80): "🍖 {name} is starving!"
- Pet is sad (<20): "😢 {name} misses you!"
- Pet died: "💀 {name} has passed away..."
- Evolution: "✨ {name} evolved into a {species}!"
OpenPet
虚拟宠物游戏。每位用户获得一只宠物,通过 {平台}_{用户ID} 进行追踪。
状态
宠物存储在 tamagotchi/pets/{平台}_{用户ID}.json 文件中:
json
{
name: 布洛比,
species: 布丁怪,
hunger: 30,
happiness: 70,
energy: 50,
age: 5,
born: 2026-02-01T12:00:00Z,
lastUpdate: 1738442780000,
alive: true,
evolution: 1,
totalFeedings: 12,
totalPlays: 8,
ownerId: 202739061796896768,
platform: discord,
ownerName: mattzap
}
如缺少 tamagotchi/pets/ 目录则自动创建。
指令
| 触发词 | 动作 |
|---|
| pet, pet status | 显示状态 + ASCII 艺术图 |
| feed pet |
饥饿度 -30,快乐度 +5 |
| play with pet | 快乐度 +25,精力 -20 |
| pet sleep | 精力 +40,快乐度 +5 |
| name pet [名称] | 设置宠物名称 |
| new pet | 重置(仅当宠物死亡或确认后) |
| pet help | 显示指令列表 |
新用户流程
- 1. 未知用户的任何宠物指令 → 创建宠物蛋
- 首次互动 → 孵化成布丁怪
- 显示欢迎信息 + 指令列表
状态显示
╭──────────╮
│ (◕‿◕) │
│ ♥ │
│ 名称 │
╰──────────╯
❤️ 快乐度: ████████░░░░ 70%
🍖 饥饿度: ███░░░░░░░░░ 30%
⚡ 精力值: █████░░░░░░░ 50%
使用 references/sprites.json 中的精灵图。心情状态:开心(≥70)、一般(40-69)、伤心(<40)。
进化
年龄≥10,喂食≥15,玩耍≥10 |
| 猫 → 龙 | 年龄≥30,喂食≥50,玩耍≥40 |
每次互动后检查进化条件。进化时以华丽方式宣告。
死亡
宠物在以下情况死亡:饥饿度 ≥ 100 或 快乐度 ≤ 0
但 若配置中 immortalMode: true,宠物不会死亡——它们只会变得非常伤心和饥饿。状态值上限为99/1,不会触发死亡。默认开启不死模式。
若死亡模式开启,显示悼念信息,提供 new pet 指令重新开始。
衰减(定时任务)
设置每2小时执行一次的定时任务 openpet-tick:
- - 饥饿度 +15,快乐度 -10,精力 -5
- 所有状态值限制在0-100范围内
- 检查死亡条件
- 若状态危急(饥饿度>80或快乐度<20)则提醒主人
- 每日增加年龄
平台检测
从消息上下文中提取:
- - Discord:discord{用户ID}
- WhatsApp:whatsapp{电话号码}
- Telegram:telegram{聊天ID}
- Signal:signal{UUID}
提醒
在以下情况向用户原始平台发送消息:
- - 宠物饥饿(>80):🍖 {名称} 快饿死了!
- 宠物伤心(<20):😢 {名称} 想你了!
- 宠物死亡:💀 {名称} 已经去世了...
- 进化:✨ {名称} 进化成了 {物种}!