A fully functioning multi-threaded IRC client.
Project description
This is a multi-threaded IRC bot that was designed to connect to a “feed” network (irc.wikimedia.org) and relay those to the client network (irc.freenode.net). An example bot would look like:
#!/usr/bin/env python from __future__ import unicode_literals import Queue from mtirc import bot from mtirc import settings config = settings.config config['nick'] = 'nick' class RcvThread(bot.ReceiveThread): def parse(self, channel, text, sender): print text if text.startswith('!ping'): self.pull.put((channel, 'pong')) self.debug('got a ping') elif channel == config['nick']: #pm'ing with bot if sender.host == 'me@me.com': chan = text.split(' ')[0] real_text = ' '.join(text.split(' ')[1:]) self.pull.put((chan, real_text)) push = Queue.Queue() pull = Queue.Queue() b = bot.Bot(push, pull, RcvThread, config, use_rc=False) b.run()
Features
Can use as many parse threads as set in config
Will attempt to reconnect if disconnected
Reads from a configuration file at ~/localsettings.py
More to come!
License
Released under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mtirc-0.1.0.tar.gz
(4.8 kB
view details)
File details
Details for the file mtirc-0.1.0.tar.gz
.
File metadata
- Download URL: mtirc-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ba7cf4490924f1aeafeef30f4a8ed5e8ffa0c1ebf8d352379d356ef7bcdd030 |
|
MD5 | b0dff4129ff3aee1ff34d64a51aaca0e |
|
BLAKE2b-256 | b3d1384419290e3a0837d8ada65c03b350bc0effa6478df5869810fe674da30c |