Handle configuration parsing#
- load_default_config()[source]#
Load the default configuration into memory.
- Raises:
RuntimeError – If the default config file cannot be found
- Returns:
The configuration object, ready for use
- Return type:
- parse_launch_args(argv: list[str] = None)[source]#
Parse the launch arguments, and find the files to load.
- Parameters:
argv (list[str]) – The command-line arguments to use, sys.argv if not specified.
- Raises:
RuntimeError – If a specified config file could not be found.
- Returns:
A tuple of the files to load, and the override values.
- Return type:
tuple[list[pathlib.Path], dict]
- load_user_config(conf: Config, file: Path)[source]#
Modify in-place the config with the user config.
- Parameters:
conf (Config) – The configuration object.
file (pathlib.Path) – A Path object pointing to the file.
Contain all the configuration as classes.
This allows proper type hinting and autocomplete.
- class _ConfigMapping[source]#
Bases:
object- update(mapping: dict)[source]#
Update the configuration with user config.
- Parameters:
mapping (dict) – The decoded YAML mapping of configuration.
- Raises:
InvalidConfigType – If the user config gives a wrong value type.
- class Config(twitch: dict, discord: dict, youtube: dict, bot: dict, server: dict, spotify: dict, **kwargs)[source]#
Bases:
_ConfigMapping
- class Twitch(channel: str, oauth_token: str, *, enabled: bool = True, editors: list[str], extended: dict, timers: dict)[source]#
Bases:
_ConfigMapping- property enabled#
- class _TwitchExtendedOAuth(client_id: str, client_secret: str, scopes: list[str] | None = None, *, enabled: bool = False)[source]#
Bases:
_ConfigMapping
- class _TimerIntervals(default_interval: int, stagger_interval: int)[source]#
Bases:
_ConfigMapping
- class Discord(server_id: int, moderator_role: int, oauth_token: str, invite_links: dict, auto_report: dict, *, enabled: bool = True, owners: list[int])[source]#
Bases:
_ConfigMapping- property enabled#
- class _InviteLinks(main: str, dev: str)[source]#
Bases:
_ConfigMapping
- class _AutoReport(server: int, channel: int, *, enabled: bool = False)[source]#
Bases:
_ConfigMapping- property enabled#
- class YouTube(channel_id: str, default_video: str, archive_id: str, api_key: str, cache_timeout: int, playlist_sheet: str)[source]#
Bases:
_ConfigMapping
- class Bot(prefix: str, name: str, spire_mods: list[str])[source]#
Bases:
_ConfigMapping
- class Server(debug: bool, secret: str, url: str, host: str, port: int, json_indent: int, business_email: str, websocket_client: dict, webhook: dict)[source]#
Bases:
_ConfigMapping
- class _WebsocketClient(id: str, secret: str)[source]#
Bases:
_ConfigMapping
- class _Webhook(secret: str)[source]#
Bases:
_ConfigMapping
- class Spotify(enabled: bool, id: str, secret: str, code: str)[source]#
Bases:
_ConfigMapping