No project description provided
Project description
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
Contributing
Drop a pull request if you have something you'd want to incorporate.
License
See Licence.txt.
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
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 irckaaja-0.2.0.tar.gz.
File metadata
- Download URL: irckaaja-0.2.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04a73d1cd1291139d548c7e1ca28ffddad46e76aea010a93b15d7bf69467219
|
|
| MD5 |
8191ab27d82e3c96af542041cb048781
|
|
| BLAKE2b-256 |
d98a97028dbd46c99d37e93365e722efce9ce9ee2095fbc4805e3e3ea249fbce
|
File details
Details for the file irckaaja-0.2.0-py3-none-any.whl.
File metadata
- Download URL: irckaaja-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c9efe8a354c8c5fd59e3a4e49271fb8fef3baca30ef1ae9999bd836ccef5edd
|
|
| MD5 |
ee8ed0a289d6ca6425498dc2972e35cb
|
|
| BLAKE2b-256 |
7dceae90151e732c569fd2718c7e4ae37afd35f337b526364a0f849ecfd7e219
|