Spoiler Fix #90
1 changed files with 113 additions and 117 deletions
fix format
commit
cfafac2480
|
|
@ -1,10 +1,10 @@
|
|||
const { test } = require("supertape")
|
||||
const { messageToEvent } = require("./message-to-event")
|
||||
const { MatrixServerError } = require("../../matrix/mreq")
|
||||
const {test} = require("supertape")
|
||||
const {messageToEvent} = require("./message-to-event")
|
||||
const {MatrixServerError} = require("../../matrix/mreq")
|
||||
const data = require("../../../test/data")
|
||||
const { mockGetEffectivePower } = require("../../matrix/utils.test")
|
||||
const {mockGetEffectivePower} = require("../../matrix/utils.test")
|
||||
const Ty = require("../../types")
|
||||
const { db } = require("../../passthrough")
|
||||
const {db} = require("../../passthrough")
|
||||
|
||||
/**
|
||||
* @param {string} roomID
|
||||
|
|
@ -12,7 +12,7 @@ const { db } = require("../../passthrough")
|
|||
* @returns {(roomID: string, eventID: string) => Promise<Ty.Event.Outer<Ty.Event.M_Room_Message>>}
|
||||
*/
|
||||
function mockGetEvent(t, roomID_in, eventID_in, outer) {
|
||||
return async function (roomID, eventID) {
|
||||
return async function(roomID, eventID) {
|
||||
t.equal(roomID, roomID_in)
|
||||
t.equal(eventID, eventID_in)
|
||||
return new Promise(resolve => {
|
||||
|
|
@ -74,8 +74,8 @@ test("message2event: simple room mention", async t => {
|
|||
t.equal(roomID, "!BnKuBPCvyfOkhcUjEu:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -102,8 +102,8 @@ test("message2event: simple room link", async t => {
|
|||
t.equal(roomID, "!BnKuBPCvyfOkhcUjEu:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -130,8 +130,8 @@ test("message2event: nicked room mention", async t => {
|
|||
t.equal(roomID, "!kLRqKKUQXcibIMtOpl:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -214,12 +214,12 @@ test("message2event: timestamps", async t => {
|
|||
+ "\n3 October 2026 at 9:30 am (UTC)"
|
||||
+ "\n24 December 2026 at 11:00 pm (UTC)",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: `<a href="https://bridge.example.org/time/1791106413/S">4 Oct 2026, 9:33:33 am (UTC)</a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791106436/f">4 October 2026 at 9:33 am (UTC)</a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791106440/F">Sunday, 4 October 2026 at 9:34 am (UTC)</a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791106448/T">9:34:08 am (UTC)</a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791019800/R">3 October 2026 at 9:30 am (UTC)</a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1798153200/R">24 December 2026 at 11:00 pm (UTC)</a>`,
|
||||
formatted_body: `<a href="https://bridge.example.org/time/1791106413/S"><time data-style="S" datetime="2026-10-04T09:33:33.000Z">4 Oct 2026, 9:33:33 am (UTC)</time></a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791106436/f"><time data-style="f" datetime="2026-10-04T09:33:56.000Z">4 October 2026 at 9:33 am (UTC)</time></a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791106440/F"><time data-style="F" datetime="2026-10-04T09:34:00.000Z">Sunday, 4 October 2026 at 9:34 am (UTC)</time></a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791106448/T"><time data-style="T" datetime="2026-10-04T09:34:08.000Z">9:34:08 am (UTC)</time></a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1791019800/R"><time data-style="R" datetime="2026-10-03T09:30:00.000Z">3 October 2026 at 9:30 am (UTC)</time></a>`
|
||||
+ `<br><a href="https://bridge.example.org/time/1798153200/R"><time data-style="R" datetime="2026-12-24T23:00:00.000Z">24 December 2026 at 11:00 pm (UTC)</time></a>`,
|
||||
"m.mentions": {}
|
||||
}])
|
||||
})
|
||||
|
|
@ -234,8 +234,8 @@ test("message2event: simple message link", async t => {
|
|||
t.equal(roomID, "!kLRqKKUQXcibIMtOpl:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:super.invalid": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:super.invalid": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -270,8 +270,8 @@ test("message2event: message link that OOYE doesn't know about", async t => {
|
|||
t.equal(roomID, "!kLRqKKUQXcibIMtOpl:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -308,8 +308,8 @@ test("message2event: message timestamp failed to fetch", async t => {
|
|||
t.equal(roomID, "!kLRqKKUQXcibIMtOpl:cadence.moe")
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -505,7 +505,7 @@ test("message2event: simple reply to matrix user", async t => {
|
|||
})
|
||||
|
||||
test("message2event: simple reply to matrix user, reply fallbacks disabled", async t => {
|
||||
const events = await messageToEvent(data.message.simple_reply_to_matrix_user, data.guild.general, { includeReplyFallback: false }, {
|
||||
const events = await messageToEvent(data.message.simple_reply_to_matrix_user, data.guild.general, {includeReplyFallback: false}, {
|
||||
api: {
|
||||
getEvent: mockGetEvent(t, "!kLRqKKUQXcibIMtOpl:cadence.moe", "$Ij3qo7NxMA4VPexlAiIx2CB9JbsiGhJeyt-2OvkAUe4", {
|
||||
type: "m.room.message",
|
||||
|
|
@ -605,17 +605,17 @@ test("message2event: voice message", async t => {
|
|||
const events = await messageToEvent(data.message.voice_message)
|
||||
t.deepEqual(events, [{
|
||||
$type: "m.room.message",
|
||||
body: "voice-message.ogg",
|
||||
external_url: "https://bridge.example.org/download/discordcdn/1099031887500034088/1112476845502365786/voice-message.ogg",
|
||||
filename: "voice-message.ogg",
|
||||
info: {
|
||||
duration: 3960,
|
||||
mimetype: "audio/ogg",
|
||||
size: 10584,
|
||||
body: "voice-message.ogg",
|
||||
external_url: "https://bridge.example.org/download/discordcdn/1099031887500034088/1112476845502365786/voice-message.ogg",
|
||||
filename: "voice-message.ogg",
|
||||
info: {
|
||||
duration: 3960,
|
||||
mimetype: "audio/ogg",
|
||||
size: 10584,
|
||||
},
|
||||
"m.mentions": {},
|
||||
msgtype: "m.audio",
|
||||
url: "mxc://cadence.moe/MRRPDggXQMYkrUjTpxQbmcxB"
|
||||
"m.mentions": {},
|
||||
msgtype: "m.audio",
|
||||
url: "mxc://cadence.moe/MRRPDggXQMYkrUjTpxQbmcxB"
|
||||
}])
|
||||
})
|
||||
|
||||
|
|
@ -628,16 +628,16 @@ test("message2event: misc file", async t => {
|
|||
"m.mentions": {}
|
||||
}, {
|
||||
$type: "m.room.message",
|
||||
body: "the.yml",
|
||||
external_url: "https://bridge.example.org/download/discordcdn/122155380120748034/1174514575220158545/the.yml",
|
||||
filename: "the.yml",
|
||||
body: "the.yml",
|
||||
external_url: "https://bridge.example.org/download/discordcdn/122155380120748034/1174514575220158545/the.yml",
|
||||
filename: "the.yml",
|
||||
info: {
|
||||
mimetype: "text/plain; charset=utf-8",
|
||||
size: 2274
|
||||
},
|
||||
"m.mentions": {},
|
||||
msgtype: "m.file",
|
||||
url: "mxc://cadence.moe/HnQIYQmmlIKwOQsbFsIGpzPP"
|
||||
"m.mentions": {},
|
||||
msgtype: "m.file",
|
||||
url: "mxc://cadence.moe/HnQIYQmmlIKwOQsbFsIGpzPP"
|
||||
}])
|
||||
})
|
||||
|
||||
|
|
@ -674,7 +674,7 @@ test("message2event: simple reply in thread to a matrix user's reply", async t =
|
|||
user_ids: ["@cadence:cadence.moe"]
|
||||
},
|
||||
msgtype: "m.text",
|
||||
body: "Well, they don't seem to..."
|
||||
body: "Well, they don't seem to..."
|
||||
}])
|
||||
})
|
||||
|
||||
|
|
@ -711,7 +711,7 @@ test("message2event: infinidoge's reply to ami's matrix smalltext reply to infin
|
|||
user_ids: ["@ami:the-apothecary.club"]
|
||||
},
|
||||
msgtype: "m.text",
|
||||
body: `Most likely`
|
||||
body: `Most likely`
|
||||
}])
|
||||
})
|
||||
|
||||
|
|
@ -748,7 +748,7 @@ test("message2event: infinidoge's reply to ami's matrix smalltext singleline rep
|
|||
user_ids: ["@ami:the-apothecary.club"]
|
||||
},
|
||||
msgtype: "m.text",
|
||||
body: `Most likely`
|
||||
body: `Most likely`
|
||||
}])
|
||||
})
|
||||
|
||||
|
|
@ -757,11 +757,11 @@ test("message2event: reply to a Discord message that wasn't bridged", async t =>
|
|||
t.deepEqual(events, [{
|
||||
$type: "m.room.message",
|
||||
msgtype: "m.text",
|
||||
body: `> In reply to a 1-day-old unbridged message:`
|
||||
body: `> In reply to a 1-day-old unbridged message:`
|
||||
+ `\n> Occimyy: BILLY BOB THE GREAT`
|
||||
+ `\n\nenigmatic`,
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: `<blockquote>In reply to a 1-day-old unbridged message from Occimyy:<br>BILLY BOB THE GREAT</blockquote>enigmatic`,
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: `<blockquote>In reply to a 1-day-old unbridged message from Occimyy:<br>BILLY BOB THE GREAT</blockquote>enigmatic`,
|
||||
"m.mentions": {}
|
||||
}])
|
||||
})
|
||||
|
|
@ -1151,12 +1151,10 @@ test("message2event: very large png is converted to jpeg for upload", async t =>
|
|||
async fetch(url, init) {
|
||||
t.equal(url, "https://media.discordapp.net/attachments/1160894080998461480/1548656385292509274/855064e9-bdae-487a-a497-c662bd510487.png?format=jpeg")
|
||||
t.equal(init.method, "HEAD")
|
||||
return new Response("wa", {
|
||||
headers: {
|
||||
"Content-Type": "image/jpeg",
|
||||
"Content-Length": 483085
|
||||
}
|
||||
})
|
||||
return new Response("wa", {headers: {
|
||||
"Content-Type": "image/jpeg",
|
||||
"Content-Length": 483085
|
||||
}})
|
||||
}
|
||||
})
|
||||
t.deepEqual(events, [{
|
||||
|
|
@ -1334,7 +1332,7 @@ test("message2event: emoji triple long name", async t => {
|
|||
body: ":brillillillilliant_move::brillillillilliant_move::brillillillilliant_move:",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body:
|
||||
'<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
'<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
+ '<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
+ '<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
}])
|
||||
|
|
@ -1448,8 +1446,8 @@ test("message2event: constructed forwarded message", async t => {
|
|||
async getJoinedMembers() {
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1507,8 +1505,8 @@ test("message2event: constructed forwarded text", async t => {
|
|||
async getJoinedMembers() {
|
||||
return {
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@user:matrix.org": { display_name: null, avatar_url: null }
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
"@user:matrix.org": {display_name: null, avatar_url: null}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1552,10 +1550,10 @@ test("message2event: don't scan forwarded messages for mentions", async t => {
|
|||
})
|
||||
|
||||
test("message2event: invite no details embed if no event", async t => {
|
||||
const events = await messageToEvent({ content: "https://discord.gg/placeholder?event=1381190945646710824" }, {}, {}, {
|
||||
const events = await messageToEvent({content: "https://discord.gg/placeholder?event=1381190945646710824"}, {}, {}, {
|
||||
snow: {
|
||||
invite: {
|
||||
getInvite: async () => ({ ...data.invite.irl, guild_scheduled_event: null })
|
||||
getInvite: async () => ({...data.invite.irl, guild_scheduled_event: null})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -1572,7 +1570,7 @@ test("message2event: invite no details embed if no event", async t => {
|
|||
})
|
||||
|
||||
test("message2event: irl invite event renders embed", async t => {
|
||||
const events = await messageToEvent({ content: "https://discord.gg/placeholder?event=1381190945646710824" }, {}, {}, {
|
||||
const events = await messageToEvent({content: "https://discord.gg/placeholder?event=1381190945646710824"}, {}, {}, {
|
||||
snow: {
|
||||
invite: {
|
||||
getInvite: async () => data.invite.irl
|
||||
|
|
@ -1605,7 +1603,7 @@ test("message2event: irl invite event renders embed", async t => {
|
|||
})
|
||||
|
||||
test("message2event: vc invite event renders embed", async t => {
|
||||
const events = await messageToEvent({ content: "https://discord.gg/placeholder?event=1381174024801095751" }, {}, {}, {
|
||||
const events = await messageToEvent({content: "https://discord.gg/placeholder?event=1381174024801095751"}, {}, {}, {
|
||||
snow: {
|
||||
invite: {
|
||||
getInvite: async () => data.invite.vc
|
||||
|
|
@ -1639,12 +1637,12 @@ test("message2event: vc invite event renders embed", async t => {
|
|||
})
|
||||
|
||||
test("message2event: vc invite event renders embed with room link", async t => {
|
||||
const events = await messageToEvent({ content: "https://discord.gg/placeholder?event=1381174024801095751" }, {}, {}, {
|
||||
const events = await messageToEvent({content: "https://discord.gg/placeholder?event=1381174024801095751"}, {}, {}, {
|
||||
api: {
|
||||
getEffectivePower: mockGetEffectivePower(),
|
||||
getJoinedMembers: async () => ({
|
||||
joined: {
|
||||
"@_ooye_bot:cadence.moe": { display_name: null, avatar_url: null },
|
||||
"@_ooye_bot:cadence.moe": {display_name: null, avatar_url: null},
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -1681,7 +1679,7 @@ test("message2event: vc invite event renders embed with room link", async t => {
|
|||
})
|
||||
|
||||
test("message2event: expired/invalid invites are sent as-is", async t => {
|
||||
const events = await messageToEvent({ content: "https://discord.gg/placeholder?event=1381190945646710824" }, {}, {}, {
|
||||
const events = await messageToEvent({content: "https://discord.gg/placeholder?event=1381190945646710824"}, {}, {}, {
|
||||
snow: {
|
||||
invite: {
|
||||
async getInvite() {
|
||||
|
|
@ -1706,11 +1704,11 @@ test("message2event: channel links are converted even inside lists (parser post-
|
|||
let called = 0
|
||||
const events = await messageToEvent({
|
||||
content: "1. Don't be a dick"
|
||||
+ "\n2. Follow rule number 1"
|
||||
+ "\n3. Follow Discord TOS"
|
||||
+ "\n4. Do **not** post NSFW content, shock content, suggestive content"
|
||||
+ "\n5. Please keep <#176333891320283136> professional and helpful, no random off-topic joking"
|
||||
+ "\nThis list will probably change in the future"
|
||||
+ "\n2. Follow rule number 1"
|
||||
+ "\n3. Follow Discord TOS"
|
||||
+ "\n4. Do **not** post NSFW content, shock content, suggestive content"
|
||||
+ "\n5. Please keep <#176333891320283136> professional and helpful, no random off-topic joking"
|
||||
+ "\nThis list will probably change in the future"
|
||||
}, data.guild.general, {}, {
|
||||
api: {
|
||||
getEffectivePower: mockGetEffectivePower(),
|
||||
|
|
@ -1732,11 +1730,11 @@ test("message2event: channel links are converted even inside lists (parser post-
|
|||
{
|
||||
$type: "m.room.message",
|
||||
body: "1. Don't be a dick"
|
||||
+ "\n2. Follow rule number 1"
|
||||
+ "\n3. Follow Discord TOS"
|
||||
+ "\n4. Do **not** post NSFW content, shock content, suggestive content"
|
||||
+ "\n5. Please keep #wonderland professional and helpful, no random off-topic joking"
|
||||
+ "\nThis list will probably change in the future",
|
||||
+ "\n2. Follow rule number 1"
|
||||
+ "\n3. Follow Discord TOS"
|
||||
+ "\n4. Do **not** post NSFW content, shock content, suggestive content"
|
||||
+ "\n5. Please keep #wonderland professional and helpful, no random off-topic joking"
|
||||
+ "\nThis list will probably change in the future",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: "<ol start=\"1\"><li>Don't be a dick</li><li>Follow rule number 1</li><li>Follow Discord TOS</li><li>Do <strong>not</strong> post NSFW content, shock content, suggestive content</li><li>Please keep <a href=\"https://matrix.to/#/!qzDBLKlildpzrrOnFZ:cadence.moe?via=cadence.moe&via=federated.nexus\">#wonderland</a> professional and helpful, no random off-topic joking</li></ol>This list will probably change in the future",
|
||||
"m.mentions": {},
|
||||
|
|
@ -1785,33 +1783,31 @@ test("message2event: cross-room reply", async t => {
|
|||
}
|
||||
},
|
||||
content: "cross-room reply"
|
||||
}, {}, {}, {
|
||||
api: {
|
||||
async getEvent(roomID, eventID) {
|
||||
called++
|
||||
t.equal(roomID, "!mHmhQQPwXNananaOLD:cadence.moe")
|
||||
t.equal(eventID, "$pgzCQjq_y5sy8RvWOUuoF3obNHjs8iNvt9c-odrOCPY")
|
||||
return {
|
||||
type: "m.room.message",
|
||||
sender: "@cadence:cadence.moe",
|
||||
content: {
|
||||
"body": "image.png",
|
||||
"info": {
|
||||
"h": 738,
|
||||
"mimetype": "image/png",
|
||||
"org.matrix.msc4230.is_animated": false,
|
||||
"size": 111189,
|
||||
"w": 772,
|
||||
"xyz.amorgan.blurhash": "L255Oa~qRPD$-pxuoJoLIUM{xuxu"
|
||||
},
|
||||
"m.mentions": {},
|
||||
"msgtype": "m.image",
|
||||
"url": "mxc://matrix.org/QbSujQjRLekzPknKlPsXbGDS"
|
||||
}
|
||||
}, {}, {}, {api: {
|
||||
async getEvent(roomID, eventID) {
|
||||
called++
|
||||
t.equal(roomID, "!mHmhQQPwXNananaOLD:cadence.moe")
|
||||
t.equal(eventID, "$pgzCQjq_y5sy8RvWOUuoF3obNHjs8iNvt9c-odrOCPY")
|
||||
return {
|
||||
type: "m.room.message",
|
||||
sender: "@cadence:cadence.moe",
|
||||
content: {
|
||||
"body": "image.png",
|
||||
"info": {
|
||||
"h": 738,
|
||||
"mimetype": "image/png",
|
||||
"org.matrix.msc4230.is_animated": false,
|
||||
"size": 111189,
|
||||
"w": 772,
|
||||
"xyz.amorgan.blurhash": "L255Oa~qRPD$-pxuoJoLIUM{xuxu"
|
||||
},
|
||||
"m.mentions": {},
|
||||
"msgtype": "m.image",
|
||||
"url": "mxc://matrix.org/QbSujQjRLekzPknKlPsXbGDS"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}})
|
||||
t.deepEqual(events, [
|
||||
{
|
||||
$type: "m.room.message",
|
||||
|
|
@ -1915,15 +1911,15 @@ test("message2event: single-choice poll", async t => {
|
|||
kind: "org.matrix.msc3381.poll.disclosed", // Discord always lets you see results, so keeping this consistent with that.
|
||||
max_selections: 1,
|
||||
answers: [{
|
||||
id: "1",
|
||||
"org.matrix.msc1767.text": "[\ud83d\udc4d] answer one"
|
||||
}, {
|
||||
id: "2",
|
||||
"org.matrix.msc1767.text": "[\ud83d\udc4e] answer two"
|
||||
}, {
|
||||
id: "3",
|
||||
"org.matrix.msc1767.text": "answer three"
|
||||
}]
|
||||
id: "1",
|
||||
"org.matrix.msc1767.text": "[\ud83d\udc4d] answer one"
|
||||
}, {
|
||||
id: "2",
|
||||
"org.matrix.msc1767.text": "[\ud83d\udc4e] answer two"
|
||||
}, {
|
||||
id: "3",
|
||||
"org.matrix.msc1767.text": "answer three"
|
||||
}]
|
||||
},
|
||||
"org.matrix.msc1767.text": "only one answer allowed!\n1. [\ud83d\udc4d] answer one\n2. [\ud83d\udc4e] answer two\n3. answer three"
|
||||
}])
|
||||
|
|
@ -1942,15 +1938,15 @@ test("message2event: multiple-choice poll", async t => {
|
|||
kind: "org.matrix.msc3381.poll.disclosed", // Discord always lets you see results, so keeping this consistent with that.
|
||||
max_selections: 3,
|
||||
answers: [{
|
||||
id: "1",
|
||||
"org.matrix.msc1767.text": "[😭] no"
|
||||
}, {
|
||||
id: "2",
|
||||
"org.matrix.msc1767.text": "oh no"
|
||||
}, {
|
||||
id: "3",
|
||||
"org.matrix.msc1767.text": "oh noooooo"
|
||||
}]
|
||||
id: "1",
|
||||
"org.matrix.msc1767.text": "[😭] no"
|
||||
}, {
|
||||
id: "2",
|
||||
"org.matrix.msc1767.text": "oh no"
|
||||
}, {
|
||||
id: "3",
|
||||
"org.matrix.msc1767.text": "oh noooooo"
|
||||
}]
|
||||
},
|
||||
"org.matrix.msc1767.text": "more than one answer allowed\n1. [😭] no\n2. oh no\n3. oh noooooo"
|
||||
}])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue