Stev
Explore posts from serversDIAdiscord.js - Imagine an app
•Created by Stev on 6/22/2023 in #djs-questions
shardCreate/ShardingManager with shards: 'auto'?
Possibly a dumb question about sharding — I apologize if it is.
I'm using
shards: 'auto'
. This is because for this specific bot, I'm only in around 40K servers and I only use around 2GB RAM.
If I use a ShardingManager
, and each process/worker has a MySQL connection pool using mysql2
, the RAM usage increases drastically; I believe this is because it always keeps a connection open to improve performance... and MySQL reserves a lot of RAM for each connection. I end up maxing-out my VPS' 24GB.
Is there an equivalent to ShardingManager.on('shardCreate', ...)
, or just a sharding manager in general, when using shards: 'auto'
?
Is there another approach you'd recommend to reduce resource usage than using shards: 'auto'
?
Cheers!4 replies
SIASapphire - Imagine a framework
•Created by Stev on 6/21/2023 in #sapphire-support
Sapphire-like Listeners for other Emitters, such as ShardManager?
Probably a stupid question, but I've looked and haven't found any.
Does Sapphire support listeners for other emitters? For example, if I want to listen for the
shardCreate
event of ShardManager
.
Sapphire makes event handling so simple, so I figured I'd hope that there is, instead of going manual.
Thanks!5 replies
SIASapphire - Imagine a framework
•Created by Stev on 5/11/2023 in #sapphire-support
Custom Events not Creating Listeners
I'm having issues using Sapphire with custom events. For example, I have an event for when a member subscribes to a role:
Then, in another Sapphire listener:
My issue is that with custom named events, Sapphire doesn't seem to register all of them. For example, I'll have
guildMemberDemoted
, guildMemberPromoted
, guildMemberSubscribed
, and guildMemberUnsubscribed
.
guildMemberDemoted
will fire off, but guildMemberPromoted
does not. If I check the client for a guildMemberPromoted
listener, none exists.
I thought maybe I'd have to increase the max listeners for the client, but that also doesn't work.
Any ideas?7 replies
SIASapphire - Imagine a framework
•Created by Stev on 2/16/2023 in #sapphire-support
Registering commands and other paths
Hi guys! I'm having some troubles.
When I use
sapphire new
, everything works as intended. The commands in the commands
directory are registered properly.
However, if I do not use sapphire new
and try to add it to an existing project, without sapphire init
, it doesn't register the commands. After looking into it, and logging the stores, I see that the paths should be C:/.../myProject/bin/commands
, but the path is showing C:/.../myProject/commands
. Even if I copy the .sapphirerc.json
from the other working one.
Why does this happen? I've tried using sapphire init
with the same problem - it looks a directory up.
I cannot see anywhere in the working project, using sapphire new
, where any additional configuration is added.
Thanks!5 replies
DIAdiscord.js - Imagine an app
•Created by Stev on 7/12/2022 in #djs-questions
Stumped with GuildAuditLogsEntry & TypeScript...
I'm kinda stumped with audit logs. I'm looking to get a few audit log entries of all recent actions of a user, and then create a simple embed.
Here's an example of my problem:
What am I doing wrong?
3 replies
DIAdiscord.js - Imagine an app
•Created by Stev on 6/22/2022 in #djs-questions
REST randomly forgets token set with setToken
I'm using
@discordjs/rest
and Fastify
for HTTPS interactions. I'm initiating my REST client with:
The bot works fine for roughly a day before suddenly rejecting all requests with: Error: Expected token to be set for this request, but none was present
https://github.com/discordjs/discord.js/blob/65d1879c0ae2d8d820323d0d835b1e5e3d071e57/packages/rest/src/lib/RequestManager.ts#L364
I can not, for the life of me, figure out why rest
is consistently forgetting its token after roughly a day of operation. What am I missing?14 replies