1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 14:27:27 +00:00

Compressed try/excepts into a suppressing for loop

This commit is contained in:
Myned 2017-10-19 04:39:18 -04:00
parent 144e90abc1
commit d137ad40b1

View file

@ -124,21 +124,16 @@ def get_kwargs(ctx, args, *, limit=False):
if '-d' in remaining or '-dm' in remaining: if '-d' in remaining or '-dm' in remaining:
destination = ctx.author destination = ctx.author
try: for flag in ('-d', '-dm'):
remaining.remove('-d') with suppress(ValueError):
except ValueError: remaining.remove(flag)
remaining.remove('-dm')
if ('-r' in remaining or '-rm' in remaining or '-remove' in remaining) and ctx.author.permissions_in(ctx.channel).manage_messages: if ('-r' in remaining or '-rm' in remaining or '-remove' in remaining) and ctx.author.permissions_in(ctx.channel).manage_messages:
rm = True rm = True
try: for flag in ('-r', '-rm', '-remove'):
remaining.remove('-r') with suppress(ValueError):
except ValueError: remaining.remove(flag)
try:
remaining.remove('-rm')
except ValueError:
remaining.remove('-remove')
if limit: if limit:
for arg in remaining: for arg in remaining: