1.1.0 • Published 11 months ago

botkit-matrix2 v1.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

botkit-matrix

A Botkit connector for Matrix

Install

$ npm install botkit-matrix2

Usage

let config = {
    'baseUrl': 'https://matrix.org',
    'botUserId': '@youruserid:matrix.org',
    'password': 'yourpassword',
    'localStorage': 'filepath'
};

require('botkit-matrix2').MatrixController(config)
.then((controller) => {
    // get pm messages
    controller.on('message_received', async function(data) {

        if(data.e.type === 'm.room.message' && data.e.content.msgtype === 'm.text') {
            console.log(data.e.content.body)

            if(data.e.content.body === 'ping') {
                data.middleware.send({
                    channel: data.e.room_id,
                    text: 'pong'
                });
            }
        }
       
    });
});

Authors

based on: this repos

License

This project is licensed under Apache License 2.0 - see the LICENSE.md for details

1.1.0

11 months ago

1.0.4

11 months ago