protected override async Task PerformInternal(CommandParametersModel parameters)
        {
            List <string> commandTriggers = new List <string>();

            foreach (ChatCommandModel command in ChannelSession.AllEnabledChatAccessibleCommands)
            {
                if (command.IsEnabled)
                {
                    RoleRequirementModel roleRequirement = command.Requirements.Role;
                    if (roleRequirement != null)
                    {
                        Result result = await roleRequirement.Validate(parameters);

                        if (result.Success)
                        {
                            if (command.IncludeExclamation)
                            {
                                commandTriggers.AddRange(command.Triggers.Select(c => $"!{c}"));
                            }
                            else
                            {
                                commandTriggers.AddRange(command.Triggers);
                            }
                        }
                    }
                }
            }

            if (commandTriggers.Count > 0)
            {
                string text = "Available Commands: " + string.Join(", ", commandTriggers.OrderBy(c => c));
                await ChannelSession.Services.Chat.SendMessage(text);
            }
            else
            {
                await ChannelSession.Services.Chat.SendMessage("There are no commands available for you to use.");
            }
        }
        public override async Task CustomRun(CommandParametersModel parameters)
        {
            await ChannelSession.RefreshChannel();

            if (ChannelSession.TwitchChannelV5 != null)
            {
                GameInformation details = await XboxGamePreMadeChatCommandModel.GetXboxGameInfo(ChannelSession.TwitchChannelV5.game);

                if (details == null)
                {
                    details = await SteamGamePreMadeChatCommandModel.GetSteamGameInfo(ChannelSession.TwitchChannelV5.game);
                }

                if (details != null)
                {
                    await ChannelSession.Services.Chat.SendMessage(details.ToString());
                }
                else
                {
                    await ChannelSession.Services.Chat.SendMessage("Game: " + ChannelSession.TwitchChannelV5.game);
                }
            }
        }
Ejemplo n.º 3
0
        public static async Task RunActions(IEnumerable <ActionModelBase> actions, CommandParametersModel parameters)
        {
            List <ActionModelBase> actionsToRun = new List <ActionModelBase>(actions);

            for (int i = 0; i < actionsToRun.Count; i++)
            {
                ActionModelBase action = actionsToRun[i];
                if (action is OverlayActionModel && ChannelSession.Services.Overlay.IsConnected)
                {
                    ChannelSession.Services.Overlay.StartBatching();
                }

                await action.Perform(parameters);

                if (action is OverlayActionModel && ChannelSession.Services.Overlay.IsConnected)
                {
                    if (i == (actionsToRun.Count - 1) || !(actionsToRun[i + 1] is OverlayActionModel))
                    {
                        await ChannelSession.Services.Overlay.EndBatching();
                    }
                }
            }
        }
        public override async Task CustomRun(CommandParametersModel parameters)
        {
            if (ChannelSession.Settings.QuotesEnabled)
            {
                if (parameters.Arguments.Count() > 0)
                {
                    StringBuilder quoteBuilder = new StringBuilder();
                    foreach (string arg in parameters.Arguments)
                    {
                        quoteBuilder.Append(arg + " ");
                    }

                    string quoteText = quoteBuilder.ToString();
                    quoteText = quoteText.Trim(new char[] { ' ', '\'', '\"' });

                    UserQuoteModel quote = new UserQuoteModel(UserQuoteViewModel.GetNextQuoteNumber(), quoteText, DateTimeOffset.Now, ChannelSession.TwitchChannelV5?.game);
                    ChannelSession.Settings.Quotes.Add(quote);
                    await ChannelSession.SaveSettings();

                    GlobalEvents.QuoteAdded(quote);

                    if (ChannelSession.Services.Chat != null)
                    {
                        await ChannelSession.Services.Chat.SendMessage("Added " + quote.ToString());
                    }
                }
                else
                {
                    await ChannelSession.Services.Chat.SendMessage("Usage: !addquote <FULL QUOTE TEXT>");
                }
            }
            else
            {
                await ChannelSession.Services.Chat.SendMessage("Quotes must be enabled with Mix It Up for this feature to work");
            }
        }
 public override async Task CustomRun(CommandParametersModel parameters)
 {
     await ChannelSession.Services.Chat.SendMessage("All common, Mix It Up chat commands can be found here: https://github.com/SaviorXTanren/mixer-mixitup/wiki/Pre-Made-Chat-Commands. For commands specific to this stream, ask your streamer/moderator.");
 }
Ejemplo n.º 6
0
 protected virtual async Task PerformInternal(CommandParametersModel parameters)
 {
     await CommandModelBase.RunActions(this.Actions, parameters);
 }
        protected override async Task PerformInternal(CommandParametersModel parameters)
        {
            await ChannelSession.RefreshChannel();

            await ChannelSession.Services.Chat.SendMessage("Stream Title: " + ChannelSession.TwitchChannelV5.status);
        }
        public override async Task CustomRun(CommandParametersModel parameters)
        {
            if (parameters.Arguments.Count() >= 3)
            {
                string commandTrigger = parameters.Arguments.ElementAt(0).ToLower();

                if (!ChatCommandModel.IsValidCommandTrigger(commandTrigger))
                {
                    await ChannelSession.Services.Chat.SendMessage("ERROR: Command trigger contain an invalid character");

                    return;
                }

                foreach (CommandModelBase command in ChannelSession.Services.Command.AllEnabledChatAccessibleCommands)
                {
                    if (command.IsEnabled)
                    {
                        if (command.Triggers.Contains(commandTrigger, StringComparer.InvariantCultureIgnoreCase))
                        {
                            await ChannelSession.Services.Chat.SendMessage("ERROR: There already exists an enabled, chat command that uses the command trigger you have specified");

                            return;
                        }
                    }
                }

                if (!int.TryParse(parameters.Arguments.ElementAt(1), out int cooldown) || cooldown < 0)
                {
                    await ChannelSession.Services.Chat.SendMessage("ERROR: Cooldown must be 0 or greater");

                    return;
                }

                StringBuilder commandTextBuilder = new StringBuilder();
                foreach (string arg in parameters.Arguments.Skip(2))
                {
                    commandTextBuilder.Append(arg + " ");
                }

                string commandText = commandTextBuilder.ToString();
                commandText = commandText.Trim(new char[] { ' ', '\'', '\"' });

                ChatCommandModel newCommand = new ChatCommandModel(commandTrigger, new HashSet <string>()
                {
                    commandTrigger
                }, includeExclamation: true, wildcards: false);
                newCommand.Requirements.AddBasicRequirements();
                newCommand.Requirements.Role.Role                 = UserRoleEnum.User;
                newCommand.Requirements.Cooldown.Type             = CooldownTypeEnum.Standard;
                newCommand.Requirements.Cooldown.IndividualAmount = cooldown;
                newCommand.Actions.Add(new ChatActionModel(commandText));
                ChannelSession.Settings.SetCommand(newCommand);
                ChannelSession.Services.Command.ChatCommands.Add(newCommand);

                if (ChannelSession.Services.Chat != null)
                {
                    await ChannelSession.Services.Chat.SendMessage("Added New Command: !" + commandTrigger);

                    ChannelSession.Services.Chat.RebuildCommandTriggers();
                }
            }
            else
            {
                await ChannelSession.Services.Chat.SendMessage("Usage: !addcommand <COMMAND TRIGGER, NO !> <COOLDOWN> <FULL COMMAND MESSAGE TEXT>");
            }
        }
Ejemplo n.º 9
0
 public virtual Task PostRun(CommandParametersModel parameters)
 {
     return(Task.FromResult(0));
 }
Ejemplo n.º 10
0
 public IEnumerable <CommandParametersModel> GetPerformingUsers(CommandParametersModel parameters)
 {
     return(this.Requirements.GetPerformingUsers(parameters));
 }
Ejemplo n.º 11
0
 public async Task PerformRequirements(CommandParametersModel parameters)
 {
     await this.Requirements.Perform(parameters);
 }
Ejemplo n.º 12
0
 public virtual Task <Result> CustomValidation(CommandParametersModel parameters)
 {
     return(Task.FromResult(new Result()));
 }
 protected override Task PerformInternal(CommandParametersModel parameters)
 {
     return(Task.FromResult(0));
 }
 protected override async Task PerformInternal(CommandParametersModel parameters)
 {
     await ChannelSession.Services.Chat.SendMessage(parameters.User.DisplayName + "'s Streamer Age: " + parameters.User.AccountAgeString);
 }
        public override async Task CustomRun(CommandParametersModel parameters)
        {
            await ChannelSession.RefreshChannel();

            await ChannelSession.Services.Chat.SendMessage("Stream Title: " + ChannelSession.TwitchChannelV5.status);
        }
 public override async Task CustomRun(CommandParametersModel parameters)
 {
     await ChannelSession.Services.Chat.SendMessage(parameters.User.FullDisplayName + "'s Streamer Age: " + parameters.User.AccountAgeString);
 }
Ejemplo n.º 17
0
 public CommandInstanceModel(Guid commandID, CommandParametersModel parameters)
 {
     this.CommandID  = commandID;
     this.Parameters = parameters;
 }
 public override async Task CustomRun(CommandParametersModel parameters)
 {
     int index = RandomHelper.GenerateRandomNumber(this.responses.Count);
     await ChannelSession.Services.Chat.SendMessage(string.Format("The Magic 8-Ball says: \"{0}\"", this.responses[index]));
 }
Ejemplo n.º 19
0
 public CommandInstanceModel(IEnumerable <ActionModelBase> actions, CommandParametersModel parameters)
 {
     this.Actions    = new List <ActionModelBase>(actions);
     this.Parameters = parameters;
 }
 public override async Task CustomRun(CommandParametersModel parameters)
 {
     await ChannelSession.Services.Chat.SendMessage("This channel uses the Mix It Up app to improve their stream. Check out http://mixitupapp.com for more information!");
 }
Ejemplo n.º 21
0
 protected virtual async Task PerformRequirements(CommandParametersModel parameters)
 {
     await this.Requirements.Perform(parameters);
 }