Initial commit
This commit is contained in:
27
internal/poster/tracker.go
Normal file
27
internal/poster/tracker.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package poster
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"pete/internal/storage"
|
||||
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
|
||||
// HandleReaction processes a reaction event by mapping it back to the story GUID.
|
||||
func HandleReaction(roomID id.RoomID, eventID id.EventID, targetEventID id.EventID, emoji string, userID id.UserID) {
|
||||
guid, channel, found := storage.LookupPostGUID(string(targetEventID))
|
||||
if !found {
|
||||
// Reaction on a message we didn't post — ignore
|
||||
return
|
||||
}
|
||||
|
||||
storage.InsertReaction(guid, channel, string(eventID), emoji, string(userID), time.Now().Unix())
|
||||
slog.Debug("reaction recorded",
|
||||
"guid", guid,
|
||||
"channel", channel,
|
||||
"emoji", emoji,
|
||||
"user", userID,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user