public GameChatCommand()
            : base(MixItUp.Base.Resources.Game, new List <string>() { "game" }, 5, UserRoleEnum.User)
        {
            this.Actions.Add(new CustomAction(async(UserViewModel user, IEnumerable <string> arguments) =>
            {
                if (ChannelSession.Services.Chat != null)
                {
                    await ChannelSession.RefreshChannel();
                    if (ChannelSession.TwitchChannelV5 != null)
                    {
                        GameInformation details = await XboxGameChatCommand.GetXboxGameInfo(ChannelSession.TwitchChannelV5.game);
                        if (details == null)
                        {
                            details = await SteamGameChatCommand.GetSteamGameInfo(ChannelSession.TwitchChannelV5.game);
                        }

                        if (details != null)
                        {
                            await ChannelSession.Services.Chat.SendMessage(details.ToString());
                        }
                        else
                        {
                            await ChannelSession.Services.Chat.SendMessage("Game: " + ChannelSession.TwitchChannelV5.game);
                        }
                    }
                }
            }));
        }
        public SteamGameChatCommand()
            : base(MixItUp.Base.Resources.SteamGame, new List <string>() { "steamgame", "steam" }, 5, UserRoleEnum.User)
        {
            this.Actions.Add(new CustomAction(async(UserViewModel user, IEnumerable <string> arguments) =>
            {
                if (ChannelSession.Services.Chat != null)
                {
                    string gameName = null;
                    if (arguments.Count() > 0)
                    {
                        gameName = string.Join(" ", arguments);
                    }
                    else
                    {
                        await ChannelSession.RefreshChannel();
                        if (ChannelSession.TwitchChannelV5 != null)
                        {
                            gameName = ChannelSession.TwitchChannelV5.game;
                        }
                    }

                    GameInformation details = await SteamGameChatCommand.GetSteamGameInfo(gameName);
                    if (details != null)
                    {
                        await ChannelSession.Services.Chat.SendMessage(details.ToString());
                    }
                    else
                    {
                        await ChannelSession.Services.Chat.SendMessage(string.Format("Could not find the game \"{0}\" on Steam", gameName));
                    }
                }
            }));
        }
Exemplo n.º 3
0
        public XboxGameChatCommand()
            : base("Xbox Game", new List <string>() { "xboxgame" }, 5, MixerRoleEnum.User)
        {
            this.Actions.Add(new CustomAction(async(UserViewModel user, IEnumerable <string> arguments) =>
            {
                if (ChannelSession.Chat != null)
                {
                    string gameName;
                    if (arguments.Count() > 0)
                    {
                        gameName = string.Join(" ", arguments);
                    }
                    else
                    {
                        await ChannelSession.RefreshChannel();
                        gameName = ChannelSession.Channel.type.name;
                    }

                    GameInformation details = await XboxGameChatCommand.GetXboxGameInfo(gameName);
                    if (details != null)
                    {
                        await ChannelSession.Chat.SendMessage(details.ToString());
                    }
                    else
                    {
                        await ChannelSession.Chat.SendMessage(string.Format("Could not find the game \"{0}\" on Xbox", gameName));
                    }
                }
            }));
        }