[core] Allow to pass ID to channel modification

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-10-01 15:05:21 +02:00
parent 499313fbe6
commit 20356abe23
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5
2 changed files with 11 additions and 2 deletions

View file

@ -41,7 +41,7 @@ func Register(args plugins.RegistrationArguments) error {
}, },
{ {
Default: "", Default: "",
Description: "Category / Game to set", Description: "Category / Game to set (use `@1234` format to pass an explicit ID)",
Key: "game", Key: "game",
Name: "Game", Name: "Game",
Optional: true, Optional: true,

View file

@ -470,7 +470,16 @@ func (c *Client) ModifyChannelInformation(ctx context.Context, broadcasterName s
Title: title, 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) categories, err := c.SearchCategories(ctx, *game)
if err != nil { if err != nil {
return errors.Wrap(err, "searching for game") return errors.Wrap(err, "searching for game")