generated from array-in-a-matrix/matrix-bot-template
reaction moved to its own function
This commit is contained in:
parent
a1f2ac3a39
commit
c15c5b365c
19
index.js
19
index.js
|
@ -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);
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue