Skip to content
This repository has been archived by the owner on Feb 6, 2018. It is now read-only.

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaTiemsz committed Dec 29, 2017
1 parent 695c606 commit 7875b64
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions rowboat/plugins/infractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,47 @@ def ban(self, event, user, reason=None):
u=member.user if member else user,
))

@Plugin.command('mban', parser=True, level=CommandLevels.MOD)
@Plugin.parser.add_argument('users', type=long, nargs='+')
@Plugin.parser.add_argument('-r', '--reason', default='', help='reason for modlog')
def mban(self, event, args):
members = []
for user_id in args.users:
member = event.guild.get_member(user_id)
if not member:
raise CommandFail('failed to ban {}, user not found'.format(user_id))

if not self.can_act_on(event, member.id, throw=False):
raise CommandFail('failed to ban {}, invalid permissions'.format(user_id))

members.append(member)

msg = event.msg.reply('Ok, ban {} users for `{}`?'.format(len(members), args.reason or 'no reason'))
msg.chain(False).\
add_reaction(GREEN_TICK_EMOJI).\
add_reaction(RED_TICK_EMOJI)

try:
mra_event = self.wait_for_event(
'MessageReactionAdd',
message_id=msg.id,
conditional=lambda e: (
e.emoji.id in (GREEN_TICK_EMOJI_ID, RED_TICK_EMOJI_ID) and
e.user_id == event.author.id
)).get(timeout=10)
except gevent.Timeout:
return
finally:
msg.delete()

if mra_event.emoji.id != GREEN_TICK_EMOJI_ID:
return

for member in members:
Infraction.ban(self, event, member, args.reason, guild=event.guild)

raise CommandSuccess('banned {} users'.format(len(members)))

@Plugin.command('softban', '<user:user|snowflake> [reason:str...]', level=CommandLevels.MOD)
def softban(self, event, user, reason=None):
"""
Expand Down

0 comments on commit 7875b64

Please sign in to comment.