-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
42 lines (33 loc) · 1.36 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
from typing import Tuple, Type
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource
class EnvSettings(BaseSettings):
ENV_FILE: str = ""
class AppSettings(BaseSettings):
TOKEN: str = "" # bot's token
download_path: str = "./audio"
max_queue_size: int = 30 # max number of tracks in queue
message_history_length: int = 10
command_prefix: str = "/"
messages: dict = {
"not_in_voice_channel": "I'm not in a voice channel",
"user_not_in_voice_channel": "You are not in a voice channel",
"unsupported_url": "Unsupported url",
"queue_full": "Queue is full, please wait fors track to finish",
"start_playing": "{} plays: '{}'",
"move_to_another_channel": "Bot was moved to {} channel",
}
def get_messages(self) -> dict:
return self.messages
class Config:
env_file = EnvSettings().ENV_FILE
@classmethod
def settings_customise_sources(
cls,
settings_cls: Type[BaseSettings],
init_settings: PydanticBaseSettingsSource,
env_settings: PydanticBaseSettingsSource,
dotenv_settings: PydanticBaseSettingsSource,
file_secret_settings: PydanticBaseSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]:
return dotenv_settings, env_settings, init_settings, file_secret_settings