we can read state

master
lub 6 years ago
parent 21adc1e51c
commit 25c1771782

@ -4,14 +4,23 @@ const roomId = '!MQClELEJFefiUVmsNw:imninja.net';
//const http = require('http'); //const http = require('http');
const Cli = require('matrix-appservice-bridge').Cli; const Cli = require('matrix-appservice-bridge').Cli;
const Bridge = require('matrix-appservice-bridge').Bridge; const Bridge = require('matrix-appservice-bridge').Bridge;
const AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration; const AppServiceRegistration = require('matrix-appservice-bridge').AppServiceRegistration;
const StateLookup = require('matrix-appservice-bridge').StateLookup;
let bridge; let bridge;
let feedtracker;
//http.createServer((request, response) => { //http.createServer((request, response) => {
// console.log('http online'); // console.log('http online');
//}).listen(appservicePort); //}).listen(appservicePort);
const getFeeds = (client) => {
};
new Cli({ new Cli({
registrationPath: 'registration.yaml', registrationPath: 'registration.yaml',
generateRegistration: (reg, callback) => { generateRegistration: (reg, callback) => {
@ -38,15 +47,24 @@ new Cli({
const event = request.getData(); const event = request.getData();
// event.content.keywords etc. // event.content.keywords etc.
if(event.type !== 'de.lubiland.rss') { if(event.type !== 'de.lubiland.feedrsser.config') {
return; return;
} }
return; feedtracker.onEvent(event);
} }
} }
}); });
bridge.run(port, config); bridge.run(port, config);
bridge.getIntent('@_rss_test0r:imninja.net').sendText(roomId, 'asef :)');
feedtracker = new StateLookup({
client: bridge.getIntent('@_rss_test0r:imninja.net').client,
eventTypes: ['de.lubiland.feedrsser.config']
});
feedtracker.trackRoom(roomId).then(() => {
const asef = feedtracker.getState(roomId, 'de.lubiland.feedrsser.config');
});
//bridge.getIntent('@_rss_test0r:imninja.net').sendText(roomId, 'asef :)');
} }
}).run(); }).run();