private IEnumerable <ResponseMessage> MultipleCommandsHandler(IncomingMessage message, IValidHandle matchedHandle)
        {
            var builder = new StringBuilder();

            builder.Append(">>>");

            if (message.TargetedText == "test grej")
            {
                yield return(message.ReplyToChannel("EN TESTGREJ!"));
            }
            else if (message.TargetedText == "test annat")
            {
                yield return(message.ReplyToChannel("ETT ANNAT TEST!"));
            }
            else
            {
                IEnumerable <CommandDescription> supportedCommands = GetSupportedCommands().OrderBy(x => x.Command);

                foreach (CommandDescription commandDescription in supportedCommands)
                {
                    string description = commandDescription.Description.Replace("@{bot}", $"@{_noobotCore.GetBotUserName()}");
                    builder.AppendFormat("{0}\t- {1}\n", commandDescription.Command, description);
                }
            }

            yield return(message.ReplyToChannel(builder.ToString()));
        }
Beispiel #2
0
        private async IAsyncEnumerable <ResponseMessage> HelpHandler(IncomingMessage message, IValidHandle matchedHandle)
        {
            var builder = new StringBuilder();

            builder.Append(">>>");

            var supportedCommands = GetSupportedCommands()
                                    .OrderBy(x => x.Command);

            foreach (var commandDescription in supportedCommands)
            {
                var description = commandDescription.Description.Replace("@{bot}", $"@{_noobotCore.GetBotUserName()}");
                builder.AppendFormat("{0}\t- {1}\n", commandDescription.Command, description);
            }

            yield return(await Task.FromResult(message.ReplyToChannel(builder.ToString())));
        }
Beispiel #3
0
        private IEnumerable <ResponseMessage> HelpHandler(IncomingMessage message, string matchedHandle)
        {
            var builder = new StringBuilder();

            builder.Append(">>>");

            IEnumerable <CommandDescription> supportedCommands = GetSupportedCommands().OrderBy(x => x.Command);

            foreach (CommandDescription commandDescription in supportedCommands)
            {
                string description = commandDescription.Description.Replace("@{bot}", $"@{_noobotCore.GetBotUserName()}");
                builder.AppendFormat("{0}\t- {1}\n", commandDescription.Command, description);
            }

            yield return(message.ReplyDirectlyToUser(builder.ToString()));
        }