Skip to content

Twitch bots

pinhook has a bot class made for Twitch chat:

from pinhook.bot import TwitchBot

bot = TwitchBot(
    nickname='ph-bot',
    channel='#channel',
    token='super-secret-oauth-token'
)
bot.start()

token is the bot account's oauth token, without the oauth: part. TwitchBot always connects to irc.chat.twitch.tv over ssl, so the token isn't sent in plain text.

Plugins work exactly the same as on IRC.

Options

TwitchBot takes fewer options, since Twitch handles the server and ssl:

Twitch doesn't have services accounts, so use nicks in ops and banned_users. Twitch usernames can't be changed freely like IRC nicks can.