forked from cadence/out-of-your-element
show member details on discord from cache
This commit is contained in:
parent
0ea2b4efc9
commit
3ebfa8e3a7
4 changed files with 68 additions and 25 deletions
|
@ -19,4 +19,15 @@ function eventSenderIsFromDiscord(sender) {
|
|||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} mxc
|
||||
* @returns {string?}
|
||||
*/
|
||||
function getPublicUrlForMxc(mxc) {
|
||||
const avatarURLParts = mxc?.match(/^mxc:\/\/([^/]+)\/(\w+)$/)
|
||||
if (avatarURLParts) return `https://matrix.cadence.moe/_matrix/media/r0/download/${avatarURLParts[1]}/${avatarURLParts[2]}`
|
||||
else return null
|
||||
}
|
||||
|
||||
module.exports.eventSenderIsFromDiscord = eventSenderIsFromDiscord
|
||||
module.exports.getPublicUrlForMxc = getPublicUrlForMxc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue