/distodis

Send Discourse (forum) posts to a Discord (chat) channel.

Primary LanguagePHPMIT LicenseMIT

distodis

Send Discourse posts to a Discord channel.

  • Posts show up in pretty embedded fields that include the author, a link, and the first 80 characters of the post
  • Private messages and system messages are ignored
  • Discourse gets meaningful HTTP status codes in response to events
  • The hook lives in /docroot, so you don't have to sully your web root with git files
  • Change one line of code to add more hooks

sample

Requirements

  • PHP 5.5+
  • Your own web server

Install

$ git clone https://github.com/ellotheth/distodis

Setup

You'll want to check out the Discord and Discourse webhook documentation first.

One hook

  1. Copy config.php.dist to config.php.
  2. Add the values for your Discourse and Discord servers.
  3. Copy docroot/index.php.dist to docroot/index.php.
  4. Point your Discourse webhook at docroot/index.php.

Multiple hooks

  1. Copy config.php.dist to as many config files as you want hooks. The filename doesn't matter (I like config.<hook identifier>.php).

  2. Add the values for all your Discourse/Discord servers.

  3. Copy docroot/index.php.dist to as many index files as you want hooks. I use <hook identifier>.php.

  4. Modify each index file and replace the existing require '../config.php' line with the appropriate config filename. For example, docroot/mycoolserver.php might look like this:

    <?php
    
    require '../config.mycoolserver.php';
    require '../hook.php';
  5. Point each Discourse webhook at the appropriate index file.