Skip to content

Commit 7da3f86

Browse files
committed
Normalized function names, created more aliases, responder is an alias to supporter
1 parent 1948b86 commit 7da3f86

File tree

4 files changed

+64
-62
lines changed

4 files changed

+64
-62
lines changed

cogs/modmail.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async def snippets(self, ctx):
106106

107107
@snippets.command(name='add')
108108
@checks.has_permissions(PermissionLevel.SUPPORTER)
109-
async def add_(self, ctx, name: str.lower, *, value):
109+
async def snippets_add(self, ctx, name: str.lower, *, value):
110110
"""Add a snippet to the bot config."""
111111
if 'snippets' not in self.bot.config.cache:
112112
self.bot.config['snippets'] = {}
@@ -124,7 +124,7 @@ async def add_(self, ctx, name: str.lower, *, value):
124124

125125
@snippets.command(name='remove', aliases=['del', 'delete', 'rm'])
126126
@checks.has_permissions(PermissionLevel.SUPPORTER)
127-
async def remove_(self, ctx, *, name: str.lower):
127+
async def snippets_remove(self, ctx, *, name: str.lower):
128128
"""Removes a snippet from bot config."""
129129

130130
if self.bot.config.snippets.get(name):
@@ -386,7 +386,6 @@ def format_log_embeds(self, logs, avatar_url):
386386
if prefix == 'NONE':
387387
prefix = ''
388388

389-
390389
log_url = self.bot.config.log_url.strip('/') + f'{prefix}/{key}'
391390

392391
username = entry['recipient']['name'] + '#'
@@ -450,9 +449,9 @@ async def logs(self, ctx, *, member: User = None):
450449
session = PaginatorSession(ctx, *embeds)
451450
await session.run()
452451

453-
@logs.command(name='closed-by')
452+
@logs.command(name='closed-by', aliases=['closeby'])
454453
@checks.has_permissions(PermissionLevel.SUPPORTER)
455-
async def closed_by(self, ctx, *, user: User = None):
454+
async def logs_closed_by(self, ctx, *, user: User = None):
456455
"""Returns all logs closed by a user."""
457456
user = user or ctx.author
458457

@@ -481,9 +480,9 @@ async def closed_by(self, ctx, *, user: User = None):
481480
session = PaginatorSession(ctx, *embeds)
482481
await session.run()
483482

484-
@logs.command()
483+
@logs.command(name='search', aliases=['find'])
485484
@checks.has_permissions(PermissionLevel.SUPPORTER)
486-
async def search(self, ctx, limit: Optional[int] = None, *, query):
485+
async def logs_search(self, ctx, limit: Optional[int] = None, *, query):
487486
"""Searches all logs for a message that contains your query."""
488487

489488
await ctx.trigger_typing()
@@ -518,7 +517,7 @@ async def search(self, ctx, limit: Optional[int] = None, *, query):
518517
@commands.command()
519518
@checks.has_permissions(PermissionLevel.SUPPORTER)
520519
@checks.thread_only()
521-
async def reply(self, ctx, *, msg=''):
520+
async def reply(self, ctx, *, msg: str):
522521
"""Reply to users using this command.
523522
524523
Supports attachments and images as well as
@@ -531,7 +530,7 @@ async def reply(self, ctx, *, msg=''):
531530
@commands.command()
532531
@checks.has_permissions(PermissionLevel.SUPPORTER)
533532
@checks.thread_only()
534-
async def anonreply(self, ctx, *, msg=''):
533+
async def anonreply(self, ctx, *, msg: str):
535534
"""Reply to a thread anonymously.
536535
537536
You can edit the anonymous user's name,
@@ -547,7 +546,7 @@ async def anonreply(self, ctx, *, msg=''):
547546
@commands.command()
548547
@checks.has_permissions(PermissionLevel.SUPPORTER)
549548
@checks.thread_only()
550-
async def note(self, ctx, *, msg=''):
549+
async def note(self, ctx, *, msg: str):
551550
"""Take a note about the current thread, useful for noting context."""
552551
ctx.message.content = msg
553552
async with ctx.typing():
@@ -579,7 +578,7 @@ async def find_linked_message(self, ctx, message_id):
579578
@checks.has_permissions(PermissionLevel.SUPPORTER)
580579
@checks.thread_only()
581580
async def edit(self, ctx, message_id: Optional[int] = None,
582-
*, new_message):
581+
*, new_message: str):
583582
"""Edit a message that was sent using the reply command.
584583
585584
If no `message_id` is provided, the
@@ -758,7 +757,6 @@ async def unblock(self, ctx, *, user: User = None):
758757
use only.
759758
"""
760759

761-
762760
if user is None:
763761
thread = ctx.thread
764762
if thread:
@@ -803,18 +801,19 @@ async def unblock(self, ctx, *, user: User = None):
803801
@commands.command()
804802
@checks.has_permissions(PermissionLevel.SUPPORTER)
805803
@checks.thread_only()
806-
async def delete(self, ctx, message_id = None):
804+
async def delete(self, ctx, message_id: Optional[int] = None):
807805
"""Delete a message that was sent using the reply command.
808806
809807
Deletes the previous message, unless a message ID is provided, which in that case,
810808
deletes the message with that message ID.
811809
"""
812810
thread = ctx.thread
813811

814-
try:
815-
message_id = int(message_id)
816-
except ValueError:
817-
raise commands.BadArgument('An integer message ID needs to be specified.')
812+
if message_id is not None:
813+
try:
814+
message_id = int(message_id)
815+
except ValueError:
816+
raise commands.BadArgument('An integer message ID needs to be specified.')
818817

819818
linked_message_id = await self.find_linked_message(ctx, message_id)
820819

cogs/plugins.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ async def plugin(self, ctx):
124124
cmd = self.bot.get_command('help')
125125
await ctx.invoke(cmd, command='plugin')
126126

127-
@plugin.command()
127+
@plugin.command(name='add')
128128
@checks.has_permissions(PermissionLevel.OWNER)
129-
async def add(self, ctx, *, plugin_name):
129+
async def plugin_add(self, ctx, *, plugin_name):
130130
"""Adds a plugin"""
131131
if plugin_name in self.bot.config.plugins:
132132
return await ctx.send('Plugin already installed')
@@ -164,9 +164,9 @@ async def add(self, ctx, *, plugin_name):
164164
await message.edit(content='Invalid plugin name format. '
165165
'Use username/repo/plugin.')
166166

167-
@plugin.command()
167+
@plugin.command(name='remove', aliases=['del', 'delete', 'rm'])
168168
@checks.has_permissions(PermissionLevel.OWNER)
169-
async def remove(self, ctx, *, plugin_name):
169+
async def plugin_remove(self, ctx, *, plugin_name):
170170
"""Removes a certain plugin"""
171171
if plugin_name in self.bot.config.plugins:
172172
username, repo, name = self.parse_plugin(plugin_name)
@@ -199,9 +199,9 @@ def onerror(func, path, exc_info):
199199
else:
200200
await ctx.send('Plugin not installed.')
201201

202-
@plugin.command()
202+
@plugin.command(name='update')
203203
@checks.has_permissions(PermissionLevel.OWNER)
204-
async def update(self, ctx, *, plugin_name):
204+
async def plugin_update(self, ctx, *, plugin_name):
205205
"""Updates a certain plugin"""
206206
if plugin_name not in self.bot.config.plugins:
207207
return await ctx.send('Plugin not installed')
@@ -232,9 +232,9 @@ async def update(self, ctx, *, plugin_name):
232232
except DownloadError as exc:
233233
await ctx.send(f'Unable to start plugin: `{exc}`')
234234

235-
@plugin.command(name='list')
235+
@plugin.command(name='list', aliases=['show', 'view'])
236236
@checks.has_permissions(PermissionLevel.OWNER)
237-
async def list_(self, ctx):
237+
async def plugin_list(self, ctx):
238238
"""Shows a list of currently enabled plugins"""
239239
if self.bot.config.plugins:
240240
msg = '```\n' + '\n'.join(self.bot.config.plugins) + '\n```'

0 commit comments

Comments
 (0)