wow that took awhile
This commit is contained in:
29
bridge/jackbox/votes.go
Normal file
29
bridge/jackbox/votes.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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]")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user