DAF control reference#

initialize#

async daf.core.initialize(token: str | None = None, server_list: List[GUILD | USER | AutoGUILD] | None = None, is_user: bool | None = False, user_callback: Callable | Coroutine | None = None, server_log_output: str | None = None, sql_manager: LoggerSQL | None = None, intents: Intents | None = None, debug: TraceLEVELS | int | str | bool | None = TraceLEVELS.NORMAL, proxy: str | None = None, logger: LoggerBASE | None = None, accounts: List[ACCOUNT] | None = []) 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: AbstractEventLoop | None = None, stop_loop: bool | None = False) None#

Stops the framework.

Parameters:
  • loop (Optional[asyncio.AbstractEventLoop]) – The loop everything is running in. Leave empty for default loop. This parameter is only relevant if stop_loop is set to True.

  • stop_loop (Optional[bool]) – Default: False; If True, it stops the running event loop.

run#

daf.core.run(token: str | None = None, server_list: List[GUILD | USER | AutoGUILD] | None = None, is_user: bool | None = False, user_callback: Callable | Coroutine | None = None, server_log_output: str | None = None, sql_manager: LoggerSQL | None = None, intents: Intents | None = None, debug: TraceLEVELS | int | str | bool | None = TraceLEVELS.NORMAL, proxy: str | None = None, logger: LoggerBASE | None = None, accounts: List[ACCOUNT] | None = []) 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.