DAF control reference#

initialize#

async daf.core.initialize(token: Optional[str] = None, server_list: Optional[List[Union[GUILD, USER, AutoGUILD]]] = None, is_user: Optional[bool] = False, user_callback: Optional[Union[Callable, Coroutine]] = None, server_log_output: Optional[str] = None, sql_manager: Optional[LoggerSQL] = None, intents: Optional[Intents] = None, debug: Optional[Union[TraceLEVELS, int, str, bool]] = TraceLEVELS.NORMAL, proxy: Optional[str] = None, logger: Optional[LoggerBASE] = None, accounts: Optional[List[ACCOUNT]] = []) None#

The main initialization function. It initializes all the other modules, creates advertising tasks and initializes all the core functionality. If you want to control your own event loop, use this instead of run.

Parameters:

Any (Any) – Parameters are the same as in daf.core.run().

shutdown#

async daf.core.shutdown(loop: Optional[AbstractEventLoop] = None) None#

Stops the framework.

Parameters:

loop (Optional[asyncio.AbstractEventLoop]) – The loop everything is running in. Leave empty for default loop.

run#

daf.core.run(token: Optional[str] = None, server_list: Optional[List[Union[GUILD, USER, AutoGUILD]]] = None, is_user: Optional[bool] = False, user_callback: Optional[Union[Callable, Coroutine]] = None, server_log_output: Optional[str] = None, sql_manager: Optional[LoggerSQL] = None, intents: Optional[Intents] = None, debug: Optional[Union[TraceLEVELS, int, str, bool]] = TraceLEVELS.NORMAL, proxy: Optional[str] = None, logger: Optional[LoggerBASE] = None, accounts: Optional[List[ACCOUNT]] = []) None#

Runs the framework and does not return until the framework is stopped (daf.core.shutdown()). After stopping, it returns None.

Warning

This will block until the framework is stopped, if you want manual control over the asyncio event loop, eg. you want to start the framework as a task, use the daf.core.initialize() coroutine.

Changed in version v2.4: Added accounts parameter.

Deprecated since version v2.4:

The following parameters were deprecated in favor of support for multiple accounts

  • token

  • is_user

  • server_list

  • intents

  • proxy

Parameters:
  • user_callback (Optional[Union[Callable, Coroutine]]) – Function or async function to call after the framework has been started.

  • debug (Optional[TraceLEVELS | int | str] = TraceLEVELS.NORMAL) –

    Changed in version v2.3: Deprecate use of bool (assume TraceLEVELS.NORMAL). Add support for TraceLEVELS or int or str that converts to TraceLEVELS.

    The level of trace for trace function to display. The higher value this option is, the more will be displayed.

  • logger (Optional[loggers.LoggerBASE]) – The logging class to use. If this is not provided, JSON is automatically used.

  • accounts (Optional[List[client.ACCOUNT]]) –

    New in version v2.4.

    List of ACCOUNT (Discord accounts) to use.

Raises:
  • ModuleNotFoundError – Missing modules for the wanted functionality, install with pip install discord-advert-framework[optional-group].

  • ValueError – Invalid proxy url.