Skip to content
Snippets Groups Projects
Commit 163d78d5 authored by lavamind's avatar lavamind
Browse files

Use irc.bot facility

parent 6ae1005c
Branches master
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import threading
import irc.client
import irc.bot
import tinyurl
import time
import re
......@@ -12,20 +12,18 @@ from db import FeedDB
from config import Config
import lxml.html
class IRCBot(irc.client.SimpleIRCClient):
class IRCBot(irc.bot.SingleServerIRCBot):
def __init__(self, config, db, on_connect_cb):
irc.client.SimpleIRCClient.__init__(self)
self.__config = config
irc.bot.SingleServerIRCBot.__init__(self, [(self.__config.HOST, self.__config.PORT)], self.__config.NICK, self.__config.NICK)
self.__db = db
self.connect(self.__config.HOST, self.__config.PORT, self.__config.NICK)
#self.connect(self.__config.HOST, self.__config.PORT, self.__config.NICK)
self.__on_connect_cb = on_connect_cb
self.num_col = self.__config.num_col
self.date = self.__config.date
self.feedname = self.__config.feedname
def on_welcome(self, connection, event):
"""Join the correct channel upon connecting"""
if irc.client.is_channel(self.__config.CHANNEL):
connection.join(self.__config.CHANNEL)
def on_join(self, connection, event):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment