From 20356abe231daf45b6c4cda90f175c131c0a2a3c Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 1 Oct 2022 15:05:21 +0200 Subject: [PATCH] [core] Allow to pass ID to channel modification Signed-off-by: Knut Ahlers --- internal/actors/modchannel/actor.go | 2 +- pkg/twitch/twitch.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/actors/modchannel/actor.go b/internal/actors/modchannel/actor.go index b784cf2..b9290f5 100644 --- a/internal/actors/modchannel/actor.go +++ b/internal/actors/modchannel/actor.go @@ -41,7 +41,7 @@ func Register(args plugins.RegistrationArguments) error { }, { Default: "", - Description: "Category / Game to set", + Description: "Category / Game to set (use `@1234` format to pass an explicit ID)", Key: "game", Name: "Game", Optional: true, diff --git a/pkg/twitch/twitch.go b/pkg/twitch/twitch.go index 4101424..7ce7ecd 100644 --- a/pkg/twitch/twitch.go +++ b/pkg/twitch/twitch.go @@ -470,7 +470,16 @@ func (c *Client) ModifyChannelInformation(ctx context.Context, broadcasterName s Title: title, } - if game != nil { + switch { + case game == nil: + // We don't set the GameID + + case (*game)[0] == '@': + // We got an ID and don't need to resolve + gameID := (*game)[1:] + data.GameID = &gameID + + default: categories, err := c.SearchCategories(ctx, *game) if err != nil { return errors.Wrap(err, "searching for game")