Created
April 9, 2015 15:30
-
-
Save pefoley2/76f1575ed5000abdda8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import sys | |
import time | |
from configparser import ConfigParser | |
from irc.client import SimpleIRCClient | |
class IrcClient(SimpleIRCClient): | |
def __init__(self, nick, config): | |
self.nick = nick | |
self.config = config | |
self.loading = False | |
SimpleIRCClient.__init__(self) | |
def on_welcome(self, c, e): | |
c.join("#msbob") | |
def on_join(self, c, e): | |
while True: | |
c.privmsg('#msbob', 'test') | |
time.sleep(1) | |
def main(): | |
logging.basicConfig(level=logging.INFO) | |
config = ConfigParser() | |
config.read_file(open('config.cfg')) | |
PORT = 6667 | |
CTRLNICK = "bot-controller" | |
client = IrcClient(CTRLNICK, config) | |
client.connect(config['core']['host'], PORT, CTRLNICK, config['auth']['ctrlpass']) | |
client.start() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment