irc-toolkit
An IRC client toolkit in Python.
Installation
$ pip install irc-toolkit
Usage
There are a few parts of irc-toolkit, depending on your goals.
irctk.Message
offers IRC message parsing,
irctk.Client offers an
IRC client which handles connection/channel/nick tracking giving you a callback
based interface for IRC messages, for example:
#!/usr/bin/env python
import asyncio
import logging
import irctk
class Bot:
async def connect(self, hostname, port=6697, secure=True):
client = irctk.Client()
client.delegate = self
await client.connect(hostname, port, secure)
def irc_registered(self, client):
client.send('MODE', client.nick, '+B')
client.send('JOIN', '#test')
def irc_private_message(self, client, nick, message):
if message == 'ping':
client.send('PRIVMSG', nick, 'pong')
def irc_channel_message(self, client, nick, channel, message):
if message == 'ping':
client.send('PRIVMSG', channel, f'{nick}: pong')
elif message == 'quit':
client.quit()
if __name__ == '__main__':
# Enable debug logging
logging.basicConfig(level='DEBUG')
bot = Bot()
asyncio.run(bot.connect('irc.darkscience.net'))
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
irc_toolkit-0.4.0.tar.gz
(13.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file irc_toolkit-0.4.0.tar.gz.
File metadata
- Download URL: irc_toolkit-0.4.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.3 CPython/3.11.9 Linux/6.6.58
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32c9045815d38938daa80fec3137b3a5ee95632478aed4f4c323e77357fe99d9
|
|
| MD5 |
5d04725fa92256ad4eb37df7007d224d
|
|
| BLAKE2b-256 |
eb18e9d4e0846f2b35d2620c54f83b4dab6029e1def8267695e9ce229ab15e28
|
File details
Details for the file irc_toolkit-0.4.0-py3-none-any.whl.
File metadata
- Download URL: irc_toolkit-0.4.0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.3 CPython/3.11.9 Linux/6.6.58
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d075d3b66dd27f931997f04bc32b0165b835f42e7773a8fe94fb0ebbeb2c79a
|
|
| MD5 |
c490353c608ab4a279a02fdcb7efda9c
|
|
| BLAKE2b-256 |
f59b5cbe62bc102517d9380bc2148e786ccac90ef9729f56ff1e904d21e576a9
|