mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 20:01:17 +00:00
Transform broadcaster name into ID
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
2b67673e95
commit
c59ef05faa
1 changed files with 6 additions and 1 deletions
|
@ -285,11 +285,16 @@ func (c Client) GetRecentStreamInfo(username string) (string, string, error) {
|
||||||
return payload.Data[0].GameName, payload.Data[0].Title, nil
|
return payload.Data[0].GameName, payload.Data[0].Title, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) ModifyChannelInformation(ctx context.Context, broadcaster string, game, title *string) error {
|
func (c Client) ModifyChannelInformation(ctx context.Context, broadcasterName string, game, title *string) error {
|
||||||
if game == nil && title == nil {
|
if game == nil && title == nil {
|
||||||
return errors.New("netiher game nor title provided")
|
return errors.New("netiher game nor title provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
broadcaster, err := c.GetIDForUsername(broadcasterName)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "getting ID for broadcaster name")
|
||||||
|
}
|
||||||
|
|
||||||
data := struct {
|
data := struct {
|
||||||
GameID *string `json:"game_id,omitempty"`
|
GameID *string `json:"game_id,omitempty"`
|
||||||
Title *string `json:"title,omitempty"`
|
Title *string `json:"title,omitempty"`
|
||||||
|
|
Loading…
Reference in a new issue