diff options
| author | Josh <[email protected]> | 2021-01-15 20:34:05 +1000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-01-15 05:34:05 -0500 |
| commit | 73a783cd6b2b9f02d7071947e70da7eb5bc7d2b8 (patch) | |
| tree | b26f70a38298972358818bc37ac26d6945abf7b7 | |
| parent | Change copyright year to present (diff) | |
| download | discord.py-73a783cd6b2b9f02d7071947e70da7eb5bc7d2b8.tar.xz discord.py-73a783cd6b2b9f02d7071947e70da7eb5bc7d2b8.zip | |
Strip both - and _ from newcog class names
| -rw-r--r-- | discord/__main__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/discord/__main__.py b/discord/__main__.py index 47504b7f..02803cf0 100644 --- a/discord/__main__.py +++ b/discord/__main__.py @@ -250,8 +250,9 @@ def newcog(parser, args): name = args.class_name else: name = str(directory.stem) - if '-' in name: - name = name.replace('-', ' ').title().replace(' ', '') + if '-' in name or '_' in name: + translation = str.maketrans('-_', ' ') + name = name.translate(translation).title().replace(' ', '') else: name = name.title() |