Skip to content

Errbot doesn't treat new lines as command seperators #1307

@sinkingpoint

Description

@sinkingpoint

In order to let us help you better, please fill out the following fields as best you can:

I am...

  • Reporting a bug
  • Suggesting a new feature
  • Requesting help with running my bot
  • Requesting help writing plugins
  • Here about something else

I am running...

  • Errbot version:
nobody@box:/$ errbot --version
Errbot version 5.2.0
  • OS version: Debian 9.5
  • Python version: Python 3.6.5
  • Using a virtual environment: yes

Issue description

When scanning for a command to run, errbot splits the command by spaces (https://github.com/errbotio/errbot/blob/master/errbot/core.py#L269). In the event that a message has been sent with a newline separating the command from the arguments, this fails and errbot (IMO) incorrectly identifies the command as not found.

Steps to reproduce

Consider the following bot command:

@botcmd
def hello(self, msg, args):
  return 'Hello! You said: ' + args

When called as such:

@errbot hello
Line 1

In this case, errbot looks for commands: ["hello\nline_1", "hello\nline"] - as it does not treat the \n as a whitespace character, it does not attempt to look for a command 'hello', and thus fails the command lookup. What I would expect is that errbot correctly calls the hello function with the argument 'Line1' (Correctly trimming the whitespace)

Additional info

If you have any more information, please specify it here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions