Compare commits
2 commits
7905802825
...
5b7433de32
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b7433de32 | |||
| 7916f82b55 |
5 changed files with 3 additions and 14 deletions
|
|
@ -611,7 +611,7 @@ async function messageToEvent(message, guild, options = {}, di) {
|
||||||
const event = invite.guild_scheduled_event
|
const event = invite.guild_scheduled_event
|
||||||
if (!event) continue // the event ID provided was not valid
|
if (!event) continue // the event ID provided was not valid
|
||||||
|
|
||||||
const formatter = new Intl.DateTimeFormat("en-NZ", {month: "long", day: "numeric", hour: "numeric", minute: "2-digit", timeZoneName: "shortGeneric"}) // 9 June at 3:00 pm NZT
|
const formatter = new Intl.DateTimeFormat("en-NZ", {month: "long", day: "numeric", hour: "numeric", minute: "2-digit", timeZoneName: "shortGeneric", timeZone: reg.ooye.time_zone}) // 9 June at 3:00 pm NZT
|
||||||
const rep = new mxUtils.MatrixStringBuilder()
|
const rep = new mxUtils.MatrixStringBuilder()
|
||||||
|
|
||||||
// Add time
|
// Add time
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,10 @@ async function threadToAnnouncement(parentRoomID, threadRoomID, creatorMxid, thr
|
||||||
const template = creatorMxid ? "started a thread:" : "Thread started:"
|
const template = creatorMxid ? "started a thread:" : "Thread started:"
|
||||||
const via = await mxUtils.getViaServersQuery(threadRoomID, di.api)
|
const via = await mxUtils.getViaServersQuery(threadRoomID, di.api)
|
||||||
let body = `${template} ${thread.name} https://matrix.to/#/${threadRoomID}?${via.toString()}`
|
let body = `${template} ${thread.name} https://matrix.to/#/${threadRoomID}?${via.toString()}`
|
||||||
let html = `${template} <a href="https://matrix.to/#/${threadRoomID}?${via.toString()}">${thread.name}</a>`
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
msgtype,
|
msgtype,
|
||||||
body,
|
body,
|
||||||
format: "org.matrix.custom.html",
|
|
||||||
formatted_body: html,
|
|
||||||
"m.mentions": {},
|
"m.mentions": {},
|
||||||
...context
|
...context
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,6 @@ test("thread2announcement: no known creator, no branched from event", async t =>
|
||||||
t.deepEqual(content, {
|
t.deepEqual(content, {
|
||||||
msgtype: "m.text",
|
msgtype: "m.text",
|
||||||
body: "Thread started: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
body: "Thread started: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||||
format: "org.matrix.custom.html",
|
|
||||||
formatted_body: `Thread started: <a href="https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org">test thread</a>`,
|
|
||||||
"m.mentions": {}
|
"m.mentions": {}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -69,8 +67,6 @@ test("thread2announcement: known creator, no branched from event", async t => {
|
||||||
t.deepEqual(content, {
|
t.deepEqual(content, {
|
||||||
msgtype: "m.emote",
|
msgtype: "m.emote",
|
||||||
body: "started a thread: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
body: "started a thread: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||||
format: "org.matrix.custom.html",
|
|
||||||
formatted_body: `started a thread: <a href="https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org">test thread</a>`,
|
|
||||||
"m.mentions": {}
|
"m.mentions": {}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -95,8 +91,6 @@ test("thread2announcement: no known creator, branched from discord event", async
|
||||||
t.deepEqual(content, {
|
t.deepEqual(content, {
|
||||||
msgtype: "m.text",
|
msgtype: "m.text",
|
||||||
body: "Thread started: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
body: "Thread started: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||||
format: "org.matrix.custom.html",
|
|
||||||
formatted_body: `Thread started: <a href="https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org">test thread</a>`,
|
|
||||||
"m.mentions": {},
|
"m.mentions": {},
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
"m.in_reply_to": {
|
"m.in_reply_to": {
|
||||||
|
|
@ -126,8 +120,6 @@ test("thread2announcement: known creator, branched from discord event", async t
|
||||||
t.deepEqual(content, {
|
t.deepEqual(content, {
|
||||||
msgtype: "m.emote",
|
msgtype: "m.emote",
|
||||||
body: "started a thread: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
body: "started a thread: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||||
format: "org.matrix.custom.html",
|
|
||||||
formatted_body: `started a thread: <a href="https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org">test thread</a>`,
|
|
||||||
"m.mentions": {},
|
"m.mentions": {},
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
"m.in_reply_to": {
|
"m.in_reply_to": {
|
||||||
|
|
@ -157,8 +149,6 @@ test("thread2announcement: no known creator, branched from matrix event", async
|
||||||
t.deepEqual(content, {
|
t.deepEqual(content, {
|
||||||
msgtype: "m.text",
|
msgtype: "m.text",
|
||||||
body: "Thread started: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
body: "Thread started: test thread https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org",
|
||||||
format: "org.matrix.custom.html",
|
|
||||||
formatted_body: `Thread started: <a href="https://matrix.to/#/!thread?via=cadence.moe&via=matrix.org">test thread</a>`,
|
|
||||||
"m.mentions": {
|
"m.mentions": {
|
||||||
user_ids: ["@cadence:cadence.moe"]
|
user_ids: ["@cadence:cadence.moe"]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
1
src/types.d.ts
vendored
1
src/types.d.ts
vendored
|
|
@ -31,6 +31,7 @@ export type AppServiceRegistrationConfig = {
|
||||||
discord_origin?: string
|
discord_origin?: string
|
||||||
discord_cdn_origin?: string,
|
discord_cdn_origin?: string,
|
||||||
web_password: string
|
web_password: string
|
||||||
|
time_zone?: string
|
||||||
}
|
}
|
||||||
old_bridge?: {
|
old_bridge?: {
|
||||||
as_token: string
|
as_token: string
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ reg.namespaces = {
|
||||||
aliases: [{regex: "#_ooye_.*:cadence.moe", exclusive: true}]
|
aliases: [{regex: "#_ooye_.*:cadence.moe", exclusive: true}]
|
||||||
}
|
}
|
||||||
reg.ooye.bridge_origin = "https://bridge.example.org"
|
reg.ooye.bridge_origin = "https://bridge.example.org"
|
||||||
|
reg.ooye.time_zone = "Pacific/Auckland"
|
||||||
|
|
||||||
const sync = new HeatSync({watchFS: false})
|
const sync = new HeatSync({watchFS: false})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue