Module Contents¶
Classes¶
A usefull class to track invites of member whenever a user is invited to a guild. |
- class DiscordUtils.invitetracker.InviteTracker(bot)[source]¶
A usefull class to track invites of member whenever a user is invited to a guild.
- Parameters
bot (Union[Client, AutoShardedClient, Bot, AutoSharededBot]) –
- Attributes
bot: The default bot class.
- _cache:
dict A dict to cache
GuildinstancesInvite
- _cache:
- __slots__ = ['bot', '_cache']¶
- add_listeners(self)[source]¶
It adds the following listeners to the
Botinstance.- Mapping
Function
Discord Function
on_ready()on_invite_create()on_invite_delete()on_guild_join()on_guild_remove()- Return type
- await cache_invites(self)[source]¶
It cache the guild invites automatically whenever the
on_ready()event is fired- Return type
- await update_invite_cache(self, invite)[source]¶
It updates the invite cache automatically whenever the
on_invite_create()event is fired- Parameters
invite (discord.invite.Invite) –
- Return type
- await remove_invite_cache(self, invite)[source]¶
It removes the invite cache of the deleted invite automatically whenever the
on_invite_delete()event is fired- Parameters
invite (discord.invite.Invite) –
- await add_guild_cache(self, guild)[source]¶
It adds the guild to cache automatically whenever the
on_guild_join()event is fired- Parameters
guild (discord.guild.Guild) –
- Return type
- await remove_guild_cache(self, guild)[source]¶
It removes the guild from cache automatically whenever the
on_guild_remove()event is fired- Parameters
guild (discord.guild.Guild) –
- Return type
- await fetch_inviter(self, member)[source]¶
This utility function returns the
Inviteclass which was used when the member joined the guild.- Parameters
member (discord.Member) – The member which joined the guild. (The
Memberrecieved duringon_member_join()event)- Returns
If the member was bot i.e. invited via integration then it would return
None- Return type
Optional[discord.Invite]