Added Default Dynamic Command Handlers & api calls
!countdown <duration> !title <newTitle> !game || !category !uptime
This commit is contained in:
24
internal/chat/uptime.go
Normal file
24
internal/chat/uptime.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
twitch "github.com/gempir/go-twitch-irc/v4"
|
||||
twitchapi "streambot_twitch/internal/twitchapi"
|
||||
)
|
||||
|
||||
func HandleUptimeCommand(client *twitch.Client, apiClient *twitchapi.Client, message twitch.PrivateMessage, user twitch.User, channel string) {
|
||||
msg := strings.ToLower(message.Message)
|
||||
if !strings.HasPrefix(msg, "!uptime") {
|
||||
return
|
||||
}
|
||||
|
||||
uptime, err := apiClient.GetStreamUptime(channel)
|
||||
if err != nil {
|
||||
client.Say(channel, fmt.Sprintf("@%s Stream is currently offline or error occoured.", user.DisplayName))
|
||||
return
|
||||
}
|
||||
|
||||
client.Say(channel, fmt.Sprintf("@%s Stream has been live for %s", user.DisplayName, uptime))
|
||||
}
|
Reference in New Issue
Block a user