TomatoCake
TomatoCake
Explore posts from servers
DIAdiscord.js - Imagine a bot
Created by TomatoCake on 6/3/2024 in #djs-questions
discord.js occasionally resending requests, causing double messages
I've got a feature which sends a message at 00:00:00. However, sometimes requests are sent twice or even three times. This doesn't affect only messages, a PUT Guild Member request was also re-send once. I'm quite sure this isn't a code issue, and it might very well not be related to djs (probably just too many network requests at that time). Sample Timeline (ms) T+0: djs correctly sends the Birthday message request M1 T+194: Discord assigns a snowflake to M1 (probably near the sent timestamp in the channel) T+302: Guild Member request is sent P1 T+15_002: Birthday message request M1 fails; without status, headers and body*; djs resends it M2 T+15_303: Guild Member request P1 fails, same response as above; djs resends it P2 T+15_364: Discord assigns a snowflake to either P1 or P2 T+15_458: Guild Member request triggers a Guild Member update event (either P1 or P2) T+15_673: Discord assigns a snowflake to M2 T+16_012: HTTP 200 and message body returned for M2 T+16_224: HTTP 204 returned for P2 *: probably a network error? I'm currently unable to log those with my hack-ish request logging Main issue Despite the requests failing to return a proper response, causing djs to resend them, they are processed correctly on Discords end. This doesn't really matter for e.g. Guild Member updates, but messages being sent two or three times is just annoying. So, what's causing djs to retry requests, or is this unrelated to djs and done at undici level or below? Version: [email protected] (not latest, tho it happened four months ago already so unlikely to be a recent issue)
10 replies
DIAdiscord.js - Imagine a bot
Created by TomatoCake on 5/1/2024 in #djs-questions
Logging API response body
Hi, I'm back once again - is there any way to log the parsed response body received from Discord? I can see the request body sent to Discord, but to improve my logging I want to be able to log the raw body. Looking at @discordjs/rest code, there doesn't seem to be any event emitted, and while a method was added to handle the parsing manually, it doesn't look like I can easily replace it without monkey-patching the REST package code. Am I missing something there? djs: 14.15.0-dev.1713658222-4ad285804
10 replies
CDCloudflare Developers
Created by TomatoCake on 7/25/2023 in #workers-help
wrangler ignores KV bindings in config
I've used the following in my wrangler.toml:
kv_namespaces = [
{ binding = "BROWSER_SCREENSHOT_CACHE", id = "xxx" }
]
kv_namespaces = [
{ binding = "BROWSER_SCREENSHOT_CACHE", id = "xxx" }
]
. However, once I deploy the worker, the KV binding gets removed and is no longer available in the code and not visible in the dashboard as binded. However, I can add it in the dashboard and it works thinkies the wrangler.toml code by the dash doesn't change anything, it's the same)
15 replies