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 for auto func #10

Merged
merged 9 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/build_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
needs: [Checkout_repos]
runs-on:
- self-hosted
environment: ${{ inputs.job_environment }}
environment: ${{ inputs.job_environment }}
steps:
- name: Cleanup Docker elements
run: docker system prune -a --volumes --force
Expand Down Expand Up @@ -77,9 +77,6 @@ jobs:
- name: Terraform Init
id: init
run: terraform init
env:
https_proxy: '164.92.180.74:3128'
http_proxy: '164.92.180.74:3128'

- name: Terraform Validate
id: validate
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/check_nomad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
- dev
- prod

pull_request:
branches:
- main

env:
path_bot: bot_code
image_name: tgwbot
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12.0a3-alpine3.17
FROM python:3.12-rc-alpine3.18
RUN apk update \
&& apk upgrade \
&& apk add --no-cache bash \
Expand Down
Empty file modified README.md
100755 → 100644
Empty file.
34 changes: 21 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def status(message):

bot.send_message(
message.chat.id,
f"Auto send status:\nStatus:{send_enabled},\ntime: {set_time},\
f"Auto send status:\nStatus:{send_enabled}\ntime: {set_time}\
\ncity: {set_city} \nchat_id: {usr_id}",
)

Expand All @@ -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 send: 'no' ",
)

bot.register_next_step_handler(message, get_switch)
Expand All @@ -346,29 +346,37 @@ 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)
check_time = re.search("/", message_str[4:9])
if check_string is not None:
switch_status = message_str[0:3]
switch_status = switch_status.lower()
switch_status = re.findall("no|yes", switch_status)
switch_status = str(switch_status[0])
if switch_status == "yes":
switch_status = "True"
time = str(message_str[4:9])
city = str(message_str[10:])
enablesending(switch_status, time, city, message.chat.id)
bot.send_message(
message.chat.id,
f"Auto send is enabled: {switch_status},\n time: {time}, \n city: {city}",
)
if check_time is not None:
bot.send_message(
message.chat.id,
f"Wrong time format, use format XX:YY (e.g. 08:15)",
)
else:
time = str(message_str[4:9])
city = str(message_str[10:]).title()
enablesending(switch_status, time, city, message.chat.id)
bot.send_message(
message.chat.id,
f"Auto send is enabled: yes\ntime: {time}\ncity: {city}",
)
elif switch_status == "no":
switch_status = "False"
time = "00:00"
city = "None"
enablesending(switch_status, time, city, message.chat.id)
bot.send_message(
message.chat.id,
f"Auto send is enabled: {switch_status},\n time: {time}, \n city: {city}",
f"Auto send is enabled: no\ntime: {time}\ncity: {city}",
)
else:
bot.send_message(message.chat.id, "Sorry didn't get you")
Expand All @@ -380,8 +388,8 @@ def get_weather(message):
func for get weather and sending it to user
"""
if re.match(
"Glory to Ukraine|Slava Ukraine|glory to ukraine|slava ukraine|Слава Украине|слава украине|Слава Україні|cлава україні|слава Україні",
str(message.text),
"glory to ukraine|slava ukraine|слава украине|cлава україні",
str(message.text).lower(),
):
bot.reply_to(
message,
Expand Down
Empty file modified main.tf
100755 → 100644
Empty file.
Empty file modified poetry.lock
100755 → 100644
Empty file.
Empty file modified pyproject.toml
100755 → 100644
Empty file.
Loading