Is there any support for user-made bots?

AI-generated summary

The discussion explores the feasibility of creating user-made bots on Discourse, particularly for running a forum game like Mafia. orangeandblack5 asks if it’s possible to build a bot for complex tasks, noting the availability of a Hubot adapter. mpalmer confirms that Discourse’s comprehensive API supports bot development. notriddle clarifies that API tokens are issued by administrators, though codinghorror and sam note that users can have API keys, albeit with administrative setup. mpalmer emphasizes the need for staff approval to avoid issues. featheredtoast suggests using the message bus and studying the Hubot adapter for implementation. orangeandblack5 explains the bot would automate Mafia game mechanics like voting and cycle progression, with development planned after school commitments.

I did some searching but was only able to find a Hubot adapter - is there any way to create a bot that could be used to accomplish relatively complex tasks such as running a forum game? I’ve seen some forums running on other platforms use bots to great effect in this manner, and was wondering if it is possible to set up a similar system on Discourse.

If this needs to be moved, please feel free to do so, but this seemed to be the most appropriate place to ask.

Sure, Discourse has a comprehensive API which should be sufficient for running a bot on the site.

API tokens can only be handed out by administrators (or manually sussed out of browser cookies, but you’re not supposed to do that). If somebody wants to add a bot, they’re supposed to ask a staff member, who will give them the token.

Er what? Users can have their own API keys.

User API is doable but it requires a rather complex protocol. Simplest thing is to have admins issue admin api keys that are tied to a specific user (bot user in this case)

API keys can be linked to users, but they’re created in the Admin page. I (being a non-admin) can’t just click a button and get an API key for Meta like I can on (for example) GitHub.

If you’re running a forum game on a site without the knowledge and approval of site staff, you’re probably going to have a bad time.

Cool. As I’ve done some bots before but never on Discourse, any specific tips I could use to help the transition?

Thanks!

What kind of bots are you building out of curiosity?

If you’re not building on top of Hubot, I’d recommend taking the same approach as I did with the Hubot adapter, and listen with the message bus for notifications.

You can get a pretty good idea of how to use the Discourse API for getting messages, and responding by looking at the adapter source, too.

Thanks for the recommendation!

The basic idea is to build a bot to automatically run a small game of Mafia. Ideally, it would have several functions, such as counting votes, carrying out player actions, and automatically progressing through the game’s day and night cycles without requiring somebody to do so manually.

I won’t have time to work on this for a few months because school, so I’m just gathering information at this point. Should streamline the process later.