Add sample message to Jeopardy logic

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2024-09-28 20:17:17 +02:00
parent e91af7c0f6
commit fc4409c1c9
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -151,6 +151,7 @@ func (w *WatBot) Msg(m *irc.Message) {
isBot, games := w.Bot(m) isBot, games := w.Bot(m)
if isBot { if isBot {
// Jeopardy // Jeopardy
// parses a message "Top finishers: (nick1: 1300) (nick2: 1200)" from an authorized Jeopardy game bot
if args[0] == "Top" && args[1] == "finishers:" && w.Allowed("jeopardy", games) { if args[0] == "Top" && args[1] == "finishers:" && w.Allowed("jeopardy", games) {
// hey, I avoided regex! // hey, I avoided regex!
finisherPrizes := strings.Split(strings.Replace(strings.Replace(strings.Replace(strings.Replace(strings.Join(args[2:], " "), ") (", ";", -1), ": ", ":", -1), "(", "", 1), ")", "", 1), ";") finisherPrizes := strings.Split(strings.Replace(strings.Replace(strings.Replace(strings.Replace(strings.Join(args[2:], " "), ") (", ";", -1), ": ", ":", -1), "(", "", 1), ")", "", 1), ";")