def tempban(self, event, duration, user, reason=None):
member = event.guild.get_member(user)
if member:
self.can_act_on(event, member.id)
expires_dt = parse_duration(duration)
Infraction.tempban(self, event, member, reason, expires_dt)
self.queue_infractions()
self.confirm_action(event, maybe_string(
reason,
u':ok_hand: temp-banned {u} for {t} (`{o}`)',
u':ok_hand: temp-banned {u} for {t}',
u=member.user,
t=humanize.naturaldelta(expires_dt - datetime.utcnow()),
))
else:
raise CommandFail('invalid user')
评论列表
文章目录