Skip to main content

A Python IRCv3 Client Library

Project description

irc-toolkit

Build Status Test Coverage

An IRC client toolkit in Python.

Installation

$ pip install irc-toolkit

Usage

import asyncio
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):
        channel = client.add_channel('#test')
        channel.join()

    def irc_private_message(self, client, nick, message):
        if message == 'ping':
            nick.send('pong')

    def irc_channel_message(self, client, nick, channel, message):
        if message == 'ping':
            channel.send('{}: pong'.format(nick))


if __name__ == '__main__':
    bot = Bot()

    loop = asyncio.get_event_loop()
    loop.create_task(bot.connect('chat.freenode.net'))
    loop.run_forever()

Project details


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.3.0.tar.gz (12.1 kB view details)

Uploaded Source

File details

Details for the file irc-toolkit-0.3.0.tar.gz.

File metadata

  • Download URL: irc-toolkit-0.3.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for irc-toolkit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 726512e0633c4c11ff83cd02a9ed6da21a9067bc9f6c4ecb6a841e218578da96
MD5 f2729065a42b2a722176a8df6cee72e5
BLAKE2b-256 c39e5521bcde4d89c6261599b8bc433740c50615cd86a36edad9cb48047a189e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page