Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@sopel.module.event('JOIN')
@sopel.module.rule('.*')
def rss(bot, trigger):
if sopel.tools.Identifier(trigger.sender) == "#pancakes" and trigger.nick == bot.nick:
time.sleep(5)
bot.say("Starting RSS.")
now = time.gmtime()
time.sleep(3600)
while True:
time.sleep(7200)
quietnow = datetime.datetime.utcnow().time()
out = parse(now)
if out:
if quietnow >= datetime.time(3,00) or quietnow <= datetime.time(11,00):
pass
else:
bot.say(out)
@sopel.module.event('JOIN')
@sopel.module.rule('.*')
def ban_on_join(bot, tr):
inp = jarvis.core.Inp(
None, tr.nick, tr.sender,
functools.partial(send, bot),
functools.partial(privileges, bot, tr.nick),
bot.write)
inp.send(jarvis.autoban.autoban(inp, tr.nick, tr.host))
@sopel.module.event('JOIN')
@sopel.module.rule('.*')
def join_event(bot, tr):
bad_words = [
'bitch', 'fuck', 'asshole', 'penis', 'vagina', 'nigger', 'retard',
'faggot', 'chink', 'shit', 'hitler', 'douche']
for word in bad_words:
if word in tr.nick.lower():
ban_user(bot, tr)
for ban in bot.memory['bans']:
if tr.nick.lower() in ban.names:
ban_user(bot, tr, ban)
if tr.host in ban.hosts:
ban_user(bot, tr, ban)
@event("401")
def whois_not_found_reply(bot, trigger):
"""
Listens for unsuccessful WHOIS responses and saves
None to the bot's memory so that the initial
whois function is aware that the lookup failed.
"""
nick = trigger.args[1]
bot.memory["whois"][nick] = None
# Give the initiating whois function time to see
# that the lookup has failed, then remove the None.
sleep(5)
try:
del bot.memory["whois"][nick]
except KeyError:
pass
@event("311")
def whois_found_reply(bot, trigger):
"""
Listens for successful WHOIS responses and saves
them to the bot's memory.
"""
nick = trigger.args[1]
bot.memory["whois"][nick] = Whois(trigger.args)