Started REPL env for custom interactive shell
ONLY active when bot is running - Arguments [--watch] displays how many usses of each trigger and how many uses over the lifetime ofthe bot Commands - title [get/set] <newTitle> - category [get/set] <newCategory> - MUST be a legit Twitch.tv one - yet to come [cmd add|del|edit] [trigger] [response] (NOTE if you want Emotes you will have to type the 'name' in for twitch chat to recognise it)
This commit is contained in:
@@ -118,25 +118,25 @@ func (c *Client) GetStreamCategory(channel string) (string, error) {
|
||||
return resp.Data.Channels[0].GameName, nil
|
||||
}
|
||||
|
||||
func setStreamCategory(client *helix.Client, channel, newCategory string) error {
|
||||
userID, err := GetUserID(client, channel)
|
||||
func (c *Client) SetStreamCategory(channel, newCategory string) error {
|
||||
userID, err := c.GetUserID(channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// get Twitch GameID by Name from API
|
||||
gameID, err := getGameIDByName(client, newCategory)
|
||||
gameID, err := c.GetGameIDByName(newCategory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = client.EditChannelInformation(&helix.EditChannelInformationParams{
|
||||
_, err = c.api.EditChannelInformation(&helix.EditChannelInformationParams{
|
||||
BroadcasterID: userID,
|
||||
GameID: gameID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func getGameIDByName(client *helix.Client, name string) (string, error) {
|
||||
resp, err := GetGames(&helix.GamesParams{
|
||||
func (c *Client) GetGameIDByName(name string) (string, error) {
|
||||
resp, err := c.api.GetGames(&helix.GamesParams{
|
||||
Names: []string{name},
|
||||
})
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user