discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
985 stars 236 forks source link

Member is not returning anything. #968

Closed cemalct closed 1 year ago

cemalct commented 1 year ago

$member = $guild->members->get('id', $interaction['user']->id);

While $guild returns the entire guild, can't get information related with member. Imported Discord\Parts\User\Member, still not working. The event I'm trying to get member;

$discord->on(Event::INTERACTION_CREATE, function (Interaction $interaction, Discord $discord) use ($guild)

key2peace commented 1 year ago

is the bot only in one guild and you made $guild being globally available in your entire script?

cemalct commented 1 year ago

Yes, also guild is already loaded with server's id. $guild retrieves everything related with that server, but can't use member.

key2peace commented 1 year ago

get on https://discord.gg/dphp #discordphp

SQKo commented 1 year ago

The answer is to use $interaction->member