Guild Object

Note, this class should not be used by you. Only use the AntiSpamHandler to work with this package.

class antispam.guild.Guild(bot, guild_id, options, *, custom_options=False)

Represents a guild that maintains a collection of User’s

__eq__(other)

This is called with a ‘obj1 == obj2’ comparison object is made

Checks against stored id’s to figure out if they are representing the same User or not

Parameters:other (Guild) – The object to compare against
Returns:True or False depending on whether they are the same or not
Return type:bool
Raises:ValueError – When the comparison object is not of ignore_type Message
__hash__()

Given we create a __eq__ dunder method, we also needed to create one for __hash__ lol

Returns:The hash of all id’s
Return type:int
__init__(bot, guild_id, options, *, custom_options=False)
Parameters:
  • bot (commands.Bot) – The global bot instance
  • guild_id (int) – This guilds id
  • options (dict) – The options for this guild
  • custom_options (bool) – Whether this guild has custom options or not
__module__ = 'antispam.guild'
__repr__()

Return repr(self).

__slots__ = ['_id', '_bot', '_users', '_options', 'has_custom_options']
__str__()

Return str(self).

has_custom_options
id
static load_from_dict(bot, guild_data)

Loads the guild based on the passed data

Parameters:
  • bot (commands.Bot) – The bot
  • guild_data (dict) – The data to load from
Returns:

Return type:

Guild

options
propagate(message: discord.message.Message)

This method handles a message object and then adds it to the relevant member

Parameters:message (discord.Message) – The message that needs to be propagated out
Returns:A dictionary of useful information about the user in question
Return type:dict

Warning

Calling this method yourself will bypass all checks

save_to_dict() → dict

Returns a dictionary that can be used to reload state at a later time

Returns:The data required to reload state
Return type:dict
users