From ef991745851bb4a0c52edb7a8b68c56f5eb04336 Mon Sep 17 00:00:00 2001 From: Michael H Date: Thu, 26 Dec 2019 17:20:59 -0500 Subject: [PATCH] prevent abuse cases with qualname length (#3223) --- changelog.d/3223.misc.rst | 1 + redbot/core/commands/commands.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 changelog.d/3223.misc.rst diff --git a/changelog.d/3223.misc.rst b/changelog.d/3223.misc.rst new file mode 100644 index 000000000..f3c2c82f2 --- /dev/null +++ b/changelog.d/3223.misc.rst @@ -0,0 +1 @@ +qualified command names are limited to a maximum of 60 characters diff --git a/redbot/core/commands/commands.py b/redbot/core/commands/commands.py index c2adf2ee1..97649747c 100644 --- a/redbot/core/commands/commands.py +++ b/redbot/core/commands/commands.py @@ -167,6 +167,11 @@ class Command(CogCommandMixin, commands.Command): raise RuntimeError( f"The name `{name}` cannot be set as a command name. It is reserved for internal use." ) + if len(self.qualified_name) > 60: + raise RuntimeError( + f"This command ({self.qualified_name}) has an excessively long qualified name, " + "and will not be added to the bot to prevent breaking tools and menus. (limit 60)" + ) def _ensure_assignment_on_copy(self, other): super()._ensure_assignment_on_copy(other)