support uk.half-shot.bridge
This commit is contained in:
		
							parent
							
								
									0caaa0940b
								
							
						
					
					
						commit
						0237d45c60
					
				
					 2 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
					@ -110,6 +110,23 @@ async function channelToKState(channel, guild) {
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"chat.schildi.hide_ui/read_receipts": {
 | 
							"chat.schildi.hide_ui/read_receipts": {
 | 
				
			||||||
			hidden: true
 | 
								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(roomID, "m.space.parent", spaceID, {})
 | 
				
			||||||
	await api.sendState(spaceID, "m.space.child", roomID, {})
 | 
						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
 | 
						// send a notification in the room
 | 
				
			||||||
	await api.sendEvent(roomID, "m.room.message", {
 | 
						await api.sendEvent(roomID, "m.room.message", {
 | 
				
			||||||
		msgtype: "m.notice",
 | 
							msgtype: "m.notice",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,6 +99,7 @@ function sticker(sticker) {
 | 
				
			||||||
	return `/stickers/${sticker.id}.${ext}`
 | 
						return `/stickers/${sticker.id}.${ext}`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports.DISCORD_IMAGES_BASE = DISCORD_IMAGES_BASE
 | 
				
			||||||
module.exports.guildIcon = guildIcon
 | 
					module.exports.guildIcon = guildIcon
 | 
				
			||||||
module.exports.userAvatar = userAvatar
 | 
					module.exports.userAvatar = userAvatar
 | 
				
			||||||
module.exports.memberAvatar = memberAvatar
 | 
					module.exports.memberAvatar = memberAvatar
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue