mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 20:01:17 +00:00
[core] Allow to pass ID to channel modification
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
499313fbe6
commit
20356abe23
2 changed files with 11 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue