#Only spawn Shard but not ready
12 messages · Page 1 of 1 (latest)
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
})
Show how your mainbot.js looks
well it's just a normal bot start file
if it ready it should say Da dang nhap duoi ten Wheat#1261 but it doesn't
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
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))
...
require('events').EventEmitter.prototype._maxListeners = Infinity
require('events').defaultMaxListeners = Infinity
you really shouldn't do that, btw
what should i change to @@
to not doing that at all
ok, i'll do that