|
3 | 3 | from types import ModuleType
|
4 | 4 | from typing import Callable, Dict
|
5 | 5 |
|
6 |
| -from interactions import Extension, SlashCommand |
| 6 | +from interactions import Extension, SlashCommand, Client |
7 | 7 | from interactions.client.errors import ExtensionLoadException, ExtensionNotFound
|
8 | 8 | from interactions.client.utils.misc_utils import find
|
9 | 9 | from interactions.client.const import get_logger
|
@@ -55,15 +55,19 @@ def is_slashcommand(e) -> bool:
|
55 | 55 |
|
56 | 56 |
|
57 | 57 | class Jurigged(Extension):
|
| 58 | + def __init__(self, *_, poll=False) -> None: |
| 59 | + self.poll = poll |
| 60 | + self.command_cache = {} |
| 61 | + self.watcher = None |
| 62 | + |
58 | 63 | async def async_start(self) -> None:
|
59 | 64 | """Jurigged starting utility."""
|
60 |
| - self.command_cache = {} |
61 | 65 | self.bot.logger.warning("Setting sync_ext to True by default for syncing changes")
|
62 | 66 | self.bot.sync_ext = True
|
63 | 67 |
|
64 | 68 | self.bot.logger.info("Loading jurigged")
|
65 | 69 | path = Path().resolve()
|
66 |
| - self.watcher = watch(f"{path}/[!.]*.py", logger=self.jurigged_log) |
| 70 | + self.watcher = watch(f"{path}/[!.]*.py", logger=self.jurigged_log, poll=self.poll) |
67 | 71 | self.watcher.prerun.register(self.jurigged_prerun)
|
68 | 72 | self.watcher.postrun.register(self.jurigged_postrun)
|
69 | 73 |
|
@@ -203,5 +207,8 @@ def jurigged_postrun(self, _path: str, cf: CodeFile) -> None: # noqa: C901
|
203 | 207 | self.command_cache.clear()
|
204 | 208 |
|
205 | 209 |
|
206 |
| -def setup(bot) -> None: |
207 |
| - Jurigged(bot) |
| 210 | +def setup( |
| 211 | + bot: Client, |
| 212 | + poll: bool = False, |
| 213 | +) -> None: |
| 214 | + Jurigged(bot, poll=poll) |
0 commit comments