#Only spawn Shard but not ready

12 messages · Page 1 of 1 (latest)

valid relicBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

lavish dock
#

discord.js: v14.3.0
node: v16.14.2

#

my sharding code:

const manager = new ShardingManager('./mainbot.js', { 
    respawn: true
})

manager.on('shardCreate', shard => console.log(`Shard ${shard.id} sinh thanh cong!`))

manager.spawn({
    amount: 12,
    delay:10000,
    timeout:-1
})
nova scroll
#

Show how your mainbot.js looks

lavish dock
#

if it ready it should say Da dang nhap duoi ten Wheat#1261 but it doesn't

nova scroll
#

Nope, not normal… (async()=>{…})() won’t work as expected in subprocesses like shards are. Put the client declaration and login call at top level or at least synchronously

lavish dock
#

i have changed but it didn't happen anthing

require('events').EventEmitter.prototype._maxListeners = Infinity
require('events').defaultMaxListeners = Infinity
const { Collection, Client, GatewayIntentBits } = require('discord.js')
const bot = require('wheat-better-cmd')
const mongo = require('mongoose')
require('dotenv').config({path: 'secret.env'})
const announcement = require('./announcement.json')
// const member = require('./models/member')
// const servers = require('./models/server')
let members = []
let servers = []
const getServerUserDatabase = require('./modules/getServerUserDatabase')

const wheat = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent]})

wheat.login((process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'test' ? process.env.TOKEN : process.env.TOKEN2))

...
steady torrent
#

require('events').EventEmitter.prototype._maxListeners = Infinity
require('events').defaultMaxListeners = Infinity
you really shouldn't do that, btw

steady torrent
#

to not doing that at all

lavish dock
#

ok, i'll do that