You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import schedule
|
|
|
|
import time
|
|
|
|
import telebot
|
|
|
|
from db import *
|
|
|
|
db = read_db()
|
|
|
|
bot = telebot.TeleBot(db['token'])
|
|
|
|
|
|
|
|
|
|
|
|
def send_message():
|
|
|
|
db = read_db()
|
|
|
|
for i in db:
|
|
|
|
if i != "token":
|
|
|
|
text = 'Статистика обедов за 24 часа:\n'
|
|
|
|
for j in db[i]:
|
|
|
|
text += f'@{db[i][j]["username"]} - {db[i][j]["lunch"]} 😿\n'
|
|
|
|
db[i][j]["lunch"] = 0
|
|
|
|
write_db(db)
|
|
|
|
bot.send_message(int(i), text, parse_mode='HTML')
|
|
|
|
|
|
|
|
schedule.every().day.at("21:00","Europe/Moscow").do(send_message)
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
schedule.run_pending()
|
|
|
|
time.sleep(1)
|
|
|
|
except: exit()
|