#guild_id in MemberRemove

1 messages · Page 1 of 1 (latest)

boreal widget
#

I read the Discord docs, and when that event is dispatched, it sends a User (which can be a Member if i.py caches it on time), and a guild_id. The thing is, how to get the guild_id, since in this code:

    @interactions.listen(interactions.events.MemberRemove)
    async def on_guild_member_remove(
        self, _member: interactions.events.MemberRemove
    ) -> None:
        ...

It only needs a _member to dispatch. How can I get the guild_id too?

marble fogBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

desert wolf
#

_member.guild_id?

#

or _member.guild.id?

boreal widget
#

Tried those 2.

#

I notice that guild_id will always return (seems like it is intended to), and guild.id can be None sometimes.

#

Probably I will use the guild_id for more reliable.

#

Also, what's the difference between get_guild() and fetch_guild(), actually?

#

I know that fetch uses the API too.

#

But if it uses the API, will it return the dict type instead of Guild?

desert wolf
#

It will convert dict to Guild object