Files
IRC-kosmi-relay/bridge/jackbox/votes.go
2025-11-01 10:40:53 -04:00

30 lines
779 B
Go

package jackbox
import "strings"
// DetectVote checks if a message contains a vote and returns the vote type
// Returns (true, "up") for thisgame++
// Returns (true, "down") for thisgame--
// Returns (false, "") for non-vote messages
func DetectVote(text string) (isVote bool, voteType string) {
lower := strings.ToLower(text)
if strings.Contains(lower, "thisgame++") {
return true, "up"
}
if strings.Contains(lower, "thisgame--") {
return true, "down"
}
return false, ""
}
// IsRelayedMessage checks if a message is relayed from another chat
// Returns true if the message has [irc] or [kosmi] prefix
func IsRelayedMessage(text string) bool {
lower := strings.ToLower(text)
return strings.HasPrefix(lower, "[irc]") || strings.HasPrefix(lower, "[kosmi]")
}