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.Member
orNone
to indicate the member could not be found.
- async handle_role_change(member, coro, role)[source]¶
Await the given
coro
withrole
as the sole argument.Handle errors that we expect to be raised from
discord.Member.add_roles
anddiscord.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_roles
ordiscord.Member.remove_roles
.role (
Role
) – The role to be passed tocoro
.
- Return type: