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¶
- Getting started: config files, the command line tool and your first plugin
- Options: everything you can set on a bot
- Writing plugins: commands, listeners and what a plugin gets to work with
- Testing plugins: check your plugins with pytest, no server needed
- Bans and ops: who can run what, and bans that are hard to dodge
- Troubleshooting: what the log messages mean
- Coming from an older version? See Upgrading to 1.11, and Preparing for 2.0 to get your plugins ready for what's next
pinhook is made with love on tilde.town. Live bots using it include pinhook-tilde and adminbot.