Skip to content

Commit 0875891

Browse files
committed
RGet rodhaj entries and fix broken config code
1 parent a211d38 commit 0875891

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

bot/libs/utils/config.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def load_from_file(self) -> None:
1919
except FileNotFoundError:
2020
self._config = {}
2121

22+
@property
23+
def rodhaj(self) -> _T:
24+
return self._config.get("rodhaj", {})
25+
2226
@overload
2327
def get(self, key: Any) -> Optional[Union[_T, Any]]:
2428
...

bot/migrations.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
import asyncpg
1111
import click
1212
from libs.utils.config import RodhajConfig
13-
from typing_extensions import Self
1413

15-
path = Path(__file__).parent / "config.json"
14+
try:
15+
from typing import Self
16+
except ImportError:
17+
from typing_extensions import Self
18+
19+
path = Path(__file__).parent / "config.yml"
1620
config = RodhajConfig(path)
1721

1822
BE = TypeVar("BE", bound=BaseException)

bot/rodhaj.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def __init__(
5757
self.partial_config: Optional[PartialConfig] = None
5858
self.pool = pool
5959
self.version = str(VERSION)
60-
self.transprogrammer_guild_id = config["rodhaj"].get(
60+
self.transprogrammer_guild_id = config.rodhaj.get(
6161
"guild_id", 1183302385020436480
6262
)
63-
self._dev_mode = config["rodhaj"].get("dev_mode", False)
63+
self._dev_mode = config.rodhaj.get("dev_mode", False)
6464
self._reloader = Reloader(self, Path(__file__).parent)
6565

6666
### Ticket related utils

0 commit comments

Comments
 (0)