GLaDOS/bot.py

28 lines
539 B
Python
Raw Normal View History

2020-11-08 01:41:33 +01:00
import socket
from threading import Thread
from irc import IRC
2020-11-11 13:46:05 +01:00
from v5 import V5
2020-11-08 01:41:33 +01:00
from secrets import USER, PASSWORD
class Bot(object):
def __init__(self, irc, v5, channels):
self.irc = IRC(*irc)
self.channels = channels
2020-11-11 13:46:05 +01:00
self.v5 = V5(v5, self.irc)
2020-11-08 01:41:33 +01:00
def start(self):
# Start IRC
self.irc.start(USER, PASSWORD)
2020-11-08 01:49:09 +01:00
# Join channels
2020-11-08 01:41:33 +01:00
for c in self.channels:
self.irc.join(c)
# Start v5 handler
2020-11-11 13:46:05 +01:00
self.v5.start()
2020-11-08 01:41:33 +01:00
# Run IRC
self.irc.run()