Skip to content

ircbot: Configuration

qedk edited this page Jul 30, 2020 · 4 revisions

The ircbot.py script expects the configuration file to be in the format:

[api]
email=emailaddress@zulipchat.com
key=topsecretapikey
site=https://wikimedia.zulipchat.com

[irc]
server=irc.freenode.net
nickname=ircnick
channel=#ircchannel
nickserv_password=yourtopsecretpassword
stream=zulipstreamtobridge
topic=topicofstreamtobridge

This first section of the file ([api]) is automatically generated in the "Your bots" section on Zulipchat but your system might complain if you try to modify it since the file name starts with a period (.), as they signify system-generated files. The second section you have to create manually for the bot, but it's combined into one file to make handling much easier. You can use any file name of your choice and pass it to the config_file argument and create an IRCBot object like:

ircbot = IRCBot(config_file="~/ircbot")

There's no more configuration required and once the script is run, the bot should run seamlessly.

You can also use environment variables to the same effect but ircbot does not use them, instead preferring to do environment-based configuration behind the scenes.