support uk.half-shot.bridge

This commit is contained in:
Cadence Ember 2023-09-07 12:07:56 +12:00
parent 0caaa0940b
commit 0237d45c60
2 changed files with 21 additions and 0 deletions

View file

@ -110,6 +110,23 @@ async function channelToKState(channel, guild) {
},
"chat.schildi.hide_ui/read_receipts": {
hidden: true
},
[`uk.half-shot.bridge/moe.cadence.ooye://discord/${guild.id}/${channel.id}`]: {
bridgebot: `@${reg.sender_localpart}:${reg.ooye.server_name}`,
protocol: {
id: "discord",
displayname: "Discord"
},
network: {
id: guild.id,
displayname: guild.name,
avatar_url: file.DISCORD_IMAGES_BASE + file.guildIcon(guild)
},
channel: {
id: channel.id,
displayname: channel.name,
external_url: `https://discord.com/channels/${guild.id}/${channel.id}`
}
}
}
@ -295,6 +312,9 @@ async function _unbridgeRoom(channelID) {
await api.sendState(roomID, "m.space.parent", spaceID, {})
await api.sendState(spaceID, "m.space.child", roomID, {})
// remove declaration that the room is bridged
await api.sendState(roomID, "uk.half-shot.bridge", `moe.cadence.ooye://discord/${channel.guild_id}/${channel.id}`, {})
// send a notification in the room
await api.sendEvent(roomID, "m.room.message", {
msgtype: "m.notice",

View file

@ -99,6 +99,7 @@ function sticker(sticker) {
return `/stickers/${sticker.id}.${ext}`
}
module.exports.DISCORD_IMAGES_BASE = DISCORD_IMAGES_BASE
module.exports.guildIcon = guildIcon
module.exports.userAvatar = userAvatar
module.exports.memberAvatar = memberAvatar