fluffychat emoji
This commit is contained in:
parent
90d41eb115
commit
5094aec113
14
bot/bot.go
14
bot/bot.go
|
@ -142,22 +142,24 @@ func (m *Bot) ReactionHandler() (event.Type, mautrix.EventHandler) {
|
||||||
relID := rel.GetAnnotationID()
|
relID := rel.GetAnnotationID()
|
||||||
relKey := rel.GetAnnotationKey()
|
relKey := rel.GetAnnotationKey()
|
||||||
m.logger.Info("received reaction", slog.String("event_id", eventID.String()), slog.String("rel_id", relID.String()), slog.String("rel_key", relKey))
|
m.logger.Info("received reaction", slog.String("event_id", eventID.String()), slog.String("rel_id", relID.String()), slog.String("rel_key", relKey))
|
||||||
if relKey != `🗒️` {
|
if relKey != `🗒️` && relKey != `🗒` { // different clients have different emoji
|
||||||
m.logger.Info("reaction is not 🗒️, ignoring", slog.String("event_id", eventID.String()))
|
m.logger.Info("reaction is not 🗒️ or 🗒, ignoring", slog.String("event_id", eventID.String()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
wantedURL, ok := m.messages[relID.String()]
|
wantedURL, ok := m.messages[relID.String()]
|
||||||
|
var summary string
|
||||||
if !ok {
|
if !ok {
|
||||||
|
summary = "could not find referenced message in ternal storage, or referenced message does not contain url"
|
||||||
m.logger.Info("referenced message is not known or does not contain url, ignoring", slog.String("event_id", eventID.String()))
|
m.logger.Info("referenced message is not known or does not contain url, ignoring", slog.String("event_id", eventID.String()))
|
||||||
return
|
} else {
|
||||||
}
|
var err error
|
||||||
|
summary, err = m.kagiCient.Summarize(wantedURL)
|
||||||
summary, err := m.kagiCient.Summarize(wantedURL)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.logger.Error("failed to summarize", slog.String("err", err.Error()))
|
m.logger.Error("failed to summarize", slog.String("err", err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reply := summary
|
reply := summary
|
||||||
formattedReply := format.RenderMarkdown(reply, true, false)
|
formattedReply := format.RenderMarkdown(reply, true, false)
|
||||||
|
|
4
main.go
4
main.go
|
@ -32,13 +32,13 @@ func main() {
|
||||||
|
|
||||||
go ks.Run()
|
go ks.Run()
|
||||||
defer ks.Close()
|
defer ks.Close()
|
||||||
logger.Info("matrix ks started")
|
logger.Info("matrix kagisum started")
|
||||||
|
|
||||||
done := make(chan os.Signal)
|
done := make(chan os.Signal)
|
||||||
signal.Notify(done, os.Interrupt)
|
signal.Notify(done, os.Interrupt)
|
||||||
<-done
|
<-done
|
||||||
|
|
||||||
logger.Info("matrix ks stopped")
|
logger.Info("matrix kagisum stopped")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue