New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RangeError: Shard 0 not found #9830
Comments
Are you really using no intents? |
I marked it wrong, I only use message intents |
|
const { Partials } = require("discord.js")
const { Client } = require('discord.js')
const myIntents = require('./intents')
module.exports = async function (token, data, clients, Discord) {
clients[data.CLIENTID] = new Client({ intents: myIntents, partials: [Partials.Channel] })
const handlers = ["event_handler"];
handlers.forEach(async handler => {
await require(`../handlers/${handler}`)(Discord, clients[data.CLIENTID], data);
});
try {
await clients[data.CLIENTID].login(token);
return { run: true, message: 'ok' }
} catch (error) {
clients.log.error(`error to starting the application`, { clientId: data.CLIENTID, error: error.code })
return { run: false, message: `Client: ${data.CLIENTID} \nErro: ${error.code}` }
}
}
"dependencies": {
"@discordjs/voice": "^0.15.0",
"@fastify/autoload": "^5.7.1",
"@fastify/jwt": "^6.7.1",
"@fastify/rate-limit": "^8.0.3",
"@logtail/node": "^0.4.5",
"@logtail/winston": "^0.4.5",
"axios": "^1.4.0",
"discord.js": "^14.12.1",
"dotenv": "^16.3.1",
"fastify": "^4.21.0",
"jsonwebtoken": "^9.0.1",
"sequelize": "^6.32.1",
"sqlite3": "^5.1.6",
"uuid": "^9.0.0",
"winston": "^3.10.0"
} |
Could you provide a minimal code sample (bare minimum code to reproduce the error) we could use to debug ourselves? I'm not sure we can help out with the unknowns and complexities as seen in your code. |
(async () => {
const { Partials, Client } = require('discord.js')
const db = [
{ CLIENTID: 'clientid1', TOKEN: 'token1' },
{ CLIENTID: 'clientid2', TOKEN: 'token2' },
{ CLIENTID: 'clientid3', TOKEN: 'token3' },
{ CLIENTID: 'clientid4', TOKEN: 'token4' }
]
const clients = {}
for (const key of db) {
clients[key.CLIENTID] = new Client({ intents: 130809, partials: [Partials.Channel] })
clients[key.CLIENTID].on('ready', (Discord, client) => {
const options = [{
type: ActivityType.Watching,
text: 'O melhor bot do discord',
status: 'online',
url: 'https://www.twitch.tv/thegomesplay'
},
{
type: ActivityType.Listening,
text: 'Powered by: AG Solutions',
status: 'online',
url: 'https://open.spotify.com/playlist/3B1c58XQcDWB0RkVclrgev?si=65c6e088f9474dd4'
},
{
type: ActivityType.Playing,
text: '100% automático',
status: 'dnd',
url: 'https://www.youtube.com/'
}]
setInterval(presence, 6000 * 10)
async function presence() {
const option = Math.floor(Math.random() * options.length)
await client.user.setPresence({
activities: [{
name: options[option].text,
type: options[option].type,
url: options[option].url
}],
status: options[option].status
})
}
});
await clients[key.CLIENTID].login(key.TOKEN)
}
})(); |
My code is separated by handlers and the bots' data is requested from an external database, but simply put, it is presented like this above |
I used the provided code sample and encountered no errors with 4 bots... so far? How long does it take to receive an error? Are you getting the error too with your code sample (which has minor errors in)? |
I run more than 4 bots, at the moment there are 763 |
@Jiralite any feedback? |
It is not feasible for us to reproduce this problem. It's also not really all that intended to run so many bots under one process - despite us sort of making an effort to support multiple |
Which package is this bug report for?
discord.js
Issue description
I'm getting an error when I try to change my bot's presence. My code changes the presence of several bots I have.
Code sample
This is in a loop where it runs every 60000 ms
Versions
"discord.js": "^14.12.1"
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
Message
Which gateway intents are you subscribing to?
Message
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: