From f0ff89161a7fc4da2e4a31b63ac3ceae8acb5008 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 24 Aug 2023 00:27:51 +1200 Subject: [PATCH] syncing all room power levels --- d2m/actions/create-room.js | 5 ++--- matrix/read-registration.js | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/d2m/actions/create-room.js b/d2m/actions/create-room.js index 29bcdc06..b641d375 100644 --- a/d2m/actions/create-room.js +++ b/d2m/actions/create-room.js @@ -63,9 +63,8 @@ async function channelToKState(channel, guild) { assert.ok(typeof spaceID === "string") const row = db.prepare("SELECT nick, custom_avatar FROM channel_room WHERE channel_id = ?").get(channel.id) - assert(row) - const customName = row.nick - const customAvatar = row.custom_avatar + const customName = row?.nick + const customAvatar = row?.custom_avatar const [convertedName, convertedTopic] = convertNameAndTopic(channel, guild, customName) const avatarEventContent = {} diff --git a/matrix/read-registration.js b/matrix/read-registration.js index a1d920d8..54d77ae6 100644 --- a/matrix/read-registration.js +++ b/matrix/read-registration.js @@ -1,8 +1,12 @@ // @ts-check const fs = require("fs") +const assert = require("assert").strict const yaml = require("js-yaml") /** @ts-ignore @type {import("../types").AppServiceRegistrationConfig} */ const reg = yaml.load(fs.readFileSync("registration.yaml", "utf8")) -module.exports = reg \ No newline at end of file +assert(reg.ooye.max_file_size) +assert(reg.ooye.namespace_prefix) +assert(reg.ooye.server_name) +module.exports = reg