예제 #1
0
        public CommandContainer ParseCommand(BotEventArgs botArguments)
        {
            string commandName = botArguments.FindCommandName();

            if (string.IsNullOrWhiteSpace(commandName))
            {
                throw new CommandNotFoundException($"[{nameof(CommandParser)}]: Message do not contains command name.");
            }

            return(new CommandContainer(commandName, botArguments.GetCommandArguments(), botArguments.GetMediaFiles(),
                                        botArguments.SenderInfo));
        }
예제 #2
0
        public Result <CommandArgumentContainer> ParseCommand(BotEventArgs botArguments)
        {
            string commandName = botArguments.FindCommandName();

            if (string.IsNullOrWhiteSpace(commandName))
            {
                return(Result.Fail($"[{nameof(CommandParser)}]: Message do not contains command name."));
            }

            return(Result.Ok(new CommandArgumentContainer(commandName, botArguments.Sender, botArguments.GetCommandArguments(), botArguments.GetMediaFiles())));
        }