DIA
discord.js - Imagine an appโœจ๐“œ๐“ช๐“ฒ๐“ฝ๐“ป๐“ฎ๐“–๐“”๐“”๐“šใƒ„โœจ

Sharding Questions

Hello, As my bot is nearly reaching the 2k servers. I need to prepare it to sharding but I have some questions to that : As I use a system like that :
const global_variables = {
/*For the users actually using the bot*/ plays: {} , /*For all users database*/users: {}, /*A cache containing songs that were played before */searchCache: []
}

module.exports = {
global_variables,
}
const global_variables = {
/*For the users actually using the bot*/ plays: {} , /*For all users database*/users: {}, /*A cache containing songs that were played before */searchCache: []
}

module.exports = {
global_variables,
}
Then I get all the values I need from that const. But as sharding is splitting my code in multiple processes, to gain performance I want these to be centralized in one file and accessible for all the shards at the same time without them to have each one a copy of that data. I made this system to generate less database calls but if each process need to call the database and save his part I will need to change that. Thanks !
DT
d.js toolkitโ€ข18d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
K
Kinect3000โ€ข18d ago
I wouldโ€™ve made a class that manages that One that can cache stuff and make db calls only when necessary You could also consider using Redis
โœจ๐“œ๐“ช๐“ฒ๐“ฝ๐“ป๐“ฎ๐“–๐“”๐“”๐“šใƒ„โœจโ€ข18d ago
Interesting, I'll try that, thanks Well I think he's not really a resource gourmand but as it's a Music Bot I don't know how it will handle in more than 1000 calls at the same time Yeah I know redis but I don't want to increase the amount of operation Local files and distant files Including Radio files
Want results from more Discord servers?
Add your server
More Posts
Repeating interactionIs there a way to use the 'interaction.update' multiple times? So i can make like one button after aWhat Discord.js features have the potential to hit the limit/go over the set Discord API limits?Where can I even find Discord's API limits? I just want to make sure that what I am doing with my boError when i do npm install discord.jsi donโ€™t know how to fix this at all and iโ€™m beyond confused iโ€™ve tried so many times i am useing VisSimple question, how can I check if an incoming message is *specifically* a slash command?How can I check to see if an incoming message (messageCreate) is a slash command? Sometimes a typo cdiscord voice enginehello im just asking if someone got an alternative discord voice engine that work on windowsDeleting Ephemeral MessagesIs there any sort of way to reply to an interaction privately and then delete the reply?Button Automatically PressingHello! Im currently working on a bot using oauth2. Im in the middle of rewriting how i handle refresBot joins the vc but audio doesn't playyes the path is correct. ```js var { voice } = message.member if(!voice.channelId) return mCommand handler changeWould it be possible (is there an example) of a command handler, that looks into a folder with all oMessage listener only on certain channels?Hey there! So I have this: ```js module.exports = { name: Events.MessageCreate, async execuApplication did not Respond!I am hosting a bot that can send image with ping like quality control but everytime i run a code theOpening handshake timeoutHi, I'm testing my bot and i make reboots often. I have and `Opening handshake has timed out` when help me to resolvei created a self role select menu . when i call the setup command and interact with the channel seleFetch messages from multiple channelsHeya, I need a solution to find active users in a guild, so the base idea is like a command that defRebuild Bot Guide IDSo, at the moment my config consists of `"guildId": "xxxxxxxxxxxxxxxx",` which is the guideID. IdeferReply without messagehow to turn off the message in inter.deferReply (not ephemeral: true)my code is not working!i can't get multiple roles uisng addroleopts```.addRoleOption(option => option .setName('role') How to register commands using .set() ( ill explain in thread )helloHow to query members of a voice channelHello, i would like to query all the members of a certain voice channel. But unfortunately i only g