Skip to content

Commit 90bf26c

Browse files
Eldinniejh0ker
authored andcommitted
* stripping token of whitespaces before starting bot * Line feed * - Case insensitivity for commandhandler - Ignore pylint case on windows.
1 parent b5b0988 commit 90bf26c

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

telegram/ext/commandhandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def check_update(self, update):
110110
res = self.filters(message)
111111

112112
return res and (message.text.startswith('/') and command[0] == self.command
113-
and command[1] == update.message.bot.username)
113+
and command[1].lower() == update.message.bot.username.lower())
114114
else:
115115
return False
116116

telegram/ext/messagequeue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# on Windows, the best available is time.clock while time.time is on
3939
# another platforms (M. Lutz, "Learning Python," 4ed, p.630-634)
4040
if sys.version_info.major == 3 and sys.version_info.minor >= 3:
41-
curtime = time.perf_counter
41+
curtime = time.perf_counter # pylint: disable=E1101
4242
else:
4343
curtime = time.clock if sys.platform[:3] == 'win' else time.time
4444

tests/test_updater.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ def test_addRemoveTelegramCommandHandler(self):
250250
queue.put(Update(update_id=0, message=message))
251251
sleep(.1)
252252
self.assertEqual(self.received_message, '/test@MockBot')
253+
message.text = "/test@mockbot"
254+
queue.put(Update(update_id=0, message=message))
255+
sleep(.1)
256+
self.assertEqual(self.received_message, '/test@mockbot')
253257

254258
# directed at other bot
255259
self.reset()

0 commit comments

Comments
 (0)