https://github.com/an-empty-string/asyncirc
An IRC client library for Python
https://github.com/an-empty-string/asyncirc
Last synced: 10 months ago
JSON representation
An IRC client library for Python
- Host: GitHub
- URL: https://github.com/an-empty-string/asyncirc
- Owner: an-empty-string
- License: mit
- Created: 2015-09-01T04:26:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-01T04:26:17.000Z (over 10 years ago)
- Last Synced: 2023-08-01T03:57:55.368Z (over 2 years ago)
- Language: Python
- Size: 184 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# asyncirc [](https://travis-ci.org/watchtower/asyncirc) [](https://codeclimate.com/github/watchtower/asyncirc)
**Asyncirc** is an asyncio-based IRC framework for Python.
## Installation
```
pip install asyncio-irc
```
And you're done!
## Connecting
```python
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
```python
@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
```python
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](https://pythonhosted.org/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.