asyncio-based IRC library for Python
Python Makefile
Switch branches/tags
Nothing to show
Clone or download
Latest commit 303617e Oct 22, 2017
Permalink
Failed to load latest commit information.
asyncirc Fix #13 (#14) Oct 22, 2017
doc add fluent to docs Aug 25, 2015
test add mode tests Jul 2, 2016
.gitignore comment caps Jun 29, 2016
.travis.yml send coverage to codacy Jul 2, 2016
LICENSE.md update license statement Sep 1, 2015
Makefile actually codacy coverage Jul 2, 2016
README.md mention installing from git Jul 1, 2016
setup.py bump version and add queueing May 16, 2015

README.md

asyncirc Build Status Code Climate

Asyncirc is an asyncio-based IRC framework for Python.

Installation

pip install asyncio-irc

And you're done!

You can also use setup.py to manually install from a git version.

Connecting

from asyncirc import irc

bot = irc.connect("chat.freenode.net", 6697, use_ssl=True)
bot.register("nickname", "ident", "realname", password="pass") # password optional

Subscribing to events

@bot.on("message")
def incoming_message(parsed, user, target, text):
    # parsed is an RFC1459Message object
    # user is a User object with nick, user, and host attributes
    # target is a string representing nick/channel the message was sent to
    # text is the text of the message
    bot.say(target, "{}: you said {}".format(user.nick, text))

Using plugins

import asyncirc.plugins.tracking # channel/user state tracking
import asyncirc.plugins.addressed # events that fire when the bot is addressed
import asyncirc.plugins.nickserv # events that fire on nickserv authentication responses

Writing code without a reference to the IRCProtocol object

Asyncirc uses the excellent Blinker library. That means that you can just run from blinker import signal and hook into asyncirc's events without needing a reference to the IRCProtocol object. This is especially useful in writing plugins; take a look at plugin code for examples.