diff options
| author | 2021-01-10 22:10:12 +0100 | |
|---|---|---|
| committer | 2021-01-10 22:10:12 +0100 | |
| commit | d50ae50681f552c9a0d3e2c797b0916a09da54da (patch) | |
| tree | 5530c68569ad684c6e1eb52e72aed8102575a0f2 | |
| parent | Create decorator for update_wrapper_globals mimicking functools.wraps (diff) | |
Resolve wrapped command callbacks in the source command
Without this the command will fetch the source of the wrapper
| -rw-r--r-- | bot/exts/info/source.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/exts/info/source.py b/bot/exts/info/source.py index 7b41352d4..ae68ef7e8 100644 --- a/bot/exts/info/source.py +++ b/bot/exts/info/source.py @@ -68,7 +68,10 @@ class BotSource(commands.Cog): Raise BadArgument if `source_item` is a dynamically-created object (e.g. via internal eval). """ if isinstance(source_item, commands.Command): - src = source_item.callback.__code__ + source_item = source_item.callback + while hasattr(source_item, "__wrapped__"): + source_item = source_item.__wrapped__ + src = source_item.__code__ filename = src.co_filename elif isinstance(source_item, str): tags_cog = self.bot.get_cog("Tags") |