see how this different reactions format goes...
This commit is contained in:
parent
0fc8e68f15
commit
3f187e8107
3 changed files with 6 additions and 7 deletions
|
@ -22,7 +22,7 @@ async function addReaction(data) {
|
|||
assert.equal(typeof parentID, "string")
|
||||
const roomID = await createRoom.ensureRoom(data.channel_id)
|
||||
const senderMxid = await registerUser.ensureSimJoined(user, roomID)
|
||||
const eventID = api.sendEvent(roomID, "m.reaction", {
|
||||
const eventID = await api.sendEvent(roomID, "m.reaction", {
|
||||
"m.relates_to": {
|
||||
rel_type: "m.annotation",
|
||||
event_id: parentID,
|
||||
|
|
|
@ -12,10 +12,7 @@ const api = sync.require("../../matrix/api")
|
|||
* @param {import("discord-api-types/v10").APIGuild} guild
|
||||
*/
|
||||
async function editMessage(message, guild) {
|
||||
console.log(`*** applying edit for message ${message.id} in channel ${message.channel_id}`)
|
||||
const {roomID, eventsToRedact, eventsToReplace, eventsToSend, senderMxid} = await editToChanges.editToChanges(message, guild, api)
|
||||
console.log("making these changes:")
|
||||
console.dir({eventsToRedact, eventsToReplace, eventsToSend}, {depth: null})
|
||||
|
||||
// 1. Replace all the things.
|
||||
for (const {oldID, newContent} of eventsToReplace) {
|
||||
|
|
|
@ -18,10 +18,12 @@ async function addReaction(event) {
|
|||
// no need to sync the matrix member to the other side. but if I did need to, this is where I'd do it
|
||||
|
||||
let emoji = event.content["m.relates_to"].key // TODO: handle custom text or emoji reactions
|
||||
emoji = encodeURIComponent(emoji)
|
||||
emoji = emoji.replace(/%EF%B8%8F/g, "")
|
||||
let encoded = encodeURIComponent(emoji)
|
||||
let encodedTrimmed = encoded.replace(/%EF%B8%8F/g, "")
|
||||
|
||||
return discord.snow.channel.createReaction(channelID, messageID, emoji)
|
||||
console.log("add reaction from matrix:", emoji, encoded, encodedTrimmed)
|
||||
|
||||
return discord.snow.channel.createReaction(channelID, messageID, encoded)
|
||||
}
|
||||
|
||||
module.exports.addReaction = addReaction
|
||||
|
|
Loading…
Reference in a new issue