Skip to content

Instantly share code, notes, and snippets.

@pefoley2
Created April 9, 2015 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pefoley2/76f1575ed5000abdda8c to your computer and use it in GitHub Desktop.
Save pefoley2/76f1575ed5000abdda8c to your computer and use it in GitHub Desktop.
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