-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Got the problem that member count is being null most of the time. The behavior that I got on a server with 700+ members:
- on the first iteration,
memberCountisnull - on the second iteration,
memberCountis set to actual one that is on the server. - after entering voice chats and leaving from them,
memberCountbecomesnull, and doesn't recover from that even after several minutes.
here is the code used.
@OptIn(PrivilegedIntent::class)
suspend fun main() {
val kord = Kord(System.getenv("TOKEN"))
val guildId = Snowflake(System.getenv("GUILD_ID"))
kord.on<ReadyEvent> {
val guild = kord.getGuild(guildId)
coroutineScope {
while (isActive) {
val guildData = guild.fetchGuild()
println("${guildData.memberCount} / ${guildData.voiceStates.filter { it.channelId != null }.count()}")
delay(1000)
}
}
}
kord.login {
intents += Intents(Intent.Guilds, Intent.GuildMembers, Intent.GuildVoiceStates)
}
}tried using rest supplier, but memberCount is always null. found out that by default withCounts in GuildService.getGuild is false, and there is no place to tweak it. Used GuildService directly via kord.rest.guild with withCounts = true, but the memberCount is Optional.Missing,
Then reverted back to using code above, and tested leaving and joining the server, to test how fast guild.memberCount is updated. Found out that after 5 minutes it still doesn't update.
Is there any workarounds to make it more "realtime"?
Metadata
Metadata
Assignees
Labels
No labels