Is there any support for user-made bots?


#1

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.


(Matt Palmer) #2

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


(Michael Howell) #3

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.


(Jeff Atwood) #4

Er what? Users can have their own API keys.


(Sam Saffron) #5

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)


(Michael Howell) #6

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.


(Matt Palmer) #7

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.


#8

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

Thanks!


(Jeff Wong) #9

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.


#10

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.