I created a chat bot for the Stack Exchange chat rooms.

The bot is open-source and the code is hosted on GitHub.

The bot is licensed under CPOL (The Code Project Open License) v1.02. You can find a copy of this license in LICENSE.htm.

The bot runs in the chat.SE Sandbox on the account FOX 9000. Run >>help to get some help. If the bot is down (usually a connection error), ping me in that room.


The bot uses Python 3. Before you can use the bot, you need to install some dependencies such as ChatExchange3 (the Python 3 port of ChatExchange) and BeautifulSoup4. You can install them by running setup.sh.

You'll also need to copy template/ConfigTemplate.py to Config.py. You will also need to add some required configuration data in Config.py. The comments in that file tell you which values you can add and how to add them.


When you run the bot, it will prompt you for necessary information that you have not provided in Config.py. If you wish to use a specific configuration, run the bot with the argument -c configuration_name. You can also use -s site_name, -r room_number, -e email_address and -p password. The last four items will always override data stored in a configuration, if set.


You can use logging on the bot. It is disabled by default, but you can enable it by un-commenting the self.setup_logging() line in Chatbot.py (in the main method).

Executing commands/posting messages using the command line

You can execute commands from the bot by providing input on the command line. $+command args will execute the command and post the result to the chat room, and $-command args will only post the result to the command line. If your input does not start with a $, the bot will post the given input to the chat room.

Commands in a chat room

Commands in a chat room are executed like >>command optional arguments. To get a list of all commands, run >>listcommands. To get help on a specific command, run >>help command.


You can extend the bot by adding your own modules containing commands, which you can group into meta-modules. See the templates in the templates/ folder for help on how to create a module. Thanks a lot to overactor for the idea and for a major part of the implementation!

  • 1
    I've just stumbled upon this. Wanted to let you know (/remind you) that ByteCommander's ChatExchange3 now redirects to their ChatExchange6, which contains a warning that the 2-3 polyglot version has been merged back to Manishearth's original repo and that should be used instead. Commented Jan 11, 2017 at 16:41
  • 2
    @AndrasDeak Yup, I'm aware, but you remind me that I still have to update SE-Chatbot to no longer use the old ChatExchange3. I will update my post as soon as I fixed that. Thanks!
    – ProgramFOX
    Commented Jan 11, 2017 at 17:11


You must log in to answer this question.

Browse other questions tagged .