#Sharding is Required | Bot doesn't respond
70 messages · Page 1 of 1 (latest)
by waiting for someone that has the time. you just need to be patient. this is volunteer help and everyone has their own lives.
im not good with sharding either, but please at least have some patience
notice that you try to listen to the shardCreate event only after actually creating the shards with spawn, the guide creates a listener first and then uses spawn
well it seems to me like your current code won't log the Lauching shard ... message
i guess that's fine then
also what do you mean by "the bot doesn't respond"? to what?
can you send it?
bot.js would be nice to see as well
are you using v14? you should be using the messageCreate event
also, totalShards & shardList aren't valid options in v14, but there is shards and shardCount. partials also do not accept strings, especially SCREAMING_SNAKE. you'll need to use the Partials enum for that as well as changing your event name to messageCreate
instead of message
you also need the GuildMessages intent for getting guild messages. not sure if you're trying to listen to DMs or not
not in the code shown
are you asking what the purpose of them is?
not sure what you mean
do you mean pass intents?
the guide covers this
that doesnt really make sense
okay so you need the Guilds, GuildMessages and MessageContent intent
If you aren't getting content, embeds or attachments of a message, make sure you have the MessageContent intent enabled in the Developer Portal and provide it to your client:
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
because that is required for using the gateway
and recieving event data
i basically just said that above
please show your updated code
why?
that doesnt cause responses to be sent multiple times
please look at this. i am not an expert at sharding
i'm not sure that you should be using shards and shardCount here, the guide certainly doesn't
you mean your http server?
not sure what that means but you're trying to use bot.js from there as well, i don't know exactly if that would actually work depending on how you use it
it's fine
how do you get the list?
right but this doesn't really tell me anything, i need the line of code inside of the serverpage.processServer function which gets the list of guilds
this doesn't look like processServer to me
i don't see where you load guilds in this code
you might need to start using the manager variable inside of this code from now on instead of importing bot.js
i guess it's called shard.js
no, this isn't related to partials
you are trying to use bot.js from shard.js, but there the Client would not be started
you should re-read this because it explains that separate processes are ran, and every process would have a different client
your main process would have a different client too
seems like you have to change a lot of things to implement sharding like this, mainly because you can't use bot.js from shard.js
i don't think that's what i meant
yes
not like this at least
without sharding it would've been fine but with sharding you can't unfortunately
when using ShardingManager, yes
you have to change everything that uses the bot.js client inside of shard.js
i'm not sure, it depends on what the code is doing, because currently your code assumes that there's a single instance of a client, when sharding creates multiple
ah i guess any functions here can't really be used correctly
every single shard runs index.js, meaning every shard has a different Client instance and a different bot.js instance
this means that every single variable inside of bot.js that you try to use inside of shard.js will be different from the shards
that doesn't change anything, each shard would still run that code on its own with a different Client instance
you need to move the cache parts of bot.js to shard.js
that's probably it? also every single part of code that uses bot.client inside of shard.js should be changed too
show the updated shard.js code please
it would've been better to begin this process before reaching 2500 guilds, but that doesn't matter anymore
it's a requirement from discord. not really based on popularity
sorry i gtg
Sharding: Getting started