From 1697d90c53e6d2612f59939c525ab697ae0284b7 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Tue, 4 May 2021 16:53:39 +0200 Subject: [PATCH] Stop shadowing variable in customcom's arg handling --- redbot/cogs/customcom/customcom.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/redbot/cogs/customcom/customcom.py b/redbot/cogs/customcom/customcom.py index d1758187c..9734d4659 100644 --- a/redbot/cogs/customcom/customcom.py +++ b/redbot/cogs/customcom/customcom.py @@ -694,20 +694,20 @@ class CustomCommands(commands.Cog): fin = [Parameter("_" + str(i), Parameter.POSITIONAL_OR_KEYWORD) for i in range(high + 1)] for arg in args: index = int(arg[0]) - low - anno = arg[1][1:] # strip initial colon - if anno.lower().endswith("converter"): - anno = anno[:-9] - if not anno or anno.startswith("_"): # public types only + anno_raw = arg[1][1:] # strip initial colon + if anno_raw.lower().endswith("converter"): + anno_raw = anno_raw[:-9] + if not anno_raw or anno_raw.startswith("_"): # public types only name = "{}_{}".format("text", index if index < high else "final") fin[index] = fin[index].replace(name=name) continue # allow type hinting only for discord.py and builtin types try: - anno = getattr(discord, anno) + anno = getattr(discord, anno_raw) # force an AttributeError if there's no discord.py converter getattr(commands, anno.__name__ + "Converter") except AttributeError: - anno = allowed_builtins.get(anno.lower(), Parameter.empty) + anno = allowed_builtins.get(anno_raw.lower(), Parameter.empty) if ( anno is not Parameter.empty and fin[index].annotation is not Parameter.empty