Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command "command" not found. #356

Open
jayvdb opened this issue Nov 22, 2017 · 20 comments
Open

Command "command" not found. #356

jayvdb opened this issue Nov 22, 2017 · 20 comments

Comments

@jayvdb
Copy link
Member

jayvdb commented Nov 22, 2017

We are regularly seeing Command "foo" not found. when the person correctly did corobo foo ....
They used the wrong arguments, but the error returned is confusing.
It should tell them they gave the foo command the wrong arguments, and possible even force feed them the help in a DM to help them use the bot properly.

What is happening is that corobo is not doing partial matches on only the command, but the error is saying that it cant match the command.

> corobo lmgtfy
@co-robo: Command "lmgtfy" not found.
> corobo lmgtfy foo
Hey! You seem to ...

lmgtfy was the command in normal parlance. foo is a parameter, or argument, etc.
The error message is wrong, and unhelpful.

@jayvdb jayvdb added the bug label Nov 22, 2017
@gitmate-bot
Copy link

GitMate.io thinks the contributor most likely able to help you is @meetmangukiya.

Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
@Vamshi99 Vamshi99 mentioned this issue Nov 28, 2017
6 tasks
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 28, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 29, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 29, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 29, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Nov 29, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
@Makman2
Copy link
Member

Makman2 commented Nov 30, 2017

It's generelly advisable to use arg_botcmd and define a shell-like syntax 👍

@Makman2
Copy link
Member

Makman2 commented Nov 30, 2017

Then you can usually post-process arguments but the command is still directed to the right function 👍

@Vamshi99
Copy link
Member

In my opinion, existing code is short and simple, using arg_botcmd makes the code complex.

@meetmangukiya
Copy link
Member

I think this problems can be solved by not using re_botcmd everywhere. Only use it where it is extremely necessary. That way errbot has complete context and better metadata to report the errors appropriately.

@Makman2
Copy link
Member

Makman2 commented Nov 30, 2017

In my opinion, existing code is short and simple, using arg_botcmd makes the code complex.

But when it doesn't match your regex again, we get this message another time ;)

@Makman2
Copy link
Member

Makman2 commented Nov 30, 2017

And arg_botcmd is actually very simple^^ It maybe adds 1 or 2 lines of overhead^^

@Vamshi99
Copy link
Member

But when it doesn't match your regex again, we get this message another time

Which message are you referring to?

@Makman2
Copy link
Member

Makman2 commented Nov 30, 2017

Command "xyz" not found.

@Vamshi99
Copy link
Member

Yeah! that's what I almost fixed here, I am just getting some queue empty error here. Can you check my PR #406

@Makman2
Copy link
Member

Makman2 commented Nov 30, 2017

almost fixed

That's why you should rather use arg_botcmd ;)

@Vamshi99
Copy link
Member

Okay, the commit completely fixes the error, I just have some optional args error with assignand pr stats command`(it works perfectly with other commands). I request a review from you #406

Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Dec 11, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Dec 11, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Dec 11, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Dec 11, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
@Vamshi99
Copy link
Member

See gitter chat at https://gitter.im/coala/corobo?at=5a2e4b2fc65707ba2b3995ef

Brief of discussion:
arg_botcmd:
Disadvantages

  • Help message will be missing
  • Problem parsing the issue, pr links.
  • Can't use aliases like (inv|invite|welcome)

Advantages:

  • Stops every message being checked for matching regex.
  • Would give better error checking.

@Makman2
Copy link
Member

Makman2 commented Dec 11, 2017

Problem parsing the issue, pr links.

Why is that a problem? That step would happen in the command function^^

@Vamshi99
Copy link
Member

@Makman2 If we use only arg_botcmd without regex matching, it would be a problem.

@Makman2
Copy link
Member

Makman2 commented Dec 11, 2017

@arg_botcmd(...)
def mycommand(..., arg1):
    import re
    m = re.match(myregex, arg1)
    if m is None:
        print('Error! arg1 is invalid!')
    else:
        # proceed
        pass

Doesn't appear to me as a limitation^^

If we use only arg_botcmd without regex matching, it would be a problem.

You definitely have to be more precise^^

@Vamshi99
Copy link
Member

Vamshi99 commented Dec 12, 2017

Ok, I have agreed that way is good, what can we do with commands having aliases?

@Makman2
Copy link
Member

Makman2 commented Dec 12, 2017

We could copy function declarations and redirect to the main function in the worst case, but I don't really like it:

# alias
@arg_botcmd(...)
def a(...):
    return assign(...)

@arg_botcmd(...)
def assign(...):
    # normal implementation

@Makman2
Copy link
Member

Makman2 commented Dec 12, 2017

I hope there's another way^^

@Vamshi99
Copy link
Member

We will be having problem with help message as well, and I too don't like above method

Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Dec 16, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue Dec 16, 2017
Give proper usage of command when a
command is used without args.

Fixes coala#356
Vamshi99 added a commit to Vamshi99/corobo that referenced this issue May 26, 2018
Give proper usage of command when a
command is used without args.

Fixes coala#356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants