tuxbot-bot/tuxbot/core/config.py

70 lines
1.6 KiB
Python
Raw Normal View History

2020-06-04 19:16:51 +02:00
import logging
2020-09-02 00:08:06 +02:00
from typing import List, Dict
from structured_config import (
Structure,
IntField,
StrField,
BoolField,
2020-09-02 00:08:06 +02:00
ConfigFile,
)
__all__ = ["Config", "ConfigFile"]
2020-06-06 02:00:16 +02:00
log = logging.getLogger("tuxbot.core.config")
2020-09-02 00:08:06 +02:00
class Server(Structure):
prefixes: List[str] = []
disabled_command: List[str] = []
locale: str = StrField("")
blacklisted: bool = BoolField(False)
class Channel(Structure):
disabled_command: List[str] = []
locale: str = StrField("")
blacklisted: bool = BoolField(False)
2020-06-04 19:16:51 +02:00
2020-09-02 00:08:06 +02:00
class User(Structure):
aliases: List[dict] = []
locale: str = StrField("")
blacklisted: bool = BoolField(False)
2020-06-06 02:00:16 +02:00
2020-09-02 00:08:06 +02:00
class Config(Structure):
class Servers(Structure):
all: Dict[int, Server] = {}
class Channels(Structure):
all: Dict[int, Channel] = {}
2020-09-02 00:08:06 +02:00
class Users(Structure):
all: Dict[int, User] = {}
2020-09-02 00:08:06 +02:00
class Core(Structure):
owners_id: List[int] = []
prefixes: List[str] = []
token: str = StrField("")
mentionable: bool = BoolField("")
locale: str = StrField("")
disabled_command: List[str] = []
2020-09-02 00:08:06 +02:00
class Cogs(Structure):
pass
# =============================================================================
# Configuration of Tuxbot Application (not the bot)
# =============================================================================
class AppConfig(Structure):
class Instance(Structure):
path: str = StrField("")
active: bool = BoolField(False)
last_run: int = IntField(0)
2020-09-02 00:08:06 +02:00
instances: Dict[str, Instance] = {}