scarletcafe / jishaku

A debugging and testing cog for discord.py rewrite bots.
https://jishaku.readthedocs.io/en/latest/
MIT License
543 stars 183 forks source link

discord.ext.commands.errors.ExtensionFailed: Extension 'jishaku' raised an error: TypeError: unsupported types given inside typing.Union[int, str] #180

Closed tuna2134 closed 2 years ago

tuna2134 commented 2 years ago

Summary

raise type error

Reproduction steps

load jishaku

Expected results

Load jishaku

Actual results

raise error

Traceback (most recent call last):
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 929, in _load_from_module_spec
    await setup(self)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/jishaku/cog.py", line 59, in async_setup
    await bot.add_cog(Jishaku(bot=bot))
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 765, in add_cog
    cog = await cog._inject(self, override=override, guild=guild, guilds=guilds)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/fslash/__init__.py", line 443, in new_inject
    command_new_init(command, command.callback, __cog_mode__=True, __cog__=self)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/fslash/__init__.py", line 403, in command_new_init
    app_command: app_commands.Command = (bot.tree.command if parent is None else parent.command)(
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/app_commands/commands.py", line 1565, in decorator
    command = Command(
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/app_commands/commands.py", line 527, in __init__
    self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/app_commands/commands.py", line 383, in _extract_parameters_from_callback
    param = annotation_to_parameter(resolved, parameter)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/fslash/__init__.py", line 116, in new_atp
    return _original_atp(annotation, parameter)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/app_commands/transformers.py", line 718, in annotation_to_parameter
    (inner, default, validate_default) = get_supported_annotation(annotation)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/app_commands/transformers.py", line 703, in get_supported_annotation
    raise TypeError(f'unsupported types given inside {annotation!r}')
TypeError: unsupported types given inside typing.Union[int, str]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/codespace/.python/current/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/codespace/.python/current/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/workspaces/mc-fdc-bot/core/__main__.py", line 36, in <module>
    main()
  File "/workspaces/mc-fdc-bot/core/__main__.py", line 33, in main
    asyncio.run(run())
  File "/home/codespace/.python/current/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/codespace/.python/current/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/workspaces/mc-fdc-bot/core/__main__.py", line 32, in run
    await bot.start(DATA["discord"]["token"])
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/client.py", line 780, in start
    await self.login(token)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/client.py", line 632, in login
    await self.setup_hook()
  File "/workspaces/mc-fdc-bot/core/client.py", line 20, in setup_hook
    await self.load_extension("jishaku")
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 995, in load_extension
    await self._load_from_module_spec(spec, name)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 934, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'jishaku' raised an error: TypeError: unsupported types given inside typing.Union[int, str]

Checklist

System information

- Python v3.10.4-final
- discord.py v2.0.0-alpha
    - discord.py pkg_resources: v2.0.0a4392+gfd9c244f
- aiohttp v3.8.1
- system info: Linux 5.4.0-1074-azure #77~18.04.1-Ubuntu SMP Wed Mar 30 15:36:02 UTC 2022
Name: jishaku
Version: 2.5.0
Summary: A discord.py extension including useful tools for bot development and debugging.
Home-page: https://github.com/Gorialis/jishaku
Author: Devon (Gorialis) R
Author-email: 
License: MIT
Location: /opt/python/3.10.4/lib/python3.10/site-packages
Requires: braceexpand, click, import-expression
Required-by: