Initial commit

This commit is contained in:
eleksir
2025-05-08 18:12:52 +03:00
commit cff1b6811f
1596 changed files with 659567 additions and 0 deletions

68
internal/moon/reaction.go Normal file
View File

@@ -0,0 +1,68 @@
package moon
import (
"fmt"
"github.com/NicoNex/echotron/v3"
)
func reaction(msg *echotron.Update) {
AddChat(&msg.MessageReaction.Chat)
AddUser(&msg.MessageReaction.User)
if Cfg.LogChats {
var reactionString string
for _, item := range msg.MessageReaction.NewReaction {
switch item.Type {
case "Emoji":
reactionString += item.Emoji
case "CustomEmoji":
reactionString += item.CustomEmoji
}
}
if reactionString != "" {
ChatLog(
msg.MessageReaction.Chat.ID,
fmt.Sprintf(
"User %s %s (username = %s, id = %d) set reaction %s to chat %s %s (%d)",
msg.MessageReaction.User.FirstName,
msg.MessageReaction.User.LastName,
msg.MessageReaction.User.Username,
msg.MessageReaction.User.ID,
reactionString,
msg.MessageReaction.Chat.Type,
msg.MessageReaction.Chat.Title,
msg.MessageReaction.Chat.ID,
),
)
} else {
for _, item := range msg.MessageReaction.OldReaction {
switch item.Type {
case "Emoji":
reactionString += item.Emoji
case "CustomEmoji":
reactionString += item.CustomEmoji
}
}
ChatLog(
msg.MessageReaction.Chat.ID,
fmt.Sprintf(
"User %s %s (username = %s, id = %d) removed reaction %s to chat %s %s (%d)",
msg.MessageReaction.User.FirstName,
msg.MessageReaction.User.LastName,
msg.MessageReaction.User.Username,
msg.MessageReaction.User.ID,
reactionString,
msg.MessageReaction.Chat.Type,
msg.MessageReaction.Chat.Title,
msg.MessageReaction.Chat.ID,
),
)
}
}
}
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */