Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
AAAAAAA 3c7f280c7f Add an asynchronous IRC client implementation il y a 1 mois
ircbridge Add an asynchronous IRC client implementation il y a 1 mois
sample_app uwu il y a 6 mois
README.md uwu il y a 6 mois
pyproject.toml uwu il y a 6 mois



IRCbridge is a python library for easily creating bridges to IRC from arbitrary web hooks


IRCbridge manages dependencies with poetry. Installing dependencies for the main git branch can be done with:

# install poetry <https://python-poetry.org/docs/>
pip install poetry
# or, if you like to live dangerously
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

poetry install --no-dev

If a git tag is ever made, it’ll have a requirements.txt file generated from poetry, and you can install from that with pip install -r requirements.txt.


A sample application is provided in the sample_app directory, it looks like this:

from ircbridge import IrcBridge

app = IrcBridge("sample_pap")

class Thing:
    foo: str 

def thing_to_irc(thing: thing) -> tuple[bool, str]:
    return True, f"Thing said: {thing.foo}!"

app.make_route("/", thing_to_irc, Thing)

The basic idea is to create an IrcBridge application, a JSON dataclass (the dataclass decorator is applied automatically by IRCbridge) modeling the webhook payload, a callback function for the class, and a webhook route.

When IRCbridge receives a POST request to the route, it creates an instance of dataclass using the webhook payload, and passes that to the callback function.

The callback function returns a tuple where the first element is a bool, and the second is a string. If the first element is true, IRCbridge will send the second element to an IRC channel. You’ll usually want to return True, "message", but returning False, "" is useful for side-effects without messaging the channel.

How it works, at a more technical level

The IrcBridge class actually subclasses Quart, and runs as a Quart application. Before serving requests, it starts an asynchronous Pydle client; irc messages and webhook requests are all handled in the same thread through Python’s async.


Install dev dependencies with poetry:

poetry install

Then have fun hacking!


Who cares, do whatever.