Issue 566 (#577)

* stripping token of whitespaces before starting bot

* Line feed

* - Case insensitivity for commandhandler
- Ignore pylint case on windows.
This commit is contained in:
Eldinnie 2017-04-25 10:37:06 +02:00 committed by Jannes Höke
parent b5b09884b1
commit 90bf26c09b
3 changed files with 6 additions and 2 deletions

View file

@ -110,7 +110,7 @@ class CommandHandler(Handler):
res = self.filters(message)
return res and (message.text.startswith('/') and command[0] == self.command
and command[1] == update.message.bot.username)
and command[1].lower() == update.message.bot.username.lower())
else:
return False

View file

@ -38,7 +38,7 @@ else:
# on Windows, the best available is time.clock while time.time is on
# another platforms (M. Lutz, "Learning Python," 4ed, p.630-634)
if sys.version_info.major == 3 and sys.version_info.minor >= 3:
curtime = time.perf_counter
curtime = time.perf_counter # pylint: disable=E1101
else:
curtime = time.clock if sys.platform[:3] == 'win' else time.time

View file

@ -250,6 +250,10 @@ class UpdaterTest(BaseTest, unittest.TestCase):
queue.put(Update(update_id=0, message=message))
sleep(.1)
self.assertEqual(self.received_message, '/test@MockBot')
message.text = "/test@mockbot"
queue.put(Update(update_id=0, message=message))
sleep(.1)
self.assertEqual(self.received_message, '/test@mockbot')
# directed at other bot
self.reset()