Move calls from getPublicUrlForMxc to getMedia

This commit is contained in:
Cadence Ember
2024-09-13 17:19:42 +12:00
parent b45d0f3038
commit c0d92ea66d
7 changed files with 64 additions and 52 deletions

View File

@@ -217,9 +217,8 @@ const commands = [{
} else {
// Upload it to Discord and have the bridge sync it back to Matrix again
for (const e of toUpload) {
const publicUrl = mxUtils.getPublicUrlForMxc(e.url)
// @ts-ignore
const resizeInput = await fetch(publicUrl, {agent: false}).then(res => res.arrayBuffer())
const resizeInput = await api.getMedia(e.url, {agent: false}).then(res => res.arrayBuffer())
const resizeOutput = await sharp(resizeInput)
.resize(EMOJI_SIZE, EMOJI_SIZE, {fit: "inside", withoutEnlargement: true, background: {r: 0, g: 0, b: 0, alpha: 0}})
.png()