wow that took awhile
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/42wim/matterbridge/bridge/config"
|
||||
"github.com/42wim/matterbridge/bridge/helper"
|
||||
"github.com/42wim/matterbridge/bridge/jackbox"
|
||||
"github.com/lrstanley/girc"
|
||||
"github.com/paulrosania/go-charset/charset"
|
||||
"github.com/saintfish/chardet"
|
||||
@@ -251,6 +252,23 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
|
||||
rmsg.Text = string(output)
|
||||
}
|
||||
|
||||
// Check for votes (thisgame++ or thisgame--)
|
||||
// Only process votes from non-relayed messages
|
||||
if !jackbox.IsRelayedMessage(rmsg.Text) {
|
||||
if isVote, voteType := jackbox.DetectVote(rmsg.Text); isVote {
|
||||
b.Log.Debugf("Detected vote from %s: %s", event.Source.Name, voteType)
|
||||
if b.jackboxClient != nil {
|
||||
go func() {
|
||||
// Use current time as timestamp for IRC messages
|
||||
timestamp := time.Now()
|
||||
if err := b.jackboxClient.SendVote(event.Source.Name, voteType, timestamp); err != nil {
|
||||
b.Log.Errorf("Failed to send vote to Jackbox API: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Log.Debugf("<= Sending message from %s on %s to gateway", event.Params[0], b.Account)
|
||||
b.Remote <- rmsg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user