members¶
Useful helper functions for interactin with discord.Member objects.
- async get_or_fetch_member(guild, member_id)[source]¶
Attempt to get a member from cache; on failure fetch from the API.
- Return type:
- Returns:
The
discord.MemberorNoneto indicate the member could not be found.
- async handle_role_change(member, coro, role)[source]¶
Await the given
corowithroleas the sole argument.Handle errors that we expect to be raised from
discord.Member.add_rolesanddiscord.Member.remove_roles.- Parameters:
member (
Member) – The member that is being modified for logging purposes.coro (
Callable[[Role],Coroutine]) – This is intended to bediscord.Member.add_rolesordiscord.Member.remove_roles.role (
Role) – The role to be passed tocoro.
- Return type: