Skip to content

feat(actions): /hug, /kiss, /slap… anime action GIFs - #47

Open
Zeptiny wants to merge 2 commits into
mainfrom
feat/action-gifs
Open

Zeptiny wants to merge 2 commits into
mainfrom
feat/action-gifs

Conversation

@Zeptiny

@Zeptiny Zeptiny commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

What

27 roleplay commands that post an anime GIF of the caller doing the action to someone:

Kind Commands Button
Affection /hug /kiss /peck /blowkiss /pat (headpat) /cuddle /nuzzle /lappillow /handhold /handshake /highfive /brofist /wave /cheers /feed Retribuir
Playful /wink /stare /lick /poke /pinch /tickle /bite /bonk Devolver
Rough /slap /punch /kick /yeet Revidar

🤗 **Ana** abraçou @Bruno! with the GIF in an embed, and a footer like Ana já abraçou Bruno 5 vezes · Anime: K-On!. All commands are generated from one table in core/action_gifs.py, so adding an action is one row.

How

  • GIF sources, per action in order: nekos.best (names the anime) and otakugifs.xyz. blowkiss falls back to otakugifs airkiss; lick, nuzzle, brofist, cheers, pinch are otakugifs-only; peck, lappillow, handshake, highfive, feed, bonk, kick, yeet are nekos.best-only. Only GIFs hosted on those two sites are posted.
  • When no API answers: every distinct GIF the APIs return is recorded (no cap), and its file is downloaded once in the background into data/action_gifs/<sha256>.gif (identical GIFs stored once; two downloads at a time; only real GIFs up to 10 MiB, Discord's upload limit; a failed download is retried the next time that GIF is served). If every source fails, a stored file is uploaded with the message and shown in the embed via attachment://<action>.gif; then a stored URL; then text.
  • Return button: only the target can press it, once, within 10 minutes; it posts the action back ("… de volta!") without a button of its own.
  • Doing it to the bot: after the GIF, the bot answers in character through the new ChatEngine.answer_action: a few words, a reaction on the GIF, an action back, or [NO_REPLY]. It costs one turn of the person's CHAT_USER_BUDGET, replying to the answer continues the conversation, and it stays quiet where respond is off.
  • The bot doing it: new send_action_gif tool in the chat profile, at most once per answer, when asked ("dá um abraço no Bruno") or when it fits the personality.
  • Counts per server and pair in data/actions.db.
  • Settings: per-channel actions setting (/config), shared 5 s cooldown, target pinged by default, affection actions on yourself come from the bot (others refused), /help groups them on one line.
  • Config: ACTIONS_ENABLED, ACTIONS_DB_PATH, ACTIONS_STORE_GIFS, ACTIONS_GIFS_DIR, ACTIONS_PING_TARGET, ACTIONS_COOLDOWN_SECONDS, ACTIONS_BOT_REPLY, ACTIONS_TOOL_ENABLED, ACTIONS_USER_AGENT (README, SETUP.md, .env.example).
  • .dockerignore now excludes data/: with COPY . . and no ignore file, stored GIFs would otherwise go into every build context and image (Compose already mounts ./data).

Before deploying

  • User-Agent: nekos.best returns 403 unless the User-Agent names the app and a contact (email, site, repo or bot invite link). The default is the bot's name plus its own invite link, built at runtime; not verified live (it needs the real bot ID). Setting ACTIONS_USER_AGENT=QuillBot (<repo or contact>) is the safe option. Until it works, the 8 nekos.best-only actions use stored files, then go out as text.
  • Disk: sampled GIFs averaged ~0.9 MB (max 1.9 MB). hug has about 75 GIFs on nekos.best and about 23 on otakugifs (estimated from sampling), so a full set across 27 actions is likely a few thousand GIFs, a few GB in data/action_gifs/.
  • nekos.best terms: caching its responses is allowed for private use only, and rehosting is forbidden. Storing its GIFs and re-uploading them to Discord goes against a strict reading; ACTIONS_STORE_GIFS=false keeps URLs only.

Testing

  • pytest: 326 passed, 27 in tests/test_actions.py (providers and fallbacks, every distinct GIF kept, files saved once per content and retried, non-GIFs and oversized files refused, stored file uploaded as an attachment and shown in the embed, refused hosts, counts, wording, the return button, pings, cooldown, self-actions, the bot answering, the tool, the engine starting a conversation). ruff check . clean.
  • Live: the new otakugifs categories (nuzzle, brofist, cheers, pinch, airkiss) all returned GIFs; real files were saved and, with the APIs unreachable, a stored one was picked and attached as nuzzle.gif. Two of six parallel downloads got HTTP 428 from otakugifs' CDN and succeeded when fetched one at a time, hence the two-at-a-time limit and the retry.
  • nekos.best refused a generic User-Agent (the 403 above), which the fallback handled.
  • Dumped the real LLM request for a /hug on the bot to check the question framing and the tool schema.
  • Not yet run in a real Discord server.

🤖 Generated with Claude Code

Fifteen commands (hug, kiss, slap, lick, pat, cuddle, poke, bite, bonk,
punch, kick, tickle, highfive, handhold, feed) post an anime GIF of the
caller doing the action to someone, built from one table in
core/action_gifs.py.

- GIFs: nekos.best first (names the anime), then otakugifs.xyz (the only
  one with lick); only those hosts are posted. Every GIF fetched is
  remembered (50 per action) and reused when both APIs are down; with
  none, the action goes out as text. nekos.best needs a User-Agent with a
  contact: the bot's name and invite link, or ACTIONS_USER_AGENT.
- A Retribuir/Revidar/Devolver button only the target can press, once.
- Counts per pair ("Ana já abraçou Bruno 5 vezes") in data/actions.db.
- Doing an action to the bot gets an answer in character through the chat
  engine (ChatEngine.answer_action), costing one turn of the person's budget.
- send_action_gif tool in the chat profile: the bot does actions itself,
  at most once per answer.
- Per-channel `actions` setting, shared cooldown, target pinged
  (ACTIONS_PING_TARGET), self-hugs come from the bot, /help groups them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 60e0cc1c-2e37-4e0f-89c5-0f85d787c12b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

- New actions: peck, blowkiss (airkiss fallback), nuzzle, lappillow,
  handshake, brofist, wave, wink, stare, cheers, pinch, yeet (27 total).
- Every distinct GIF URL the APIs return is kept (the 50-per-action cap
  is gone).
- Each GIF's file is downloaded once in the background into
  ACTIONS_GIFS_DIR, named by its SHA-256 so identical GIFs are stored
  once; two downloads at a time, only real GIFs up to 10 MiB, retried the
  next time the GIF is served if a download failed.
- When no API answers, a stored file is uploaded as an attachment and
  shown in the embed (attachment://<action>.gif); then a stored URL; then
  text. ACTIONS_STORE_GIFS=false keeps URLs only.
- .dockerignore keeps data/ out of the build context and the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant