How to use Discord to display Discourse RSS feed

So you want visualize RSS feed from your Discourse forum to your Discord server.

To do that you need a Discord Bot. You can use a hosted bot with an RSS cog and add it to your server or install a self-hosted bot and configure it.

I prefer Red-DiscordBot because it is self-hosted (you can install it on your server, it’s very easy to maintain, highly customizable and it has a very active community.)

Setting up the bot

  1. Follow this tutorial to install and configure Red.

  2. Create a new bot account on Discord and add the bot to your Discord server.

Adding the RSS feeds (custom cog)

When the bot is online on your server, you need to add a new custom cog (RSS) from the approved repositories

Install feedparser, running this command on your shell pip3 install feedparser

In your Discord channel type the follow commands:

[p]repo add aikaterna https://github.com/aikaterna/aikaterna-cogs

where [p] is your own bot’s prefix

[p]cog cog install aikaterna rss

Load the RSS cog:

[p]load rss

Now you have an RSS cog to configure. Choose the channel you want to use to visualize your RSS feed.

Note that every RSS is diplayed only in the channel you send the command, so you can add more RSS in one channel or you can add RSS for more (even all) channels (e.g. in #laboratory channel I have https://meta.discourse.org/latest.rss, in #general http://my.site.net/latest.rss, in #assistance http://my.site.net/c/assistance.rss and so on…)

Type:

[p]rss add Discourse https://meta.discourse.org/latest.rss

where “Discourse” is the name I have assigned to this RSS. You can add more than one RSS, but every RSS must have a different name.

If you use more than one word in your feed name, you have to use the double quotes e.g.

[p]rss add "Discourse Support" https://meta.discourse.org/c/support.rss

Now you can add a template. Links previews aren’t displayed by default.

[p]rss template Discourse $author:\n$title\n$link

To display link previews, you need to toggle the default embed style:

[p]rss embed toggle Discourse

You can still prevent link previews by wrapping $link with <>: <$link>

To force the feed preview type:

[p]rss force your-feed-name (e.g. [p]rss force Discourse)

This is the result without preview:

and with a preview:

To display help about the rss commands, type:

[p]rss help

Discourse RSS feeds

  • http://your.site.net/posts.rss
    latest posts (if your site is medium or big this link can create a lot of traffic in your Discord channel. Maybe create a channel only for RSS feed is better).

  • http://your.site.net/t/title-of-the-topic/number-id.rss
    for a particular topic (e.g. https://meta.discourse.org/t/babble-a-chat-plugin/31753.rss to follow the topic about Babble plugin)

  • http://your.site.net/latest.rss
    latest topics

  • http://your.site.net/top.rss
    top rated topics

  • http://your.site.net/c/support.rss
    posts and topics from a category (e.g. #support)

  • http://your.site.net/users/someone/activity.rss
    latest posts from someone (change someone with an username, e.g. codinghorror )

  • http://your.site.net/users/someone/activity/topics.rss
    latest topics from someone (change someone with an username, e.g. codinghorror )

  • http://your.site.net/groups/team/posts.rss
    all the public posts from a group (change team with the name of your group).

  • http://your.site.net/tags/tag-name.rss
    all the public topics with a particular tag (e.g. https://meta.discourse.org/tags/docker.rss to follow all the topics tagged #docker)

21 Likes