Added Default Dynamic Command Handlers & api calls

!countdown <duration>
!title <newTitle>
!game || !category
!uptime
This commit is contained in:
bryce
2025-07-08 16:12:36 +12:00
parent f16dc55ad8
commit bd8d2e404c
6 changed files with 281 additions and 11 deletions

24
internal/chat/uptime.go Normal file
View 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))
}