Skip to content

Commit 4008fa9

Browse files
committed
Fix Guild::getVoiceRegions()
1 parent d35f3f8 commit 4008fa9

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/Discord/Parts/Guild/Guild.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,17 +628,26 @@ protected function getStageInstancesAttribute(): ExCollectionInterface
628628
}
629629

630630
/**
631-
* Gets the voice regions available.
631+
* Returns a list of voice region objects for the guild.
632+
*
633+
* Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.
632634
*
633-
* @link https://discord.com/developers/docs/resources/voice#list-voice-regions
635+
* @link https://docs.discord.com/developers/resources/guild#get-guild-voice-regions
634636
*
635637
* @return PromiseInterface<ExCollectionInterface<Region>|Region[]>
636-
*
637-
* @deprecated 10.23.0 Use `Discord::listVoiceRegions` instead.
638638
*/
639639
public function getVoiceRegions(): PromiseInterface
640640
{
641-
return $this->discord->listVoiceRegions();
641+
return $this->http->get(Endpoint::bind(Endpoint::GUILD_REGIONS, $this->id))->then(function ($response) {
642+
/** @var ExCollectionInterface<Region> $regions */
643+
$regions = $this->discord->getCollectionClass()::for(Region::class);
644+
645+
foreach ($response as $region) {
646+
$regions->pushItem($this->factory->part(Region::class, (array) $region, true));
647+
}
648+
649+
return $regions;
650+
});
642651
}
643652

644653
/**

0 commit comments

Comments
 (0)