Always use OOYE bot to send thread start context

This commit is contained in:
Cadence Ember 2023-10-14 17:23:55 +13:00
parent d9d672bffd
commit 1016fb1d67
4 changed files with 5 additions and 2 deletions

View file

@ -40,7 +40,7 @@ async function sendMessage(message, guild) {
} }
for (const event of events) { for (const event of events) {
const eventType = event.$type const eventType = event.$type
if (event.$sender) senderMxid = event.$sender if ("$sender" in event) senderMxid = event.$sender
/** @type {Pick<typeof event, Exclude<keyof event, "$type" | "$sender">> & { $type?: string, $sender?: string }} */ /** @type {Pick<typeof event, Exclude<keyof event, "$type" | "$sender">> & { $type?: string, $sender?: string }} */
const eventWithoutType = {...event} const eventWithoutType = {...event}
delete eventWithoutType.$type delete eventWithoutType.$type

View file

@ -108,7 +108,8 @@ async function messageToEvent(message, guild, options = {}, di) {
const event = await di.api.getEvent(roomID, eventID) const event = await di.api.getEvent(roomID, eventID)
return [{ return [{
...event.content, ...event.content,
$type: event.type $type: event.type,
$sender: null
}] }]
} }

View file

@ -485,6 +485,7 @@ test("message2event: thread start message reference", async t => {
}) })
t.deepEqual(events, [{ t.deepEqual(events, [{
$type: "m.room.message", $type: "m.room.message",
$sender: null,
msgtype: "m.text", msgtype: "m.text",
body: "layer 4", body: "layer 4",
"m.mentions": {} "m.mentions": {}

View file

@ -36,6 +36,7 @@ function encodeEmoji(input, shortcode) {
const forceTrimmedList = [ const forceTrimmedList = [
"%F0%9F%91%8D", // 👍 "%F0%9F%91%8D", // 👍
"%F0%9F%91%8E", // 👎️
"%E2%AD%90", // ⭐ "%E2%AD%90", // ⭐
"%F0%9F%90%88", // 🐈 "%F0%9F%90%88", // 🐈
"%E2%9D%93", // ❓ "%E2%9D%93", // ❓