"use strict";

const Promise = require("bluebird");
const mmStreamBacklog = require("./");
const pipe = require("@promistream/pipe");
const simpleSink = require("@promistream/simple-sink");

let session = {
	homeserver: "https://pixie.town",
	accessToken: require("../../../private/access-token")
};

return Promise.try(() => {
	return pipe([
		mmStreamBacklog(session, "!yjVgJUsMLYLAONsoii:jki.re", {
			start: "s14964921_63289774_419108_6402604_769480_404_26267_3427116_36",
			end: "s14886247_62932075_392219_6368720_764854_404_25467_3352546_36" // original token used for /sync
		}),
		simpleSink((event) => console.log("EVENT:", event))
	]).read();
}).then(() => {
	console.log("Done");
});

// let emitter = mmStreamEvents(session, "s14011802_60514432_167714_6077759_745604_385_21833_2919406_36");
