Discord šŸ”— Forum's API

Discord šŸ”— Forum's API

Administrator of a French S&Box community, I started to develop a bot discord like many people in the interest of keeping my community updated with news posted by Facepunch members.
It's while developing it that I had an idea, automate the announcement of new forum posts by Garry on our discord.


How is it working ..?

In order to do so, I asked around the functioning of the forum. As Garry explained a long time ago, the discord is based on the CMS: Discourse. So I looked up the discourse API through its documentation and found what I was interested in.

We then find /t/latest.json, returning all the latest posts in the forum, and /t/<topic id>.json that displays information about a particular post. All that in JSON.

It is with that, that I created my loop browsing the last posts created every X seconds with XMLHttpRequest in search of posts whose author is a developer to announce it on discord:


The Discourse API is quite simple to use but can be very costly in terms of performance when reading data, so it is necessary to optimize the reading of the data. I'm sure many of you will find different uses for it!

Iā€™m thinking about making this bot public in the next months, with many features like this one.
Find the development of Terry, here (It is a french community, but we have an international channel in case).


Good work man :slightly_smiling_face:


I had issues to post the result of it so here it is.