Skip to content

pinhook

The pluggable python framework for IRC bots and Twitch bots.

You write small plugins, each one a python function, and pinhook handles connecting, joining channels, ops, bans and getting your replies back to the right place.

import pinhook.plugin

@pinhook.plugin.command('!hello')
def hello(msg):
    return pinhook.plugin.message('hi {}!'.format(msg.nick))

Quick start

pip install pinhook

Make a plugins folder, save the plugin above in it as hello.py, then start a bot:

from pinhook.bot import Bot

bot = Bot(
    channels=['#foo'],
    nickname='ph-bot',
    server='irc.libera.chat',
    port=6697,
    ssl_required=True,
)
bot.start()

Say !hello in #foo and the bot answers.

Where to next

pinhook is made with love on tilde.town. Live bots using it include pinhook-tilde and adminbot.