mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 13:02:38 +00:00
Compressed try/excepts into a suppressing for loop
This commit is contained in:
parent
144e90abc1
commit
d137ad40b1
1 changed files with 6 additions and 11 deletions
|
@ -124,21 +124,16 @@ def get_kwargs(ctx, args, *, limit=False):
|
|||
if '-d' in remaining or '-dm' in remaining:
|
||||
destination = ctx.author
|
||||
|
||||
try:
|
||||
remaining.remove('-d')
|
||||
except ValueError:
|
||||
remaining.remove('-dm')
|
||||
for flag in ('-d', '-dm'):
|
||||
with suppress(ValueError):
|
||||
remaining.remove(flag)
|
||||
|
||||
if ('-r' in remaining or '-rm' in remaining or '-remove' in remaining) and ctx.author.permissions_in(ctx.channel).manage_messages:
|
||||
rm = True
|
||||
|
||||
try:
|
||||
remaining.remove('-r')
|
||||
except ValueError:
|
||||
try:
|
||||
remaining.remove('-rm')
|
||||
except ValueError:
|
||||
remaining.remove('-remove')
|
||||
for flag in ('-r', '-rm', '-remove'):
|
||||
with suppress(ValueError):
|
||||
remaining.remove(flag)
|
||||
|
||||
if limit:
|
||||
for arg in remaining:
|
||||
|
|
Loading…
Reference in a new issue