mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add godocs command
This commit is contained in:
parent
737a9f6259
commit
3228176caf
2 changed files with 25 additions and 0 deletions
13
pkg/commands/godocs.go
Normal file
13
pkg/commands/godocs.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v2"
|
||||
)
|
||||
|
||||
func Godocs(channel string, searchTerm string, client *twitch.Client) {
|
||||
resp := fmt.Sprintf("https://godocs.io/?q=%s", searchTerm)
|
||||
|
||||
client.Say(channel, resp)
|
||||
}
|
|
@ -82,6 +82,18 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u
|
|||
commands.Uptime(message.Channel, cmdParams[1], twitchClient)
|
||||
return
|
||||
}
|
||||
case "godoc":
|
||||
if msgLen == 1 {
|
||||
twitchClient.Say(message.Channel, "Usage: ()godoc [term]")
|
||||
} else {
|
||||
commands.Godocs(message.Channel, message.Message[8:len(message.Message)], twitchClient)
|
||||
}
|
||||
case "godocs":
|
||||
if msgLen == 1 {
|
||||
twitchClient.Say(message.Channel, "Usage: ()godoc [term]")
|
||||
} else {
|
||||
commands.Godocs(message.Channel, message.Message[9:len(message.Message)], twitchClient)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue