mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-11 04:33:02 +02:00
Resolve Matrix room aliases to Discord channels
This commit is contained in:
parent
6e55061760
commit
ad1aa2c0f6
4 changed files with 155 additions and 2 deletions
|
@ -367,6 +367,16 @@ async function ackEvent(event, mxid) {
|
|||
await sendReadReceipt(event.room_id, event.event_id, mxid)
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a room alias to a room ID.
|
||||
* @param {string} alias
|
||||
*/
|
||||
async function getAlias(alias) {
|
||||
/** @type {Ty.R.ResolvedRoom} */
|
||||
const root = await mreq.mreq("GET", `/client/v3/directory/room/${encodeURIComponent(alias)}`)
|
||||
return root.room_id
|
||||
}
|
||||
|
||||
module.exports.path = path
|
||||
module.exports.register = register
|
||||
module.exports.createRoom = createRoom
|
||||
|
@ -395,3 +405,4 @@ module.exports.ping = ping
|
|||
module.exports.getMedia = getMedia
|
||||
module.exports.sendReadReceipt = sendReadReceipt
|
||||
module.exports.ackEvent = ackEvent
|
||||
module.exports.getAlias = getAlias
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue