Matterbabble: Discourse Matterbridge integration

(Declan Hoare) #1

I’ve created an API bot to connect Discourse topics to Matterbridge, which in turn carries messages to and from services like IRC, Discord, Gitter, and Slack. It’s mainly intended for use with the Discourse Babble plugin, to integrate that chat with other chat services. But it should work with regular topics if you want it to.

It’s on github at https://github.com/DeclanHoare/matterbabble

14 Likes
(Blumiere) #2

I’ve been looking forward to using this, and even switched over from Xenforo to Discourse to be able to use my existing matterbridge setup with a forum’s integrated chat, which has been connecting several Telegram groups to Rocket.Chat channels for the last few months.

I get this issue when I try to run matterbabble though:

ubuntu@chatbridge:~/matterbabble$ python -m matterbabble configparser.ini Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main mod_name, _Error) File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details __import__(mod_name) # Do not catch exceptions initializing package File "/home/ubuntu/.local/lib/python2.7/site-packages/matterbabble/__init__.py", line 2, in <module> from .application import application File "/home/ubuntu/.local/lib/python2.7/site-packages/matterbabble/application.py", line 24 async def loop(self, service): ^ SyntaxError: invalid syntax

I made the configparser.ini setup as described and added the relevant api information to my matterbridge.toml. They are running off of the same server. Does this seem more like an environment issue or a syntax issue? I don’t know much about Python.

(Rafael dos Santos Silva) #3

You need to use python3 instead of python 2.

2 Likes
(Blumiere) #5

Thank you for the reply. I get a different error when I use Python 3.

ubuntu@chatbridge:~/matterbabble$ python3 -m matterbabble configparser.ini
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/matterbabble/__init__.py", line 2, in <module>
    from .application import application
  File "/home/ubuntu/.local/lib/python3.6/site-packages/matterbabble/application.py", line 12, in <module>
    from .discourse import discourse
  File "<fstring>", line 1
    (await req.text())
             ^
SyntaxError: invalid syntax
(Rafael dos Santos Silva) #6

await is a Python 3.7 thing.

4 Likes
(Blumiere) #7

Thank you for your help on this. Using Python 3.7 indeed got the script in question working.

I found the script unsuitable for production compared to Discourse/Babble/Matterbridge. This could be related to additional environmental issues or it could perhaps be the use of Telegram specifically.

  • There’s a 10+ second latency for messages appearing inside of Babble (the other way is instantaneous)
  • Pictures get dropped entirely (the author mentions that links to images would be shared instead)
  • Messages will at random (~50% of the time) not be delivered to the Babble side until Matterbabble is restarted.
2 Likes