DAF control reference#

initialize#

async daf.core.initialize(user_callback: Callable | Coroutine | None = None, debug: TraceLEVELS | int | str | None = TraceLEVELS.NORMAL, logger: LoggerBASE | None = None, accounts: List[ACCOUNT] | None = None, save_to_file: bool = False, remote_client: RemoteAccessCLIENT | None = 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() None#

Stops and cleans the framework.

run#

daf.core.run(user_callback: Callable | Coroutine | None = None, debug: TraceLEVELS | int | str | bool | None = TraceLEVELS.NORMAL, logger: LoggerBASE | None = None, accounts: List[ACCOUNT] | None = None, save_to_file: bool = False, remote_client: RemoteAccessCLIENT | None = None) None#

Changed in version 2.7: Removed deprecated parameters (see v2.7)

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

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.

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 with the path parameter set to /<user-home-dir>/daf/History

  • accounts (Optional[List[client.ACCOUNT]]) – List of ACCOUNT (Discord accounts) to use. .. versionadded:: v2.4

  • save_to_file (Optional[bool]) –

    If True, the shilling list (of accounts, guilds, messages, …) will be saved to file and preserved on shutdown.

    It is recommended you set this to False when passing run() or initialize() the statically defined accounts parameter.

    Note

    Setting this to True and passing the accounts parameter as well, results in Account already added warnings.

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

  • ValueError – Invalid proxy url.