nick.
nick.
DIAdiscord.js - Imagine an app
Created by nick. on 10/22/2024 in #djs-questions
What happens at 2,500 guilds/shard if you don't automatically reshard
What happens if a shard exceeds its maximum number of guilds? Does that shard crash (due to discord disconnecting the gateway client and it not being allowed to reconnect any longer), or does the entire parent process exit as well (allowing an automatic restart to properly reshard as a fallback without duplicate/orphan processes running)
24 replies
DIAdiscord.js - Imagine an app
Created by nick. on 6/21/2024 in #djs-questions
Guild member caching
What is the default behavior for guild member caching? Are guild members swept at all by default? Basically, if a bot had the presences intent and received all guild members that way, or didn't have the intent/the guild exceeded large_threshold members and guild.members.fetch() is called, is it guaranteed that all members in that guild are in the cache and will stay in the cache?
5 replies
DIAdiscord.js - Imagine an app
Created by nick. on 6/12/2024 in #djs-questions
Caching all guild entitlements for a process-sharded bot
What's the recommended approach for caching entitlements for all servers on a bot using process sharding? Some use cases I'm looking to support require validating entitlement access outside of an interaction context, and it seems that unfortunately a guild's entitlements are not included in guild create gateway events. The inclusion of entitlements in interaction contexts seems to suggest that you shouldn't have to store entitlements externally. What's the recommended approach here? (Is it just to call client.application.entitlements.fetch() on startup since the gateway events should update the cache?)
4 replies
DIAdiscord.js - Imagine an app
Created by nick. on 4/9/2024 in #djs-questions
Detect when bot webhook has moved to another channel
I'm looking to use webhooks to send messages to specific channels in a guild. Unfortunately, Discord provides no way to stop server admins from moving app-created webhooks to other channels. The webhooksUpdate event is not a great solution on its own— it doesn't tell you the change that was made, or even which webhook was updated, only the channel which may contain other webhooks besides the bot's. It seems like to use this event for this purpose, you'd need to fetch the channel's webhooks (or fetch that specific webhook) to see if it has changed. An alternative if the bot has View Audit Logs permissions could be guildAuditLogEntryCreate, this event should provide the necessary information without having to request from rest. However, it's always possible that the bot may not have access to audit logs. I was just wondering if anyone else has a similar use case to mine, and what other solutions they may have in place 🙂
7 replies
DIAdiscord.js - Imagine an app
Created by nick. on 10/15/2023 in #djs-questions
Ban reasons are no longer showing up in audit logs
I’m using djs v14. Previously, ban reasons would show up in the server’s audit logs as expected. However, this functionality seems to have stopped working out of nowhere. At the time it stopped working, no code changes were made nor has my bot restarted. Has anyone else been experiencing similar issues? (It isn’t just bans, it is anything that supports an audit log reason)
65 replies
DIAdiscord.js - Imagine an app
Created by nick. on 5/17/2023 in #djs-questions
Gateway Rate Limits
Similar to the HTTP API, Discord has a Gateway rate limit (https://discord.com/developers/docs/topics/gateway#rate-limiting), with a maximum of 120 commands per 60 seconds. Discord.js handles rate limits for HTTP requests, does it handle Gateway rate limits as well, or must this be handled manually?
4 replies
DIAdiscord.js - Imagine an app
Created by nick. on 3/12/2023 in #djs-questions
Rate Limit sharing between Shards?
I'm unsure if this is the default behavior or not, but when you use RESTOptions#globalRequestsPerSecond, is this handled per-shard or is that state shared between all shards? I.e., does it behave as one may expect given its name in a sharded bot? (All shards respecting the same global rate limit)
7 replies
DIAdiscord.js - Imagine an app
Created by nick. on 2/23/2023 in #djs-questions
Prefix stdout with ShardingManager
Is there a convenient way e.x. in the sharding manager to intercept the process stdout/stderr from each shard and prefix the message with the shard ID?
3 replies
DIAdiscord.js - Imagine an app
Created by nick. on 7/22/2022 in #djs-questions
Implementation for something like …Manager.forge from discord.js-light
4 replies