LeoSaucedo / rikka-bot

Discord bot that performs various functions.
http://cgsphoto.com/rikka-bot/
Other
8 stars 8 forks source link

XKCD Cog Breaks Program #86

Closed LeoSaucedo closed 3 years ago

LeoSaucedo commented 3 years ago

When Cogs.Xkcd is included in the cogs for Rikka, this error is thrown:

Jul 18 22:12:37 ip-172-31-80-202 python[45745]: Traceback (most recent call last):
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/.env/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:     spec.loader.exec_module(lib)
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/Cogs/Xkcd.py", line 10, in <module>
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:     class Xkcd(commands.Cog):
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/Cogs/Xkcd.py", line 11, in Xkcd
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:     required_response_fields: list[str] = ['year', 'month', 'day', 'alt', 'num']
Jul 18 22:12:37 ip-172-31-80-202 python[45745]: TypeError: 'type' object is not subscriptable
Jul 18 22:12:37 ip-172-31-80-202 python[45745]: The above exception was the direct cause of the following exception:
Jul 18 22:12:37 ip-172-31-80-202 python[45745]: Traceback (most recent call last):
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/robot.py", line 111, in <module>
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:     bot.load_extension(cog)
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/.env/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 664, in load_extension
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:     self._load_from_module_spec(spec, name)
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/.env/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 610, in _load_from_module_spec
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:     raise errors.ExtensionFailed(key, e) from e
Jul 18 22:12:37 ip-172-31-80-202 python[45745]: discord.ext.commands.errors.ExtensionFailed: Extension 'Cogs.Xkcd' raised an error: TypeError: 'type' object is not subscriptable
Jul 18 22:12:37 ip-172-31-80-202 python[45745]: Exception ignored in: <function ClientSession.__del__ at 0x7fed9fa20af0>Jul 18 22:12:37 ip-172-31-80-202 python[45745]: Traceback (most recent call last):
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/opt/rikka/rikka-bot/.env/lib/python3.8/site-packages/aiohttp/client.py", line 314, in __del__
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/asyncio/base_events.py", line 1740, in call_exception_handler
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 1475, in error
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 1186, in emit
Jul 18 22:12:37 ip-172-31-80-202 python[45745]:   File "/usr/lib/python3.8/logging/__init__.py", line 1176, in _open
Jul 18 22:12:37 ip-172-31-80-202 python[45745]: NameError: name 'open' is not defined
Jul 18 22:12:37 ip-172-31-80-202 systemd[1]: rikka.service: Main process exited, code=exited, status=1/FAILURE
Jul 18 22:12:37 ip-172-31-80-202 systemd[1]: rikka.service: Failed with result 'exit-code'.

Environment Details:

Python 3.8.10 (default, Jun  2 2021, 10:49:15)
[GCC 9.4.0] on linux

We should make sure our changes are consistent with the current python version being used by the bot.

KueZie commented 3 years ago

Fixed with PR #87