2018-07-03 09:15:38 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
def eventPING(IRC, line):
|
2018-07-04 23:47:01 +00:00
|
|
|
IRC.queue("PONG {}".format(line[1]))
|
2018-07-03 09:15:38 +00:00
|
|
|
|
|
|
|
def event001(IRC, line):
|
|
|
|
IRC.join()
|
|
|
|
|
2018-07-03 15:20:29 +00:00
|
|
|
def event433(IRC, line):
|
|
|
|
IRC.nick += "_"
|
|
|
|
IRC.updateNick()
|
|
|
|
|
2018-07-03 09:15:38 +00:00
|
|
|
def eventJOIN(IRC, line):
|
|
|
|
IRC.log.info("{} JOIN to {}".format(line[0], line[2]))
|
|
|
|
|
|
|
|
def eventPART(IRC, line):
|
|
|
|
IRC.log.info("{} PART from {}".format(line[0], line[2]))
|
|
|
|
|
|
|
|
def eventKICK(IRC, line):
|
|
|
|
if line[3] == IRC.nick:
|
|
|
|
IRC.log.warn("Got kicked from {} !".format(line[2]))
|
|
|
|
chan = line[2]
|
|
|
|
if chan == IRC.channel:
|
|
|
|
IRC.join()
|
|
|
|
|
|
|
|
def eventQUIT(IRC, line):
|
|
|
|
if line[0][1:].split("@")[0].split("!")[0] == IRC.nick:
|
|
|
|
IRC.log.warn("quit ! Reconnecting in 15 seconds..")
|
|
|
|
time.sleep(15)
|
2018-07-04 23:47:01 +00:00
|
|
|
IRC.init()
|
2018-07-03 09:15:38 +00:00
|
|
|
|
|
|
|
def eventINVITE(IRC, line):
|
|
|
|
IRC.log.info("{} invited the bot to {}".format(line[0][1:].split("!")[0], line[3][1:]))
|
|
|
|
|
|
|
|
def eventPRIVMSG(IRC, line):
|
|
|
|
nick,user = line[0][1:].split("@")[0].split("!")
|
|
|
|
user = user[1:] if user[0] == '~' else user
|
|
|
|
host = line[0].split("@")[1]
|
2018-07-04 23:47:01 +00:00
|
|
|
try:
|
|
|
|
IRC.handle_msg(line[2], IRC.isAdmin(line[0][1:]), nick, user, host, ' '.join(line[3:])[1:])
|
|
|
|
except:
|
|
|
|
pass
|