wohali/oauth2-discord-new

Guilds

StrangerGithuber opened this issue · 4 comments

Hello
I am new in this and I am curious how can I get the guilds where the member is in?
I need the guild id, name and owner.
If I can't get the owner of the servers then how can I get the guild ID and guild name?
Another question is if there is a function where I can retrieve if the member has a server and which one?
Thank you in advance the answers. 👍

Ehh solved. I only need send the member ID to the bot and then I will get the servers.

Glad you worked it out on your own!

@StrangerGithuber Care to share your solution? I can't figure out how to access the authenticated user's guilds after logging in. 🤔 Thank you!

@oliverschloebe
Heya, it's a bit tricky but you can retrieve the guilds with just using this library here - although not documented at all, maybe i'll PR a change to the readme for it if i got enough time

In order to get the guilds you need to create a new request to the endpoint for the guilds, remember to set your scopes accordingly so you surely have access to that endpoint ;D

`
$guildsRequest = $provider->getAuthenticatedRequest('GET', $provider->getResourceOwnerDetailsUrl($token) . '/guilds', $token);

$guilds = $provider->getParsedResponse($guildsRequest);

var_dump($guilds);
`

For information on every endpoint available please visit https://discordapp.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes

Cheers!