Repository navigation
Attach SFW anime GIFs to action commands via Fluxpoint API - #2
Merged
Merged
Conversation
- New matrimony/gifs.py: FluxpointClient wrapping /sfw/gif/<type> with graceful fallback (missing key, HTTP errors, timeouts, malformed payloads all yield a GIF-less reply) - Config: FLUXPOINT_API_KEY env var, defaulting to Fluxpoint's shared public-tier key; empty disables fetching - GIFs embedded on hug/kiss/slap/punch/bite/stab/ship replies, marriage completion (kiss) and divorce (cry); stab maps to punch (no stab endpoint exists), ship to handhold - aiohttp session reused lazily and closed on bot shutdown - tests/test_gifs.py covers client failure modes and command embedding - README + .env.example document the mapping and env var Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…handhold) + lenient parsing for bot-authored commands - New action commands backed by Fluxpoint SFW anime GIF endpoints; cuddle maps to hug, nom maps to feed (no dedicated endpoints exist) - Fix bot dispatch: override process_commands - discord.py drops every bot-authored message by default, so '!matr ...' from other bots never reached the parser despite should_process() allowing them - strip_after_prefix + message.content.strip(): tolerate whitespace after the prefix and around the command text - Tests: end-to-end dispatch through the real parser (bot authors, whitespace variants, mention prefix, extra text, case, guild prefix) plus coverage that every action command maps to a documented endpoint and embeds its GIF - GIF_TYPES now lists all 28 documented /sfw/gif endpoints Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Action commands now embed a random SFW anime GIF, like the official MarriageBot. GIFs come from the Fluxpoint SFW anime GIF API (
GET https://api.fluxpoint.dev/sfw/gif/<type>, token inAuthorization).matrimony/gifs.py:FluxpointClient.fetch_url(image_type)returns a GIF URL orNone— missing/empty key, non-200, timeout, bad JSON, and missingfileall degrade to a GIF-less reply, so the action never fails on GIF problems. One lazily-createdaiohttpsession is reused and closed inMatrimonyBot.close().Config.fluxpoint_api_keyreadsFLUXPOINT_API_KEY, defaulting to Fluxpoint's shared public-tier key (FP-Public-..., committed per request); empty value disables fetching._say/_respondgained animageparam rendered viaembed.set_image.Command → endpoint mapping:
marry(completion)kissdivorcecryhug/kiss/slap/punch/bite/pat/poke/wave/lick/tickle/highfive/handholdcuddlehug(nocuddleendpoint exists)nomfeed(nonomendpoint exists)stabpunch(nostabendpoint exists)shiphandholdParser fix: discord.py's built-in
process_commandssilently drops every message whereauthor.botis True — so!matr ...from other bots never reached the parser, despiteshould_process()explicitly allowing them.MatrimonyBotnow overridesprocess_commandsto use the sameshould_processguard (own messages still skipped), tolerates leading/trailing whitespace inmessage.content, and setsstrip_after_prefix=Trueso! matr helpworks. Mention prefix (@Matrimony matr ...) and extra trailing text were already handled and are now covered by tests.Tests:
tests/test_gifs.pycovers client failure modes via an injected fake session and command-level embedding for every action command via a stubbedfetch_url;tests/test_dispatch.pygained end-to-end dispatch tests through the real parser (bot-authored messages, whitespace variants, mention prefix, extra text, case-insensitivity, custom guild prefix). All 70 tests pass; ruff clean. New endpoints verified live against the real API (200 +.gifURL).Link to Devin session: https://app.devin.ai/sessions/13367e65998b4af58b5e4ba4879bc7d5
Open in Devin Desktop: https://app.devin.ai/desktop/session/13367e65998b4af58b5e4ba4879bc7d5?variant=devin
Requested by: @CommunityPoke