Compare commits
2 commits
97ab77a060
...
7712bc34a6
Author | SHA1 | Date | |
---|---|---|---|
7712bc34a6 | |||
587267250d |
3 changed files with 35 additions and 4 deletions
|
@ -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 = {}
|
||||
|
|
|
@ -27,3 +27,31 @@ test("event2message: janky test", t => {
|
|||
}]
|
||||
)
|
||||
})
|
||||
|
||||
test("event2message: long messages are split", t => {
|
||||
t.deepEqual(
|
||||
eventToMessage({
|
||||
content: {
|
||||
body: ("a".repeat(130) + " ").repeat(19),
|
||||
msgtype: "m.text"
|
||||
},
|
||||
event_id: "$g07oYSZFWBkxohNEfywldwgcWj1hbhDzQ1sBAKvqOOU",
|
||||
origin_server_ts: 1688301929913,
|
||||
room_id: "!kLRqKKUQXcibIMtOpl:cadence.moe",
|
||||
sender: "@cadence:cadence.moe",
|
||||
type: "m.room.message",
|
||||
unsigned: {
|
||||
age: 405299
|
||||
}
|
||||
}),
|
||||
[{
|
||||
username: "cadence",
|
||||
content: (("a".repeat(130) + " ").repeat(15)).slice(0, -1),
|
||||
avatar_url: undefined
|
||||
}, {
|
||||
username: "cadence",
|
||||
content: (("a".repeat(130) + " ").repeat(4)).slice(0, -1),
|
||||
avatar_url: undefined
|
||||
}]
|
||||
)
|
||||
})
|
||||
|
|
|
@ -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
|
||||
assert(reg.ooye.max_file_size)
|
||||
assert(reg.ooye.namespace_prefix)
|
||||
assert(reg.ooye.server_name)
|
||||
module.exports = reg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue