continue on stickers

This commit is contained in:
Cadence Ember 2023-05-15 17:25:05 +12:00
parent 63e5ae3e0e
commit ae640a8fde
5 changed files with 51 additions and 2 deletions

View File

@ -23,6 +23,12 @@ test("message2event: stickers", async t => {
},
}, {
$type: "m.sticker",
todo: "todo"
body: "pomu puff - damn that tiny lil bitch really chuffing. puffing that fat ass dart",
info: {
mimetype: "image/png"
// thumbnail_url
// thumbnail_info
},
url: "mxc://"
}])
})

Binary file not shown.

View File

@ -80,8 +80,24 @@ function emoji(emojiID, animated) {
else return base + ".png"
}
const stickerFormat = new Map([
[1, {label: "PNG", ext: "png", mime: "image/png"}],
[2, {label: "APNG", ext: "png", mime: "image/apng"}],
[3, {label: "LOTTIE", ext: "json", mime: "application/json"}],
[4, {label: "GIF", ext: "gif", mime: "image/gif"}]
])
function sticker(sticker) {
const format = stickerFormat.get(sticker.format_type)
if (!format) throw new Error(`No such format ${sticker.format_type} for sticker ${JSON.stringify(sticker)}`)
const ext = format.ext
return `/stickers/${sticker.id}.${ext}`
}
module.exports.guildIcon = guildIcon
module.exports.userAvatar = userAvatar
module.exports.memberAvatar = memberAvatar
module.exports.emoji = emoji
module.exports.stickerFormat = stickerFormat
module.exports.sticker = sticker
module.exports.uploadDiscordFileToMxc = uploadDiscordFileToMxc

View File

@ -60,6 +60,22 @@ The context-sensitive /invite command will invite Matrix users to the correspond
# d2m events
## Login - backfill
Need to backfill any messages that were missed while offline.
After logging in, check last_message_id on each channel and compare against database to see if anything has been missed. However, mustn't interpret old channels from before the bridge was created as being "new". So, something has been missed if:
- The last_message_id is not in the table of bridged messages
- The channel is already set up with a bridged room
- A message has been bridged in that channel before
(If either of the last two conditions is false, that means the channel predates the bridge and we haven't actually missed anything there.)
For channels that have missed messages, use the getChannelMessages function, and bridge each in turn.
Can use custom transaction ID (?) to send the original timestamps to Matrix. See appservice docs for details.
## Message sent
1. Transform content.

View File

@ -47,7 +47,18 @@ module.exports = {
general: {
owner_id: "112760500130975744",
premium_tier: 3,
stickers: [],
stickers: [{
version: 1683838696974,
type: 2,
tags: "sunglasses",
name: "pomu puff",
id: "1106323941183717586",
guild_id: "112760669178241024",
format_type: 1,
description: "damn that tiny lil bitch really chuffing. puffing that fat ass dart",
available: true,
asset: ""
}],
max_members: 500000,
splash: "86a34ed02524b972918bef810087f8e7",
explicit_content_filter: 0,