Classes#

Tracing#

TraceLEVELS#

enum daf.logging.tracing.TraceLEVELS(value)#

Levels of trace for debug.

See also

trace

Changed in version v2.3: Added DEPRECATION

Member Type:

int

Valid values are as follows:

DEPRECATED = <TraceLEVELS.DEPRECATED: 0>#

Show only deprecation notices.

ERROR = <TraceLEVELS.ERROR: 1>#

Show deprecations and errors.

WARNING = <TraceLEVELS.WARNING: 2>#

Show deprecations, errors, warnings.

NORMAL = <TraceLEVELS.NORMAL: 3>#

Show deprecations, errors, warnings, info messages.

DEBUG = <TraceLEVELS.DEBUG: 4>#

Show deprecations, errors, warnings, info messages, debug messages.

Message data types#

EMBED#

class daf.dtypes.EMBED(*, author_name: str = None, author_icon: str = Embed.Empty, image: str = None, thumbnail: str = None, fields: List[EmbedField] = None, colour: Union[int, Colour] = Embed.Empty, color: Union[int, Colour] = Embed.Empty, title: str = Embed.Empty, type: str = 'rich', url: str = Embed.Empty, description=Embed.Empty, timestamp: datetime = None)#

Deprecated since version v2.2: Use discord.Embed instead.

Warning

USING this is NOT recommended as it is planned for removal. Use discord.Embed instead.

Derived class of discord.Embed created to provide additional arguments in the creation.

Original parameters from PyCord: PyCord docs

Parameters:
  • author_name (str) – Name of embed author

  • author_icon (str) – Url to author image.

  • image (str) – Url of image to be placed at the end of the embed.

  • thumbnail (str) – Url of image that will be placed at the top right of embed.

FILE#

class daf.dtypes.FILE(filename: str)#

FILE object used as a data parameter to the MESSAGE objects. This is needed opposed to a normal file object because this way, you can edit the file after the framework has already been started.

Warning

This is used for sending an actual file and NOT it’s contents as text.

Parameters:

filename (str) – Path to the file you want sent.

AUDIO#

class daf.dtypes.AUDIO(filename: str)#

Used for streaming audio from file or YouTube.

Note

Using a youtube video, will cause the shilling start to be delayed due to youtube data extraction.

Parameters:

filename (str) – Path to the file you want streamed or a YouTube video url.

Raises:

ValueError – Raised when the file or youtube url is not found.

to_dict()#

Returns dictionary representation of this data type.

Changed in version v2.0: Changed to method to_dict from property filename

Automatic generation#

AutoCHANNEL#

class daf.message.AutoCHANNEL(include_pattern: str, exclude_pattern: Optional[str] = None, interval: Optional[timedelta] = datetime.timedelta(seconds=300))#

New in version v2.3.

Used for creating instances of automatically managed channels. The objects created with this will automatically add new channels at creation and dynamically while the framework is already running, if they match the patterns.

Listing 14 Usage#
# TextMESSAGE is used here, but works for others too
daf.message.TextMESSAGE(
     ..., # Other parameters
     channels=daf.message.AutoCHANNEL(...)
 )
Parameters:
  • include_pattern (str) – Regex pattern to match for the channel to be considered.

  • exclude_pattern (str) –

    Regex pattern to match for the channel to be excluded from the consideration.

    Note

    If both include_pattern and exclude_pattern yield a match, the guild will be excluded from match.

  • interval (Optional[timedelta] = timedelta(minutes=5)) – Interval at which to scan for new channels.

property channels: List[Union[TextChannel, VoiceChannel]]#

Property that returns a list of discord.TextChannel or discord.VoiceChannel (depends on the xMESSAGE type this is in) objects in cache.

async initialize(parent, channel_type: str)#

Initializes async parts of the instance. This method should be called by parent.

Parameters:
  • parent (message.BaseMESSAGE) – The message object this AutoCHANNEL instance is in.

  • channel_type (str) – The channel type to look for when searching for channels

remove(channel: Union[TextChannel, VoiceChannel])#

Removes channel from cache.

Parameters:

channel (Union[discord.TextChannel, discord.VoiceChannel]) – The channel to remove from cache.

Raises:

KeyError – The channel is not in cache.

async update(**kwargs)#

Updates the object with new initialization parameters.

Parameters:

kwargs (Any) – Any number of keyword arguments that appear in the object initialization.

Raises:

Any – Raised from initialize() method.

AutoGUILD#

class daf.guild.AutoGUILD(include_pattern: str, exclude_pattern: Optional[str] = None, remove_after: Optional[Union[timedelta, datetime]] = None, messages: Optional[List[BaseMESSAGE]] = [], logging: Optional[bool] = False, interval: Optional[timedelta] = datetime.timedelta(seconds=600))#

New in version v2.3.

Used for creating instances that will return guild objects.

Caution

Any objects passed to AutoGUILD get deep-copied meaning, those same objects will not be initialized and cannot be used to obtain/change information regarding AutoGUILD.

Listing 15 Illegal use of AutoGUILD#
auto_ch = daf.AutoCHANNEL(...)
tm = daf.TextMESSAGE(..., channels=auto_ch)

await daf.add_object(AutoGUILD(..., messages=[tm]))

auto_ch.channels # Illegal (does not represent the same object as in AutoGUILD), results in exception
await tm.update(...) # Illegal (does not represent the same object as in AutoGUILD), results in exception

To actually modify message/channel objects inside AutoGUILD, you need to iterate thru each GUILD.

Listing 16 Modifying AutoGUILD messages#
aguild = daf.AutoGUILD(..., messages=[tm])
await daf.add_object(aguild)

for guild in aguild.guilds:
    for message in guild.messages
        await message.update(...)
Parameters:
  • include_pattern (str) – Regex pattern to use when searching guild names that are to be included.

  • exclude_pattern (Optional[str] = None) –

    Regex pattern to use when searching guild names that are NOT to be excluded.

    Note

    If both include_pattern and exclude_pattern yield a match, the guild will be excluded from match.

  • remove_after (Optional[Union[timedelta, datetime]] = None) – When to remove this object from the shilling list.

  • logging (Optional[bool] = False) – Set to True if you want the guilds generated to log sent messages.

  • interval (Optional[timedelta] = timedelta(minutes=10)) – Interval at which to scan for new guilds

property guilds: List[GUILD]#

Returns cached found GUILD objects.

property created_at: datetime#

Returns the datetime of when the object has been created.

async initialize()#

Initializes asynchronous elements.

async add_message(message: BaseMESSAGE)#

Adds a copy of the passed message to each guild inside cache.

Parameters:

message (message.BaseMESSAGE) – Message to add.

Raises:

Any – Any exception raised in daf.guild.GUILD.add_message().

remove_message(message: BaseMESSAGE)#

Removes message from the messages list.

Parameters:

message (BaseMESSAGE) – The message to remove.

Raises:

ValueError – The message is not present in the list.

async update(**kwargs)#

Updates the object with new initialization parameters.

Warning

After calling this method the entire object is reset (this includes it’s GUILD objects in cache).

Messages#

TextMESSAGE#

class daf.message.TextMESSAGE(start_period: Optional[Union[int, timedelta]], end_period: Union[int, timedelta], data: Union[str, EMBED, Embed, FILE, Iterable[Union[str, EMBED, Embed, FILE]], _FunctionBaseCLASS], channels: Union[Iterable[Union[int, TextChannel, Thread]], AutoCHANNEL], mode: Literal['send', 'edit', 'clear-send'] = 'send', start_in: Union[timedelta, bool] = datetime.timedelta(0), remove_after: Optional[Union[int, timedelta, datetime]] = None)#

This class is used for creating objects that represent messages which will be sent to Discord’s TEXT CHANNELS.

Deprecated since version v2.1:

  • start_in (start_now) - Using bool value to dictate whether the message should be sent at framework start.

  • start_period, end_period - Using int values, use timedelta object instead.

Changed in version v2.1:

  • start_period, end_period Accept timedelta objects.

  • start_now - renamed into start_in which describes when the message should be first sent.

  • removed deleted property

Changed in version v2.3:

Slow mode period handling:

When the period is lower than the remaining time, the framework will start incrementing the original period by original period until it is larger then the slow mode remaining time.

Parameters:
  • start_period (Union[int, timedelta, None]) –

    The value of this parameter can be:

    • None - Use this value for a fixed (not randomized) sending period

    • timedelta object - object describing time difference, if this is used, then the parameter represents the bottom limit of the randomized sending period.

  • end_period (Union[int, timedelta]) –

    If start_period is not None, then this represents the upper limit of randomized time period in which messages will be sent. If start_period is None, then this represents the actual time period between each message send.

    Caution

    When the period is lower than the remaining time, the framework will start incrementing the original period by original period until it is larger then the slow mode remaining time.

    Listing 17 Randomized sending period between 5 seconds and 10 seconds.#
    # Time between each send is somewhere between 5 seconds and 10 seconds.
    daf.TextMESSAGE(start_period=timedelta(seconds=5), end_period=timedelta(seconds=10), data="Second Message", channels=[12345], mode="send", start_in=timedelta(seconds=0))
    
    Listing 18 Fixed sending period at 10 seconds#
    # Time between each send is exactly 10 seconds.
    daf.TextMESSAGE(start_period=None, end_period=timedelta(seconds=10), data="Second Message", channels=[12345], mode="send", start_in=timedelta(seconds=0))
    

  • data (Union[str, EMBED, discord.Embed, FILE, List[Union[str, EMBED, discord.Embed, FILE]], _FunctionBaseCLASS]) –

    The data parameter is the actual data that will be sent using discord’s API. The data types of this parameter can be:
    • str (normal text),

    • EMBED

    • discord.Embed,

    • FILE,

    • List/Tuple containing any of the above arguments (There can up to 1 string, up to 1 EMBED / discord.Embed and up to 10 FILE objects. If more than 1 string or embeds are sent, the framework will only consider the last found).

    • Function that accepts any amount of parameters and returns any of the above types. To pass a function, YOU MUST USE THE data_function decorator on the function before passing the function to the daf.

  • channels (Union[Iterable[Union[int, discord.TextChannel, discord.Thread]], daf.message.AutoCHANNEL]) –

    Changed in version v2.3: Can also be AutoCHANNEL

    Channels that it will be advertised into (Can be snowflake ID or channel objects from PyCord).

  • mode (str) –

    Parameter that defines how message will be sent to a channel. It can be:

    • ”send” - each period a new message will be sent,

    • ”edit” - each period the previously send message will be edited (if it exists)

    • ”clear-send” - previous message will be deleted and a new one sent.

  • start_in (timedelta) – When should the message be first sent.

  • remove_after (Optional[Union[int, timedelta, datetime]]) –

    Deletes the message after:

    • int - provided amounts of sends

    • timedelta - the specified time difference

    • datetime - specific date & time

generate_log_context(text: Optional[str], embed: Union[Embed, EMBED], files: List[FILE], succeeded_ch: List[Union[TextChannel, Thread]], failed_ch: List[Dict[str, Any]]) Dict[str, Any]#

Generates information about the message send attempt that is to be saved into a log.

Parameters:
Returns:

{
    sent_data:
    {
        text: str - The text that was sent,
        embed: Dict[str, Any] - The embed that was sent,
        files: List[str] - List of files that were sent
    },

    channels:
    {
        successful:
        {
            id: int - Snowflake id,
            name: str - Channel name
        },
        failed:
        {
            id: int - Snowflake id,
            name: str - Channel name,
            reason: str - Exception that caused the error
        }
    },
    type: str - The type of the message, this is always TextMESSAGE,
    mode: str - The mode used to send the message (send, edit, clear-send)
}

Return type:

Dict[str, Any]

async initialize(parent: Any)#

This method initializes the implementation specific api objects and checks for the correct channel input context.

Parameters:

parent (daf.guild.GUILD) – The GUILD this message is in

Raises:
  • TypeError – Channel contains invalid channels

  • ValueError – Channel does not belong to the guild this message is in.

  • ValueError – No valid channels were passed to object”

async update(_init_options: Optional[dict] = {}, **kwargs: Any)#

New in version v2.0.

Used for changing the initialization parameters the object was initialized with.

Warning

Upon updating, the internal state of objects get’s reset, meaning you basically have a brand new created object.

Parameters:

**kwargs (Any) – Custom number of keyword parameters which you want to update, these can be anything that is available during the object creation.

Raises:
  • TypeError – Invalid keyword argument was passed

  • Other – Raised from .initialize() method.

DirectMESSAGE#

class daf.message.DirectMESSAGE(start_period: Optional[Union[int, timedelta]], end_period: Union[int, timedelta], data: Union[str, EMBED, Embed, FILE, Iterable[Union[str, EMBED, Embed, FILE]], _FunctionBaseCLASS], mode: Literal['send', 'edit', 'clear-send'] = 'send', start_in: Union[timedelta, bool] = datetime.timedelta(0), remove_after: Optional[Union[int, timedelta, datetime]] = None)#

This class is used for creating objects that represent messages which will be sent to Discord’s TEXT CHANNELS.

Deprecated since version v2.1:

  • start_in (start_now) - Using bool value to dictate whether the message should be sent at framework start.

  • start_period, end_period - Using int values, use timedelta object instead.

Changed in version v2.1:

  • start_period, end_period Accept timedelta objects.

  • start_now - renamed into start_in which describes when the message should be first sent.

  • removed deleted property

Parameters:
  • start_period (Union[int, timedelta, None]) –

    The value of this parameter can be:

    • None - Use this value for a fixed (not randomized) sending period

    • timedelta object - object describing time difference, if this is used, then the parameter represents the bottom limit of the randomized sending period.

  • end_period (Union[int, timedelta]) –

    If start_period is not None, then this represents the upper limit of randomized time period in which messages will be sent. If start_period is None, then this represents the actual time period between each message send.

    Listing 19 Randomized sending period between 5 seconds and 10 seconds.#
    # Time between each send is somewhere between 5 seconds and 10 seconds.
    daf.DirectMESSAGE(start_period=timedelta(seconds=5), end_period=timedelta(seconds=10), data="Second Message",  mode="send", start_in=timedelta(seconds=0))
    
    Listing 20 Fixed sending period at 10 seconds#
    # Time between each send is exactly 10 seconds.
    daf.DirectMESSAGE(start_period=None, end_period=timedelta(seconds=10), data="Second Message",  mode="send", start_in=timedelta(seconds=0))
    

  • data (Union[str, EMBED, discord.Embed FILE, List[Union[str, EMBED, discord.Embed, FILE]], _FunctionBaseCLASS]) –

    The data parameter is the actual data that will be sent using discord’s API. The data types of this parameter can be:
    • str (normal text),

    • EMBED,

    • discord.Embed,

    • FILE,

    • List/Tuple containing any of the above arguments (There can up to 1 string, up to 1 EMBED / discord.Embed and up to 10 FILE objects. If more than 1 string or embeds are sent, the framework will only consider the last found).

    • Function that accepts any amount of parameters and returns any of the above types. To pass a function, YOU MUST USE THE data_function decorator on the function before passing the function to the daf.

  • mode (str) –

    Parameter that defines how message will be sent to a channel. It can be:

    • ”send” - each period a new message will be sent,

    • ”edit” - each period the previously send message will be edited (if it exists)

    • ”clear-send” - previous message will be deleted and a new one sent.

  • start_in (timedelta) – When should the message be first sent.

  • remove_after (Optional[Union[int, timedelta, datetime]]) –

    Deletes the guild after:

    • int - provided amounts of sends

    • timedelta - the specified time difference

    • datetime - specific date & time

generate_log_context(success_context: Dict[str, Optional[Union[bool, Exception]]], text: Optional[str], embed: Optional[Union[Embed, EMBED]], files: List[FILE]) Dict[str, Any]#

Generates information about the message send attempt that is to be saved into a log.

Parameters:
  • text (str) – The text that was sent.

  • embed (Union[discord.Embed, EMBED]) – The embed that was sent.

  • files (List[FILE]) – List of files that were sent.

  • success_context (Dict[bool, Exception]) – Dictionary containing information about succession of the DM attempt. Contains “success”: bool key and “reason”: Exception key which is only present if “success” is False

Returns:

{
    sent_data:
    {
        text: str - The text that was sent,
        embed: Dict[str, Any] - The embed that was sent,
        files: List[str] - List of files that were sent.
    },
    success_info:
    {
        success: bool - Was sending successful or not,
        reason:  str  - If it was unsuccessful, what was the reason
    },
    type: str - The type of the message, this is always DirectMESSAGE,
    mode: str - The mode used to send the message (send, edit, clear-send)
}

Return type:

Dict[str, Any]

async initialize(parent: Any)#

The method creates a direct message channel and returns True on success or False on failure

Changed in version v2.1: Renamed user to and changed the type from discord.User to daf.guild.USER

Parameters:

parent (daf.guild.USER) – The USER this message is in

Raises:

ValueError – Raised when the direct message channel could not be created

async update(_init_options: Optional[dict] = {}, **kwargs)#

New in version v2.0.

Used for changing the initialization parameters the object was initialized with.

Warning

Upon updating, the internal state of objects get’s reset, meaning you basically have a brand new created object.

Parameters:

kwargs (Any) – Custom number of keyword parameters which you want to update, these can be anything that is available during the object creation.

Raises:
  • TypeError – Invalid keyword argument was passed

  • Other – Raised from .initialize() method

VoiceMESSAGE#

class daf.message.VoiceMESSAGE(start_period: Optional[Union[int, timedelta]], end_period: Union[int, timedelta], data: Union[AUDIO, Iterable[AUDIO], _FunctionBaseCLASS], channels: Union[Iterable[Union[int, VoiceChannel]], AutoCHANNEL], volume: int = 50, start_in: Union[timedelta, bool] = datetime.timedelta(0), remove_after: Optional[Union[int, timedelta, datetime]] = None)#

This class is used for creating objects that represent messages which will be streamed to voice channels.

Deprecated since version v2.1:

  • start_in (start_now) - Using bool value to dictate whether the message should be sent at framework start.

  • start_period, end_period - Using int values, use timedelta object instead.

Changed in version v2.1:

  • start_period, end_period Accept timedelta objects.

  • start_now - renamed into start_in which describes when the message should be first sent.

  • removed deleted property

Parameters:
  • start_period (Union[int, timedelta, None]) –

    The value of this parameter can be:

    • None - Use this value for a fixed (not randomized) sending period

    • timedelta object - object describing time difference, if this is used, then the parameter represents the bottom limit of the randomized sending period.

  • end_period (int) –

    If start_period is not None, then this represents the upper limit of randomized time period in which messages will be sent. If start_period is None, then this represents the actual time period between each message send.

    Listing 21 Randomized sending period between 5 seconds and 10 seconds.#
    # Time between each send is somewhere between 5 seconds and 10 seconds.
    daf.VoiceMESSAGE(start_period=timedelta(seconds=5), end_period=timedelta(seconds=10), data=daf.AUDIO("msg.mp3"), channels=[12345], start_in=timedelta(seconds=0), volume=50)
    
    Listing 22 Fixed sending period at 10 seconds#
    # Time between each send is exactly 10 seconds.
    daf.VoiceMESSAGE(start_period=None, end_period=timedelta(seconds=10), data=daf.AUDIO("msg.mp3"), channels=[12345], start_in=timedelta(seconds=0), volume=50)
    

  • data (AUDIO) –

    The data parameter is the actual data that will be sent using discord’s API. The data types of this parameter can be:
    • AUDIO object.

    • Function that accepts any amount of parameters and returns an AUDIO object. To pass a function, YOU MUST USE THE data_function decorator on the function before passing the function to the daf.

  • channels (Union[Iterable[Union[int, discord.VoiceChannel]], daf.message.AutoCHANNEL]) –

    Changed in version v2.3: Can also be AutoCHANNEL

    Channels that it will be advertised into (Can be snowflake ID or channel objects from PyCord).

  • volume (int) – The volume (0-100%) at which to play the audio. Defaults to 50%. This was added in v2.0.0

  • start_in (timedelta) – When should the message be first sent.

  • remove_after (Optional[Union[int, timedelta, datetime]]) –

    Deletes the message after:

    • int - provided amounts of sends

    • timedelta - the specified time difference

    • datetime - specific date & time

generate_log_context(audio: AUDIO, succeeded_ch: List[VoiceChannel], failed_ch: List[Dict[str, Any]]) Dict[str, Any]#

Generates information about the message send attempt that is to be saved into a log.

Parameters:
  • audio (audio) – The audio that was streamed.

  • succeeded_ch (List[Union[discord.VoiceChannel]]) – List of the successfully streamed channels

  • failed_ch (List[Dict[discord.VoiceChannel, Exception]]) – List of dictionaries contained the failed channel and the Exception object

Returns:

  {
      sent_data:
      {
          streamed_audio: str - The filename that was streamed/youtube url
      },
      channels:
      {
          successful:
          {
              id: int - Snowflake id,
              name: str - Channel name
          },
          failed:
          {
              id: int - Snowflake id,
              name: str - Channel name,
              reason: str - Exception that caused the error
          }
      },
      type: str - The type of the message, this is always VoiceMESSAGE.
}

Return type:

Dict[str, Any]

async initialize(parent: Any)#

This method initializes the implementation specific api objects and checks for the correct channel input context.

Parameters:

parent (daf.guild.GUILD) – The GUILD this message is in

Raises:
  • TypeError – Channel contains invalid channels

  • ValueError – Channel does not belong to the guild this message is in.

  • ValueError – No valid channels were passed to object”

async update(_init_options: Optional[dict] = {}, **kwargs)#

New in version v2.0.

Used for changing the initialization parameters the object was initialized with.

Warning

Upon updating, the internal state of objects get’s reset, meaning you basically have a brand new created object.

Parameters:

**kwargs (Any) – Custom number of keyword parameters which you want to update, these can be anything that is available during the object creation.

Raises:
  • TypeError – Invalid keyword argument was passed

  • Other – Raised from .initialize() method

Guilds#

GUILD#

class daf.guild.GUILD(snowflake: Union[int, Guild], messages: Optional[List[Union[TextMESSAGE, VoiceMESSAGE]]] = [], logging: Optional[bool] = False, remove_after: Optional[Union[timedelta, datetime]] = None)#

The GUILD object represents a server to which messages will be sent.

Changed in version v2.1:

  • Added created_at attribute

  • Added remove_after parameter

Parameters:
  • snowflake (Union[int, discord.Guild]) – Discord’s snowflake ID of the guild or discord.Guild object.

  • messages (Optional[List[Union[TextMESSAGE, VoiceMESSAGE]]]) – Optional list of TextMESSAGE/VoiceMESSAGE objects.

  • logging (Optional[bool]) – Optional variable dictating whatever to log sent messages inside this guild.

  • remove_after (Optional[Union[timedelta, datetime]]) –

    Deletes the guild after:

    • timedelta - the specified time difference

    • datetime - specific date & time

async add_message(message: Union[TextMESSAGE, VoiceMESSAGE])#

Adds a message to the message list.

Warning

To use this method, the guild must already be added to the framework’s shilling list (or initialized).

Parameters:

message (Union[TextMESSAGE, VoiceMESSAGE]) – Message object to add.

Raises:
  • TypeError – Raised when the message is not of type TextMESSAGE or VoiceMESSAGE.

  • Other – Raised from message.initialize() method.

remove_message(message: Union[TextMESSAGE, VoiceMESSAGE])#

Removes a message from the message list.

Parameters:

message (Union[TextMESSAGE, VoiceMESSAGE]) – Message object to remove.

Raises:
  • TypeError – Raised when the message is not of type TextMESSAGE or VoiceMESSAGE.

  • ValueError – Raised when the message is not present in the list.

async initialize() None#

This function initializes the API related objects and then tries to initialize the MESSAGE objects.

Note

This should NOT be manually called, it is called automatically after adding the message.

Raises:
  • ValueError – Raised when the guild_id wasn’t found.

  • Other – Raised from .add_message(message_object) method.

async update(**kwargs)#

Used for changing the initialization parameters the object was initialized with.

New in version v2.0.

Warning

Upon updating, the internal state of objects get’s reset, meaning you basically have a brand new created object. It also resets the message objects.

Parameters:

**kwargs (Any) – Custom number of keyword parameters which you want to update, these can be anything that is available during the object creation.

Raises:
  • TypeError – Invalid keyword argument was passed.

  • Other – Raised from .initialize() method.

USER#

class daf.guild.USER(snowflake: Union[int, User], messages: Optional[List[DirectMESSAGE]] = [], logging: Optional[bool] = False, remove_after: Optional[Union[timedelta, datetime]] = None)#

The USER object represents a user to whom messages will be sent.

Changed in version v2.1:

  • Added created_at attribute

  • Added remove_after parameter

Parameters:
  • snowflake (Union[int, discord.User]) – Discord’s snowflake ID of the user or discord.User object.

  • messages (Optional[List[DirectMESSAGE]]) – Optional list of DirectMESSAGE objects.

  • logging (Optional[bool]) – Optional variable dictating whatever to log sent messages inside this guild.

  • remove_after (Optional[Union[timedelta, datetime]]) –

    Deletes the user after:

    • timedelta - the specified time difference

    • datetime - specific date & time

async add_message(message: DirectMESSAGE)#

Adds a message to the message list.

Warning

To use this method, the guild must already be added to the framework’s shilling list (or initialized).

Parameters:

message (DirectMESSAGE) – Message object to add.

Raises:
  • TypeError – Raised when the message is not of type DirectMESSAGE.

  • Other – Raised from message.initialize() method.

remove_message(message: DirectMESSAGE)#

New in version v2.0.

Removes a message from the message list.

Parameters:

message (DirectMESSAGE) – Message object to remove.

Raises:

TypeError – Raised when the message is not of type DirectMESSAGE.

async initialize()#

This function initializes the API related objects and then tries to initialize the MESSAGE objects.

Raises:
  • ValueError – Raised when the DM could not be created.

  • Other – Raised from .add_message(message_object) method.

async update(**kwargs)#

New in version v2.0.

Used for changing the initialization parameters the object was initialized with.

Warning

Upon updating, the internal state of objects get’s reset, meaning you basically have a brand new created object. It also resets the message objects.

Parameters:

**kwargs (Any) – Custom number of keyword parameters which you want to update, these can be anything that is available during the object creation.

Raises:
  • TypeError – Invalid keyword argument was passed.

  • Other – Raised from .initialize() method.