parent
ec3da356c1
commit
37462b7cc3
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
db.json
|
||||
/__pycache__/
|
4
main.py
4
main.py
@ -102,7 +102,7 @@ def send_stats(message):
|
||||
chat_id = str(message.chat.id)
|
||||
user_id = str(message.from_user.id)
|
||||
#if str(message.from_user.id)==db[str(message.chat.id)]:
|
||||
bot.send_message(chat_id, f"Количество потреченных обедов [{telebot.util.user_link(message.from_user)}]: {db[chat_id][user_id]}😿", parse_mode='HTML')
|
||||
bot.send_message(chat_id, f"Count of lunchs of USER [{telebot.util.user_link(message.from_user)}]: {db[chat_id][user_id]}", parse_mode='HTML')
|
||||
|
||||
@bot.message_handler()
|
||||
def catch_all_messages(message):
|
||||
@ -112,7 +112,7 @@ def catch_all_messages(message):
|
||||
def catch_edited_messages(message):
|
||||
catch(message)
|
||||
|
||||
mod = 1
|
||||
mod = 2
|
||||
if mod == 1:
|
||||
while True:
|
||||
try:
|
||||
|
@ -7,16 +7,16 @@ bot = telebot.TeleBot(db['token'])
|
||||
while True:
|
||||
now = datetime.now()
|
||||
current_time = now.strftime("%H:%M")
|
||||
if current_time == "21:00":
|
||||
if current_time == "16:10":
|
||||
db = read_db()
|
||||
for i in db:
|
||||
if i != "token":
|
||||
text = 'Статистика обедов за 24 часа::\n'
|
||||
if i != "token" and db[i] != 0:
|
||||
text = ''
|
||||
for j in i:
|
||||
text += f'<a href="tg://user?id={j}">Пользователь</a>: {db[i][j]} обедов.\n'
|
||||
text += f"{db[i][j]}\n"
|
||||
db[i][j] = 0
|
||||
write_db(db)
|
||||
bot.send_message(int(i),
|
||||
bot.send_message(int(j),
|
||||
text,
|
||||
parse_mode='HTML')
|
||||
time.sleep(61)
|
||||
|
Loading…
Reference in New Issue
Block a user