prevent abuse cases with qualname length (#3223)

This commit is contained in:
Michael H 2019-12-26 17:20:59 -05:00 committed by GitHub
parent 8b18526f46
commit ef99174585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1 @@
qualified command names are limited to a maximum of 60 characters

View File

@ -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)