MoonlightCapital
DIAdiscord.js - Imagine an app
•Created by MoonlightCapital on 11/12/2023 in #djs-questions
`client.generateInvite()` undefined domain after update
After updating to 14.14.0, generating an invite returns an undefined domain instead of
discord.com/api
. This is immediately noticeable by trying to put the generate invite into an URL button
Sample code:
Node.js v21.1.04 replies
DIAdiscord.js - Imagine an app
•Created by MoonlightCapital on 4/22/2023 in #djs-questions
Are those checks enough to avoid a "missing permission" error?
I'm making a command that sets up a mute role, and it seems like I incurred in errors in a few channels. Are those checks enough to ensure that the bot filters only channel where it can edit permission overwrites?
5 replies
DIAdiscord.js - Imagine an app
•Created by MoonlightCapital on 12/7/2022 in #djs-questions
Fetching data from a database, filtering it by only guilds handled by the shard
I have a database containing data about multiple guilds, and i have to fetch some generic data (not necessarily related to a guild in particular), but I want to restrict the results to the entries that have their guild handled by the current shard.
Database is MongoDB, and I use Mongoose.
Now, I have found a few possible solutions, like:
- Filtering the data after having received it from the DB. This potentially results in a lot of memory waste for entries that are better handler by other shards
- Use $in and pass
client.guilds.cache.map(g=>g.id)
, which seems a bit weird considering a shard can be handling a lot of guilds at once
- Use $where, and use the bitwise shift formula, hoping mongo supports BigInt
Is there an efficient way to make this filter, or something I haven't thought of?9 replies