A simple IRC framework using trio.
from irc import IRCClient
async def main():
host, port, channel = ("irc.freenode.net", 6667, "#dummychan")
client = IRCClient(host, port)
await client.connect()
async for event in client.events():
print(event)
if event.type == 'ERR_NICKNAMEINUSE':
await client.handle_nicknameinuse()
elif event.type == 'RPL_ENDOFMOTD':
await client.join(channel)
elif event.type == 'JOIN':
await client.send_message("PRIVMSG", channel, "hello world")
await client.send_message("PRIVMSG", channel, "universe that")
python3.6
or greater
python3 -m venv .env
.env/bin/pip install -e git+https://github.com/millefalcon/TrioIRC@master#egg=trioirc
To run tests, you need pytest
and pytest-trio
installed.
git clone https://github.com/millefalcon/TrioIRC
cd TrioIRC/
python3 -m venv .env
.env/bin/pip install pytest pytest-trio
pytest
- Han-solo - Initial work - millefalcon
This project is licensed under the MIT License - see the LICENSE file for details
- Thanks to twisted for getting me started in writing IRC bots and the code that parses the data.
- Thanks to Henry, whose trioyoyo implementation for inspiration.
- Thanks to [Nathaniel J. Smith] (https://github.com/njsmith) for trio, his help and insights.