Skip to content

Commit

Permalink
fix for auto func
Browse files Browse the repository at this point in the history
  • Loading branch information
lek-x committed Jul 15, 2023
1 parent 6af36a9 commit 37266a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def auto_send(message):
"""
bot.send_message(
message.chat.id,
"Please send text in format for auto notification. \nFor enabling: 'yes 08:00 Paris' \nFor disabling: 'no' ",
"Please send text in format for auto notification. \nFor enabling: 'yes/08:00/Paris' \nFor disabling: 'no' ",
)

bot.register_next_step_handler(message, get_switch)
Expand All @@ -346,7 +346,8 @@ def help(message):
def get_switch(message):
"""Function for reciveing meassage, for enabling auto_send"""
message_str = message.text
check_string = re.search("yes|no|Yes|No", message_str)
message_str = message_str.lower()
check_string = re.search("yes|no", message_str)
if check_string is not None:
switch_status = message_str[0:3]
switch_status = switch_status.lower()
Expand All @@ -355,7 +356,7 @@ def get_switch(message):
if switch_status == "yes":
switch_status = "True"
time = str(message_str[4:9])
city = str(message_str[10:])
city = str(message_str[10:]).title()
enablesending(switch_status, time, city, message.chat.id)
bot.send_message(
message.chat.id,
Expand Down

0 comments on commit 37266a6

Please sign in to comment.