Matrix Chat

This mod creates a bridge between a Matrix channel and the in-game chat!

Chat / Commands API / Library

Download (8 KB)

How do I install this?

This mod creates a bridge between a Matrix channel and the in-game chat. The code is shamelessly based on the irc mod and examples from lua-matrix.

This branch (master) needs a Matrix user that listens for messages and sends to Minetest. Chat messages posted in-game will be sent with the bot to the Matrix channel like so:

@minetestbot: <myuser> hello world

For a bridge where virtual users are created in Matrix, checkout the appservice branch!

This is a work in progress Until we have a stable release, expect breaking changes and whatnot.

Installing

OS X

brew install lua@5.1
luarocks-5.1 install lua-cjson
brew install openssl
luarocks-5.1 install cqueues CRYPTO_DIR=/usr/local/opt/openssl/ OPENSSL_DIR=/usr/local/opt/openssl #https://github.com/wahern/cqueues/wiki/Installation-on-OSX#via-brew
luarocks-5.1 install luaossl CRYPTO_DIR=/usr/local/opt/openssl/ OPENSSL_DIR=/usr/local/opt/openssl
luarocks-5.1 install luasocket
luarocks-5.1 install luasec OPENSSL_DIR=/usr/local/opt/openssl
export MATRIX_API_HTTP_CLIENT=luasocket

Ubuntu

Tested on 16.04.

apt-get install lua5.1 luarocks lua-sec
luarocks install lua-cjson
luarocks install luasocket
luarocks install luasec
export MATRIX_API_HTTP_CLIENT=luasocket

You might need to prepend sudo to first and second commands.

For the moment you need to add matrix_chat to secure.trusted_mods for lua-matrix to work. This will hopefully change.

secure.trusted_mods = matrix_chat

Settings

  • matrix.user: Matrix username, for example @minetestbot:matrix.org

  • matrix.password: Password for Matrix user

  • matrix.server: Server to connect to, include http(s) and port, https://matrix.org

  • matrix.room_id: Room to join, room_id in matrix. Always starts with !

Reviews

Review

Do you recommend this mod?

  • Lacks crucial informations

    Thank for this useful mod, i hope i will succeed its installation. Here is some feedback :

    I'm not sure if it's the right step as i just checked irc mod to understand where i should type the mentionned settings.

    Anyway, i updated the readme.md file and the file example : settingtype.txt.

    In the irc mod they wrote :

    All settings are changed in minetest.conf. If any of these settings are not set, the default value is used.
    * irc.server (string): The address of the IRC server to connect to.
    

    So for installing the mod, you should write those line in minetest.conf and fill the required field :

    ## mod : matrix_chat
    
    # Matrix username. May only contain characters A-Z, 0-9
    # '{', '}', '[', ']', '|', '^', '-', or '_'.
    # eg : @minetestbot:matrix.org
    matrix.user =
    
    # Server to connect to, include http(s)
    # matrix.server : the Matrix server (string )
    # eg : https://matrix.org
    matrix.server =
    
    # Channel the bot joins after connecting.
    # matrix.room_id : the channel to join (string)
    # eg : !abcde:matrix.org
    matrix.room_id =
    
    # Matrix user password. (string)
    matrix.password =
    

    And i haven't succeed to connect the chat with matrix. I guess the problem is that i lack knowledge to solve this issue. So i don't know if i missed a dependencies or if i should rewrite the path. no file './net/url.lua'

    Best regard, Gobtous

    0 comments
  • Works as expected

    Works fine, but by default sync flooding to log (xpcall issue), I just remove line at https://github.com/diggers-mt/matrix_chat/blob/master/init.lua#L115

    Also messages not visible itself from matrix to game in log, but is not issue, just note.

    0 comments

Used By