add osrs wiki command

This commit is contained in:
lyx0 2021-10-26 17:37:45 +02:00
parent 3196c22348
commit ef47f45e6e
2 changed files with 22 additions and 0 deletions

14
pkg/commands/osrs.go Normal file
View file

@ -0,0 +1,14 @@
package commands
import (
"fmt"
"net/url"
"github.com/lyx0/nourybot/cmd/bot"
)
func Osrs(target, term string, nb *bot.Bot) {
reply := fmt.Sprint("https://oldschool.runescape.wiki/?search=" + url.QueryEscape(term))
nb.Send(target, reply)
}

View file

@ -218,6 +218,14 @@ func Command(message twitch.PrivateMessage, nb *bot.Bot) {
} else { } else {
commands.Number(target, cmdParams[1], nb) commands.Number(target, cmdParams[1], nb)
} }
case "osrs":
if msgLen == 1 {
nb.Send(target, "Usage: ()osrs [term]")
return
} else {
commands.Osrs(target, message.Message[7:len(message.Message)], nb)
return
}
case "ping": case "ping":
commands.Ping(target, nb) commands.Ping(target, nb)