Rebuild bot on raw Discord API with quotas and resilience#5
Draft
SyntaxGhost404 wants to merge 13 commits into
Draft
Rebuild bot on raw Discord API with quotas and resilience#5SyntaxGhost404 wants to merge 13 commits into
SyntaxGhost404 wants to merge 13 commits into
Conversation
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
discord.jsor another high-level client/cosplayplus/premium [user], bringing the public registry to 41 commands plus one hidden component handlerllms-full.txta local-only, Git-ignored referencesrc/config/emojis.jsGlobal quotas and Premium
.runtime/directoryProvider and Discord resilience
Cosplay feed command
/cosplaycommand with the established Refresh and direct Link controlsButtplug Anime/Real sources
stylechoice to/buttplug: Anime uses only ABD Osaka, while Real uses only PornPics/assand/analP_MAX * 10item range and select a fresh cryptographic offset on every command and Refresh?offset={offset}JSON responseg_urlor individual galleries, and never issue speculative, background, or parallel media requestscdni.pornpics.comimage URLs and promote/300/or/460/covers to/1280//1280/cover into bounded memory, retry that exact URL once only after a genuine network transport failure, require a supported image MIME type, and re-upload it as a native Discord attachment/1280/URL in the Link button, reject HTTP 200 HTML block pages and unsafe redirects, and avoid proxying or WAF/TLS circumventionABD Osaka-only routing
url_japanfield and intentionally ignore every other mirror fieldn-sfw.ap-osaka-1.s3.inkhostname, with no mirror iteration or fallback loopCERT_HAS_EXPIREDafter a separate certificate hostname check; reject self-signed, untrusted-chain, hostname-mismatch, plaintext, substituted-host, redirect, and all other TLS failuresurl_japanvalue through ABD's Link button while keeping the embed itself attachment-backedCross-host runtime hardening
DISCORD_BOT_TOKENandDISCORD_CLIENT_IDserver-side secrets while preserving the legacy Replit aliasesCLIENT_IDalso existECONNRESETin provider diagnosticsInteraction ownership fix
10062/40060pattern as two live Gateway consumers using the sameBOT_TOKEN, not a slow command or provider40060as definitive competing-consumer evidence; two fresh sub-2.5-second10062failures confirm the same conditionPersistent Replit logs
npm startsuperviseindex.jsand mirror both stdout and stderr to the colorized terminallogs/discord-bot-console.txtfrom before bot startupnpm run logs:exportfor owner-only timestamped snapshots underlogs/exports/npm run start:directas an explicit diagnostic path that bypasses captureGraceful lifecycle
Verification
npm run validate— passedNODE_OPTIONS=--unhandled-rejections=strict npm test— 137/137 tests passednpm audit --omit=dev— 0 vulnerabilitiesae8589bec17bd5e3540d941337a75088df1e8720text/htmldatacenter block rather than image bytesDeployment notes
DISCORD_BOT_TOKENandDISCORD_CLIENT_IDin Google AI Studio Settings → Secrets; the legacy Replit aliases remain supportedALLOW_INSECURE_MEDIA_TLS; the generic bypass was removed, while the upstream operator should still renew the Osaka certificatePREMIUM_USER_IDSallowlist until payment integration existsRATE_LIMIT_STATE_FILEon durable storage if daily quotas must survive deployment replacementhttps://chatgpt.com