@Jean-baptiste-Devic Unfortunately no, because discord api does not return the role.
[Widget]Realtime topic updates
-
I need to know if there is an client side ajax method that i can use to poll for latest topics from selected categories. if there isn't, please suggest an alternative approach.
-
You can get the data from any route by adding
/api
to the front of the route.$.getJSON('/api/category/1', function (data) { console.log(data.topics); });
Will return up to the 20 most recent topics. The same that the user would see if they were viewing the page for category 1.
-
@yariplus said:
$.getJSON('/api/category/1', function (data) {
console.log(data.topics);
});I think i got this as a response for the request: "/category/1/announcements"
Don't know if i am doing it wrong. I created a new html widget and added your script inside a script tag. In the console, I am not getting anything. But i can see the request is successful, but there is no console.log outputting. In the network tab, i can see the response for this request as : "/category/1/announcements"
Sorry for the bad english
-
Anyway, I get all the categories and topics using this route: /api/categories
I think there is details on all topics also.