aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-01-10 22:10:12 +0100
committerGravatar Numerlor <[email protected]>2021-01-10 22:10:12 +0100
commitd50ae50681f552c9a0d3e2c797b0916a09da54da (patch)
tree5530c68569ad684c6e1eb52e72aed8102575a0f2
parentCreate 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.py5
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")