mirror of
https://github.com/Noettore/lagomareGateKeeperBot.git
synced 2025-10-15 03:26:40 +02:00
Refactor and start implementing inline keyboards
This commit is contained in:
18
config.py
18
config.py
@@ -2,18 +2,16 @@ import json
|
||||
from telegram import BotCommand
|
||||
|
||||
class BotConfig:
|
||||
|
||||
def __init__(self, bot_username: str, json_path: str = "./data/config.json"):
|
||||
self._json_path: str = json_path
|
||||
self._bot_username: str = bot_username
|
||||
self._json_path = json_path
|
||||
self._bot_username = bot_username
|
||||
self._token: str = ""
|
||||
self._name: str = ""
|
||||
self._description: str = ""
|
||||
self._short_description: str = ""
|
||||
self._commands: list[BotCommand] = []
|
||||
|
||||
self._load_config()
|
||||
|
||||
|
||||
def _load_config(self):
|
||||
try:
|
||||
with open(self._json_path, "r") as f:
|
||||
@@ -27,24 +25,24 @@ class BotConfig:
|
||||
for command, description in config.get("commands", {}).items()
|
||||
]
|
||||
except Exception:
|
||||
return {}
|
||||
pass
|
||||
|
||||
@property
|
||||
def token(self) -> str:
|
||||
return self._token
|
||||
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return self._description
|
||||
|
||||
|
||||
@property
|
||||
def short_description(self) -> str:
|
||||
return self._short_description
|
||||
|
||||
|
||||
@property
|
||||
def commands(self) -> list[BotCommand]:
|
||||
return self._commands
|
Reference in New Issue
Block a user