2018-01-19 18:04:38 -05:00
|
|
|
#!/usr/bin/env python3
|
2017-11-22 19:26:40 -05:00
|
|
|
"""
|
|
|
|
ban he
|
|
|
|
ban he
|
|
|
|
ban he
|
|
|
|
"""
|
2018-01-19 18:04:38 -05:00
|
|
|
import time
|
|
|
|
|
2018-01-23 18:40:08 -05:00
|
|
|
from module import commands, example, require_admin
|
2017-11-22 19:26:40 -05:00
|
|
|
import modules.adminchannel
|
|
|
|
|
2018-01-19 18:55:18 -05:00
|
|
|
@commands('banhe')
|
|
|
|
@example('.banhe assfaggot 30m')
|
2017-11-22 19:26:40 -05:00
|
|
|
def banhe(bot, trigger):
|
|
|
|
"""
|
|
|
|
Bans he for a set period of time. Admins may set the period of time,
|
|
|
|
non-admins only get 20 second bans.
|
|
|
|
"""
|
2018-01-19 18:55:18 -05:00
|
|
|
print(trigger.group())
|
2017-11-22 19:26:40 -05:00
|
|
|
banhee, period = trigger.group(3), trigger.group(4)
|
|
|
|
|
|
|
|
if not trigger.admin:
|
|
|
|
period = 20
|
|
|
|
else:
|
|
|
|
conv = {'s':1, 'm':60, 'h':3600, 'd':86400}
|
|
|
|
try:
|
|
|
|
period = conv[period[-1]] * int(period[:-1])
|
|
|
|
except (KeyError, ValueError, TypeError):
|
|
|
|
period = 0
|
|
|
|
|
2018-01-27 05:49:51 -05:00
|
|
|
bot.ban(banhee, trigger.sender)
|
2017-11-22 19:26:40 -05:00
|
|
|
if period > 2592000:
|
|
|
|
bot.reply("It's too big, Onii-chan.")
|
|
|
|
if not period or period > 2592000:
|
2018-01-19 18:04:38 -05:00
|
|
|
return bot.say(f"Banned \x0304{banhee}\x03 for \x0309∞\x03 seconds.")
|
2017-11-22 19:26:40 -05:00
|
|
|
|
2018-01-19 18:04:38 -05:00
|
|
|
bot.say(f"Banned \x0304{banhee}\x03 for \x0309{str(period)}\x03 seconds.")
|
2017-11-22 19:26:40 -05:00
|
|
|
time.sleep(period)
|
2018-01-27 05:49:51 -05:00
|
|
|
bot.unban(banhee, trigger.sender)
|
2018-01-19 18:55:18 -05:00
|
|
|
bot.say(f"Unbanned \x0304{banhee}\x03")
|
2018-01-19 18:04:38 -05:00
|
|
|
|
2018-01-19 18:55:18 -05:00
|
|
|
|
2018-01-23 18:40:08 -05:00
|
|
|
@require_admin
|
2018-01-19 18:55:18 -05:00
|
|
|
@commands("banheall")
|
2018-01-27 05:49:51 -05:00
|
|
|
def banheallCommand(bot, trigger):
|
2018-01-19 18:55:18 -05:00
|
|
|
"""
|
|
|
|
Ban them all, Johnny.
|
|
|
|
"""
|
|
|
|
period = trigger.group(2)
|
2018-01-27 05:49:51 -05:00
|
|
|
banheall(bot, period, trigger.sender)
|
2018-01-19 18:55:18 -05:00
|
|
|
|
2018-01-27 05:49:51 -05:00
|
|
|
|
|
|
|
def banheall(bot, period, channel):
|
|
|
|
"""
|
|
|
|
The real banhe.
|
|
|
|
"""
|
2018-01-19 18:55:18 -05:00
|
|
|
conv = {'s':1, 'm':60, 'h':3600, 'd':86400}
|
|
|
|
try:
|
|
|
|
period = conv[period[-1]] * int(period[:-1])
|
|
|
|
except (KeyError, ValueError, TypeError):
|
|
|
|
period = 0
|
|
|
|
|
2018-01-27 05:49:51 -05:00
|
|
|
for nick in bot.privileges[channel].keys():
|
|
|
|
bot.ban(nick, channel)
|
2018-01-19 18:55:18 -05:00
|
|
|
|
|
|
|
if period > 2592000:
|
|
|
|
bot.reply("It's too big, Onii-chan.")
|
|
|
|
if not period or period > 2592000:
|
|
|
|
return bot.say("Banned \x0304them all\x03 for \x0309∞\x03 seconds.")
|
|
|
|
|
|
|
|
bot.say(f"Banned \x0304them all\x03 for \x0309{str(period)}\x03 seconds.")
|
|
|
|
time.sleep(period)
|
|
|
|
|
2018-01-27 05:49:51 -05:00
|
|
|
for nick in bot.privileges[channel].keys():
|
|
|
|
bot.unban(nick, channel)
|
2018-01-19 18:55:18 -05:00
|
|
|
|
|
|
|
bot.say("Unbanned \x0304them all\x03")
|