Automatic generation#

This documents describes mechanisms that can be used to automatically generate objects.

Shilling scheme generation#

While the framework supports to manually define a schema, which can be time consuming if you have a lot of guilds to shill into and harder to manage, the framework also supports automatic generation of the schema.

Using this method allows you to have a completely automatically managed system of finding guilds and channels that match a specific regex pattern. It automatically finds new guilds/channels at initialization and also during normal framework operation. This is great because it means you don’t have to do much but it gives very little control of into what to shill.

Automatic GUILD generation#

See also

This section only describes guilds that the user is already joined in. For information about discovering NEW guilds and automatically joining them see Automatic guild discovery and join

For a auto-managed GUILD list, use AutoGUILD which internally generates GUILD instances. Simply create a list of AutoGUILD objects and then pass it to the framework. It can be passed to the framework exactly the same way as GUILD (see Quickstart (accounts) and Dynamically adding objects).

Warning

Messages that are added to AutoGUILD should have AutoCHANNEL for the channels parameters, otherwise you will be spammed with warnings and only one guild will be shilled.

from datetime import timedelta
import daf


# STATIC DEFINITION
ACCOUNTS = [
    daf.ACCOUNT(
        token="SomeToken",
        is_user=False,
        servers=[
            daf.guild.AutoGUILD( include_pattern="NFT-Dragons", # Regex pattern of guild names that should be included
                                 exclude_pattern="NonFunctionalTesticle",   # Regex pattern of guild names that should be excluded
                                 remove_after=None, # Never stop automatically managing guilds
                                 messages=[
                                    daf.message.TextMESSAGE(None, timedelta(seconds=5), "Buy our NFT today!", daf.message.AutoCHANNEL("shill", "promo", timedelta(seconds=60)))
                                 ], 
                                 logging=True, # The generated GUILD objects will have logging enabled
                                 interval=timedelta(hours=1) ) # Scan for new guilds in a period of one hour
        ]
    )
]



daf.run(
    accounts=ACCOUNTS
)

Automatic channel generation#

For a auto-managed channel list use AutoCHANNEL instances. It can be passed to xMESSAGE objects into the channels parameters instead of a list.

Listing 14 AutoCHANNEL example#
from datetime import timedelta
import daf


async def main():
    await daf.add_object(
        daf.ACCOUNT(
            token="SomeToken",
            is_user=False,
            servers=[
                daf.GUILD(snowflake=123456789,
                          messages=[
                                daf.TextMESSAGE(None, timedelta(seconds=5), "Hello World", channels=daf.message.AutoCHANNEL("shill", exclude_pattern="shill-[7-9]"))
                            ],
                          logging=True) 
            ]
        )
    )


daf.run(
    user_callback=main,
)