Convert team names to lower to be case-insensitive
This commit is contained in:
parent
385bd4c7bf
commit
36f03c2281
@ -3,10 +3,10 @@ package config
|
|||||||
var BotToken = "REDACTED"
|
var BotToken = "REDACTED"
|
||||||
|
|
||||||
var CustomTeamNames = map[string]string{
|
var CustomTeamNames = map[string]string{
|
||||||
"UGA": "Georgia",
|
"uga": "Georgia",
|
||||||
"Booger Eaters": "Auburn",
|
"booger eaters": "Auburn",
|
||||||
"Rape Enablers": "LSU",
|
"rape enablers": "LSU",
|
||||||
"Checkerboard Clowns": "Tennessee",
|
"checkerboard clowns": "Tennessee",
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfig() {
|
func LoadConfig() {
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
"discord-scores-bot/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Game struct {
|
type Game struct {
|
||||||
@ -36,8 +37,14 @@ type Team struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetGameInfo(teamName string) string {
|
func GetGameInfo(teamName string) string {
|
||||||
teamName = strings.TrimSpace(teamName)
|
teamName = strings.TrimSpace(strings.ToLower(teamName))
|
||||||
week := ""
|
week := ""
|
||||||
|
|
||||||
|
// Check if the teamName matches a custom name and replace if found
|
||||||
|
if customName, exists := config.CustomTeamNames[teamName]; exists {
|
||||||
|
log.Printf("Custom team name detected: %s -> %s", teamName, customName)
|
||||||
|
teamName = customName
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the last two characters of the input are integers for the week
|
// Check if the last two characters of the input are integers for the week
|
||||||
if len(teamName) >= 2 && unicode.IsDigit(rune(teamName[len(teamName)-1])) && unicode.IsDigit(rune(teamName[len(teamName)-2])) {
|
if len(teamName) >= 2 && unicode.IsDigit(rune(teamName[len(teamName)-1])) && unicode.IsDigit(rune(teamName[len(teamName)-2])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user