-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy path__init__.py
46 lines (40 loc) · 1.74 KB
/
__init__.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
43
44
45
46
from redbot.core import errors # isort:skip
import importlib
import sys
try:
import AAA3A_utils
except ModuleNotFoundError:
raise errors.CogLoadError(
"The needed utils to run the cog were not found. Please execute the command `[p]pipinstall git+https://github.com/AAA3A-AAA3A/AAA3A_utils.git`. A restart of the bot isn't necessary."
)
modules = sorted(
[module for module in sys.modules if module.split(".")[0] == "AAA3A_utils"], reverse=True
)
for module in modules:
try:
importlib.reload(sys.modules[module])
except ModuleNotFoundError:
pass
del AAA3A_utils
# import AAA3A_utils
# import json
# import os
# __version__ = AAA3A_utils.__version__
# with open(os.path.join(os.path.dirname(__file__), "utils_version.json"), mode="r") as f:
# data = json.load(f)
# needed_utils_version = data["needed_utils_version"]
# if __version__ > needed_utils_version:
# raise errors.CogLoadError(
# "The needed utils to run the cog has a higher version than the one supported by this version of the cog. Please update the cogs of the `AAA3A-cogs` repo."
# )
# elif __version__ < needed_utils_version:
# raise errors.CogLoadError(
# "The needed utils to run the cog has a lower version than the one supported by this version of the cog. Please execute the command `[p]pipinstall --upgrade git+https://github.com/AAA3A-AAA3A/AAA3A_utils.git`. A restart of the bot isn't necessary."
# )
from redbot.core.bot import Red # isort:skip
from redbot.core.utils import get_end_user_data_statement
from .reacttocommand import ReactToCommand
__red_end_user_data_statement__ = get_end_user_data_statement(file=__file__)
async def setup(bot: Red) -> None:
cog = ReactToCommand(bot)
await bot.add_cog(cog)