"use strict"; const Promise = require("bluebird"); const createSession = require("@modular-matrix/create-session"); const sendMessage = require("./"); function logError(error) { console.error("caught:", require("util").inspect(error, { colors: true, depth: 0 })); } return Promise.try(() => { return createSession("https://pixie.town/", { accessToken: require("../../../private/access-token") }); }).then((session) => { return Promise.try(() => { // return sendMessage(session, { // roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", // text: "---", // html: "---" // }); }).then(() => { // return Promise.all([ // sendMessage(session, { // roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", // text: "Hello world 1!", // html: "Hello world 1!" // }), // sendMessage(session, { // roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", // text: "Hello world 2!", // html: "Hello world 2!" // }), // sendMessage(session, { // roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", // text: "Hello world 3!", // html: "Hello world 3!" // }), // ]); return Promise.all([ sendMessage(session, { roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", text: "Hello world 1!", html: "Hello world 1!" }).catch((err) => logError(err)), sendMessage(session, { roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", text: "Hello world 2!", html: "Hello world 2!" }).catch((err) => logError(err)), sendMessage(session, { roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town", text: "Hello world 3!", html: "Hello world 3!" }).catch((err) => logError(err)), ]); }).then((result) => { console.log(result); }); });