Message Object

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

class antispam.message.Message(message_id, content, author_id, channel_id, guild_id)

Represents a lower level object needed to maintain messages

__eq__(other)

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

Checks everything besides message content to figure out if a message is the same or not

Parameters:other (Message) – 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

Notes

Does not check creation time, because that can be different and this is mainly used to ensure we don’t create duplicates and creation time is this class’s time not the message’s time

__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__(message_id, content, author_id, channel_id, guild_id)

Set & store a smaller object footprint then a standard message object for memory purposes :)

Parameters:
  • message_id (int) – The id of the message
  • content (String) – The actual message content
  • author_id (int) – The author of said message
  • channel_id (int) – The channel this message is in
  • guild_id (int) – The guild this message belongs to
Raises:

ValueError – When an item is not the correct ignore_type for conversion

Notes

This enforces strict types by conversion and ignore_type checking pass through of the correct ignore_type is required.

__module__ = 'antispam.message'
__repr__()

Return repr(self).

__slots__ = ['_id', '_channel_id', '_guild_id', '_content', '_author_id', '_creation_time', '_is_duplicate']
__str__()

Return str(self).

author_id
channel_id
content
creation_time
guild_id
id

The getter method

is_duplicate