You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB
JavaScript

"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: "<strong>Hello</strong> world 1!"
// }),
// sendMessage(session, {
// roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town",
// text: "Hello world 2!",
// html: "<strong>Hello</strong> world 2!"
// }),
// sendMessage(session, {
// roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town",
// text: "Hello world 3!",
// html: "<strong>Hello</strong> world 3!"
// }),
// ]);
return Promise.all([
sendMessage(session, {
roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town",
text: "Hello world 1!",
html: "<strong>Hello</strong> world 1!"
}).catch((err) => logError(err)),
sendMessage(session, {
roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town",
text: "Hello world 2!",
html: "<strong>Hello</strong> world 2!"
}).catch((err) => logError(err)),
sendMessage(session, {
roomID: "!TFtSgVEJlHMAhDyHOk:pixie.town",
text: "Hello world 3!",
html: "<strong>Hello</strong> world 3!"
}).catch((err) => logError(err)),
]);
}).then((result) => {
console.log(result);
});
});