Skip to content

Commit

Permalink
refactored code on return simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
alimaktabi committed Oct 17, 2024
1 parent e27abcd commit 5df648f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions telegram/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ def handle_user_message(self, message: types.Message):
"""
instance = self.message_handlers.get(message.text)

if not instance:
return None

return instance.handler(message)
return None if not instance else instance.handler(message)

def handle_user_command(self, message: types.Message):
"""
Expand All @@ -155,10 +152,7 @@ def handle_user_command(self, message: types.Message):

instance = self.command_handlers.get(command)

if not instance:
return None

return instance.handler(message, command, args[1:])
return None if not instance else instance.handler(message, command, args[1:])

def build_callback_string(self, command: str, args: list[str]):
if not args:
Expand Down

0 comments on commit 5df648f

Please sign in to comment.