Skip to content

Commit

Permalink
RGet rodhaj entries and fix broken config code
Browse files Browse the repository at this point in the history
  • Loading branch information
No767 committed Jan 26, 2024
1 parent a211d38 commit 0875891
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions bot/libs/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def load_from_file(self) -> None:
except FileNotFoundError:
self._config = {}

@property
def rodhaj(self) -> _T:
return self._config.get("rodhaj", {})

@overload
def get(self, key: Any) -> Optional[Union[_T, Any]]:
...
Expand Down
8 changes: 6 additions & 2 deletions bot/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
import asyncpg
import click
from libs.utils.config import RodhajConfig
from typing_extensions import Self

path = Path(__file__).parent / "config.json"
try:
from typing import Self
except ImportError:
from typing_extensions import Self

path = Path(__file__).parent / "config.yml"
config = RodhajConfig(path)

BE = TypeVar("BE", bound=BaseException)
Expand Down
4 changes: 2 additions & 2 deletions bot/rodhaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def __init__(
self.partial_config: Optional[PartialConfig] = None
self.pool = pool
self.version = str(VERSION)
self.transprogrammer_guild_id = config["rodhaj"].get(
self.transprogrammer_guild_id = config.rodhaj.get(
"guild_id", 1183302385020436480
)
self._dev_mode = config["rodhaj"].get("dev_mode", False)
self._dev_mode = config.rodhaj.get("dev_mode", False)
self._reloader = Reloader(self, Path(__file__).parent)

### Ticket related utils
Expand Down

0 comments on commit 0875891

Please sign in to comment.