Skip to main content

Irckaaja

A scriptable IRC bot with a Python interface.

Table of Contents

Installation

irckaaja requires Python 3.9 or newer. The package is available on PyPI and can be installed with pip

pip install irckaaja

Usage

python -m irckaaja.irckaaja -c config.ini

Scripts

To build your own scripts, subclass irckaaja.botscript.BotScript. Currently subscribable events are

    def on_channel_message(
        self, user: User, channel_name: str, message: str
    ) -> None:
        """
        Called when a channel message is received.
        """

    def on_private_message(self, user: User, message: str) -> None:
        """
        Called when a private message is received.
        """

    def on_join(self, user: User, channel_name: str) -> None:
        """
        Called when a user joins a channel.
        """

    def on_part(self, user: User, channel_name: str) -> None:
        """
        Called when a user parts a channel.
        """

    def on_quit(self, user: User) -> None:
        """
        Called when a user quits the network.
        """

    def on_connect(self) -> None:
        """
        Called when bot has connected to the network.
        """

    def on_topic(self, user: User, channel_name: str, topic: str) -> None:
        """
        Called when topic has changed on a channel.
        """

A simple greeter bot would look like this.

from irckaaja.botscript import BotScript, User


class HelloWorld(BotScript):
    """
    A simple script class. Only responds to messages starting "hello"
    in every joined channel.
    """

    def on_channel_message(
        self, user: User, channel_name: str, message: str
    ) -> None:
        if message.startswith("hello"):
            self.say(channel_name, "hello, " + user.nick)
            return

The modules should be present in the irckaaja.scripts package and named as the lowercase of the class name found in the module. E.g. script called Greeter should be placed to irckaaja.scripts.greeter.Greeter.

Loading of modules is controlled by the [modules] section of the configuration file:

[modules]
    [[Greeter]]
        arbitrary_configuration = "passed to script as a dict[str, Any]"

Configuration

Example configuration:

[servers]
    [[QuakeNet]] # also alias for the network
        hostname = se.quakenet.org
        port = 6667 # if port is no defined, default is 6667
        channels = "#example1", "#example2"
    #[[IRCNet]]
    #    hostname = irc.cs.hut.fi

[bot]
    nick = irckaaja
    altnick = irckaaja_ # if not provided, nick + "_"
    realname = Irkkaa Nörttien Kanssa
    username = irckaaja
    owner = "nick!user@example.com"

[modules]
    [[HelloWorld]]

Screenshots

Connection output

Contributing

Drop a pull request if you have something you'd want to incorporate.

License

See Licence.txt.

Metadata

Release files for irckaaja 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for irckaaja 0.3.0
File Size Uploaded Provenance Actions
irckaaja-0.3.0.tar.gz 13.0 kB Without provenance Details for irckaaja-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for irckaaja 0.3.0
File Interpreter ABI Platform Actions
irckaaja-0.3.0-py3-none-any.whl Python 3 none any Details for irckaaja-0.3.0-py3-none-any.whl

Total release size: 29.2 kB

Release files / irckaaja-0.3.0.tar.gz

Download URL irckaaja-0.3.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8cfa2c6200487a4ff620352465f176c56e696462c6709de75b977e070943decf
BLAKE2b-256 checksum
How to use checksums
f90efacde976dd7874678b36ad3cd348148eb59a60fff25168fab3b770fc07d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / irckaaja-0.3.0-py3-none-any.whl

Download URL irckaaja-0.3.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0500c734ac3b716524acdc82da8737d045c6dabe37ce54e01062c94c6cbcbd1
BLAKE2b-256 checksum
How to use checksums
550ff24ed084a2ca15ad3c76552f9a9cd49272dc2bad06c3cfbb925ea6120201
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for irckaaja 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page