Files
bryce bd8d2e404c Added Default Dynamic Command Handlers & api calls
!countdown <duration>
!title <newTitle>
!game || !category
!uptime
2025-07-08 16:12:36 +12:00

25 lines
663 B
Go

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))
}