aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/__main__.py5
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()