#!/usr/bin/env python3 from irc import IRC import config import module import imp import sys import traceback sock = IRC() msg = sock.recv() while msg[1] != "376": msg = sock.recv() sock.send("MODE %s +B" % config.nick) sock.send("JOIN #cookiebot") sock.send("PRIVMSG #cookiebot :Hi!") mods = [] for m in config.modules: mod = imp.load_source(m + ".py", "modules/" + m + ".py") mods.append(mod.Module(sock)) del mod while True: msg = sock.recv() if msg[0] == "PING": sock.send("PONG %s" % msg[1]) for m in mods: m.ping() continue if ":darklink!" in msg[0]: try: if msg[3] == ":!quit" and msg[2] == "cookiebot": sock.send("QUIT") except:
from irc import IRC import time irc = IRC('#EpiKnet') irc.connect('irc.epiknet.org','Philippe') #irc.epiknet.org time.sleep(5) irc.send('Salut MEC') time.sleep(2) while True: time.sleep(1) m = irc.recv() id = m.split('!')[0] id = id.lstrip(':') messages = m.split(' :') message = messages[-1] message = message.strip('\r\n') if m.find('PING') != -1: irc.ping() message = '' if len(message) != 0: if message.find('JOIN') != -1: print(id, 'a rejoint le channel') elif message == ' Je suis pas ton pote MEC' and id == 'Terrance': irc.send('Je suis pas ton mec MON GARS') time.sleep(1) #print(id, '>', message)