Add ticker symbol voting (e.g. QPL3++, TMP2--)
Extend vote detection to recognize game ticker symbols alongside the existing thisgame++/-- syntax. Each symbol maps to a specific game so users can vote for any game by its stock-style ticker. The matched ticker is sent to the API via a new optional `ticker` field in the vote request. Made-with: Cursor
This commit is contained in:
@@ -204,14 +204,14 @@ func (b *Bkosmi) handleIncomingMessage(payload *NewMessagePayload) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check for votes (thisgame++ or thisgame--)
|
||||
// Check for votes (thisgame++/-- or ticker symbol++/--)
|
||||
// Only process votes from non-relayed messages
|
||||
if !jackbox.IsRelayedMessage(body) {
|
||||
if isVote, voteType := jackbox.DetectVote(body); isVote {
|
||||
b.Log.Debugf("Detected vote from %s: %s", username, voteType)
|
||||
if isVote, voteType, ticker := jackbox.DetectVote(body); isVote {
|
||||
b.Log.Debugf("Detected vote from %s: %s (ticker=%q)", username, voteType, ticker)
|
||||
if b.jackboxClient != nil {
|
||||
go func() {
|
||||
if err := b.jackboxClient.SendVote(username, voteType, timestamp); err != nil {
|
||||
if err := b.jackboxClient.SendVote(username, voteType, timestamp, ticker); err != nil {
|
||||
b.Log.Errorf("Failed to send vote to Jackbox API: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user