clean up commented code in app.js

This commit is contained in:
murm 2023-03-18 20:29:22 -04:00
parent 0042656bff
commit 0b4188f214

39
app.js
View file

@ -131,33 +131,6 @@ esmBot ${esmBotVersion} (${process.env.GIT_REV})
} }
if (process.env.API_TYPE === "ws") await reloadImageConnections(); if (process.env.API_TYPE === "ws") await reloadImageConnections();
// create the oceanic client
// const client = new Client({
// auth: `Bot ${process.env.TOKEN}`,
// allowedMentions: {
// everyone: false,
// roles: false,
// users: true,
// repliedUser: true
// },
// gateway: {
// concurrency: "auto",
// maxShards: "auto",
// shardIDs: process.env.SHARDS ? JSON.parse(process.env.SHARDS)[process.env.pm_id - 1] : null,
// presence: {
// status: "idle",
// activities: [{
// type: 0,
// name: "Starting esmBot..."
// }]
// },
// intents
// },
// collectionLimits: {
// messages: 50
// }
// });
const myUserId = process.env.MATRIX_USERNAME; const myUserId = process.env.MATRIX_USERNAME;
const myAccessToken = process.env.TOKEN; const myAccessToken = process.env.TOKEN;
const matrixClient = sdk.createClient({ const matrixClient = sdk.createClient({
@ -169,21 +142,11 @@ esmBot ${esmBotVersion} (${process.env.GIT_REV})
// register events // register events
logger.log("info", "Attempting to load events..."); logger.log("info", "Attempting to load events...");
// for await (const file of getFiles(resolve(dirname(fileURLToPath(import.meta.url)), "./events/"))) {
// logger.log("main", `Loading event from ${file}...`);
// const eventArray = file.split("/");
// const eventName = eventArray[eventArray.length - 1].split(".")[0];
// if (eventName === "interactionCreate" && !types.application) {
// logger.log("warn", `Skipped loading event from ${file} because application commands are disabled`);
// continue;
// }
// const { default: event } = await import(file);
// // client.on(eventName, event.bind(null, client));
// }
const { default: event } = await import("./events/roommessage.js"); const { default: event } = await import("./events/roommessage.js");
matrixClient.on("Room.timeline", event.bind(null,matrixClient)); matrixClient.on("Room.timeline", event.bind(null,matrixClient));
matrixClient.on("RoomMember.membership", function (event, member) { matrixClient.on("RoomMember.membership", function (event, member) {
try { try {
// TODO - add .env var that disables owner check here
let owners = process.env.OWNER.split(",") let owners = process.env.OWNER.split(",")
if (member.membership === "invite" && owners.includes(event.event.sender)) { if (member.membership === "invite" && owners.includes(event.event.sender)) {
matrixClient.joinRoom(member.roomId).then(function () { matrixClient.joinRoom(member.roomId).then(function () {