matrix-morg-bully/example.js

28 lines
944 B
JavaScript
Raw Permalink Normal View History

2022-10-17 00:09:05 -04:00
const sdk = require("matrix-js-sdk");
const matrixcs = require("matrix-js-sdk/lib/matrix");
const request = require('request');
matrixcs.request(request);
const startupTime = Date.now();
const myUserId = "@glowy:glowers.club"
const myAccessToken = "syt_TotallyMyRealAccessTokenAndNotAFake";
const matrixClient = sdk.createClient({
baseUrl: "https://glowers.club",
accessToken: myAccessToken,
userId: myUserId
});
const MorgBully = require('./index.js');
const morgBully = new MorgBully(matrixClient);
morgBully.setBlacklistedRooms(["!crybabies:matrix.org", "!peoplewhocanttakeajoke:matrix.org"]);
morgBully.setInsults(["you're a dummy", "you're going to get banned", "I'll slap you with a fish"]);
matrixClient.on("Room.timeline", function(event, room, toStartOfTimeline) {
if (event.getTs() >= startupTime && event.getType() == "m.room.member") {
morgBully.handleMembership(event, room);
}
});
matrixClient.startClient();