feat: add getGuildRoles
This commit is contained in:
parent
5512d0045e
commit
3c36b299db
@ -158,6 +158,7 @@ class Discord
|
||||
*
|
||||
* @return object|bool Ban object if user is banned. Null
|
||||
* @throws RequestException
|
||||
* @see https://discord.com/developers/docs/resources/guild#ban-object
|
||||
*/
|
||||
public function getGuildBan(): object|bool
|
||||
{
|
||||
@ -172,4 +173,20 @@ class Discord
|
||||
return ($ban->successful()) ? (object) $ban->json() : $ban->throwIf($ban->status() !== 404);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves list of Role objects
|
||||
* @see https://discord.com/developers/docs/topics/permissions#role-object
|
||||
* @return array List of role objects
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function getGuildRoles(): array {
|
||||
return Http::withHeaders([
|
||||
'Authorization' => 'Bot ' . config('services.discord.token')
|
||||
])->get(config('services.discord.base_url') . "/guilds/{$this->workingGuild}/roles")
|
||||
->throw()
|
||||
->json();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user