Closed tyuop077 closed 3 years ago
guildCreate and guildUpdate should work correctly after the client is ready. The initial GUILD_CREATE events that are sent to fill up the cache at login are not emitted by the discord.js guildCreate event, they are handled internally to decide when the client should become ready.
If you're looking for the initial GUILD_CREATE events, you have to use shardConnect and raw.
other than that, im not sure im understanding the issue very well.
@timotejroiko Yeah, I thought of maybe implementing a new before-ready guild create event, because with shardConnect I still won't get thread objects (nevermind, it will work if i'll make thread manager sweep by interval instead of size = 0), only guilds. So raw
is only way to go with there :(
other than that, im not sure im understanding the issue very well
I was just trying to find a way to get guild and thread objects without using fetch, requests and raw (because bot still receives them), thank you
you can do something like this:
client.on("raw", raw => {
if(raw.t === "GUILD_CREATE" && !client.readyAt) {
const guild = client.guilds._add(raw.d, false)
}
})
that should create a discord.js guild object from the raw data without caching it (although it will cache channels and users if their respective caches are enabled)
thank you!
Currently there's no way to get guilds on launch with
ChannelManager
andGuildManager
being LimitedCollection with size = 0 without fetching them withclient.guilds.forge(exampleGuildId).channels.fetch()
(ChannelManager) andclient.guilds.forge(exampleGuildId).fetch()
(GuildManager) as example.client.on("raw",console.log)
shows, that we receiveGUILD_CREATE
events (with channels and threads) without getting them onguildCreate
orguildUpdate
(shardConnect
works for this option, but will do it only on sharding).I was collecting
parentId
's of guild channels and thread parentIds, so there's no way to get them at launch without fetching.Code:
messageCreate:
(leveling.channelMultipliers contains { Snowflake: number } with channel/category ids and multiplier values)