reaction moved to its own function

This commit is contained in:
array-in-a-matrix 2023-10-29 15:56:00 -04:00
parent a1f2ac3a39
commit c15c5b365c

View file

@ -74,6 +74,16 @@ const addCount = async (roomId, message) => {
}
};
const addReaction = async (roomId, message) => {
client.sendEvent(roomId, "m.reaction", {
"m.relates_to": {
"event_id":message["event_id"],
"key":String(data.count[message["sender"]]),
"rel_type": "m.annotation"
}
})
}
AutojoinRoomsMixin.setupOnClient(client);
client.start().then(() => {
clearTimeout(error1);
@ -94,14 +104,7 @@ client.on("room.message", (roomId, event) => {
}
if (event["content"]["body"].match(/l*.i.*n.*u.*x/gi)){
addCount(roomId, event);
//? broken mess i will fix after i eat i think
// client.sendEvent(roomId, "m.reaction" ({
// "m.relates_to": {
// "event_id":event["event_id"],
// "key":data.count[message["sender"]],
// "rel_type": "m.annotation"
// }
// }))
addReaction(roomId, event);
}
})