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

Fix command not recognized if it is directly followed by a newline #869

merged 2 commits into from Oct 14, 2017
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+10 −1
Diff settings


Just for now

@@ -134,7 +134,7 @@ def check_update(self, update):
message = update.message or update.edited_message

if message.text:
command = message.text[1:].split(' ')[0].split('@')
command = message.text[1:].split(None, 1)[0].split('@')
command.append( # in case the command was send without a username

Copy path View file
@@ -165,6 +165,15 @@ def test_pass_args(self, dp, message):
dp.process_update(Update(0, message=message))
assert self.test_flag

def test_newline(self, dp, message):
handler = CommandHandler('test', self.callback_basic)

message.text = '/test\nfoobar'
assert handler.check_update(Update(0, message))
dp.process_update(Update(0, message))
assert self.test_flag

def test_pass_user_or_chat_data(self, dp, message):
handler = CommandHandler('test', self.callback_data_1, pass_user_data=True)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.