Skip to content

Commit

Permalink
Chunk members from all guilds
Browse files Browse the repository at this point in the history
Check the `member_count` property given by Discord. If it is less than
the repository count, attempt to chunk the members
  • Loading branch information
davidcole1340 committed Mar 30, 2021
1 parent 8b3eb0e commit 96f1ce3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Discord/WebSockets/Events/GuildCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function handle(Deferred &$deferred, $data)
return $deferred->promise();
}

/** @var Guild */
$guildPart = $this->factory->create(Guild::class, $data, true);
foreach ($data->roles as $role) {
$role = (array) $role;
Expand Down Expand Up @@ -81,7 +82,7 @@ public function handle(Deferred &$deferred, $data)
}

$resolve = function () use (&$guildPart, $deferred) {
if ($guildPart->large) {
if ($guildPart->large || $guildPart->member_count > $guildPart->members->count()) {
$this->discord->addLargeGuild($guildPart);
}

Expand Down

0 comments on commit 96f1ce3

Please sign in to comment.