add fixes...

main
ramjm 7 months ago
parent 0b2b98209e
commit ec3da356c1

2
.gitignore vendored

@ -0,0 +1,2 @@
db.json
/__pycache__/

@ -102,7 +102,7 @@ def send_stats(message):
chat_id = str(message.chat.id) chat_id = str(message.chat.id)
user_id = str(message.from_user.id) user_id = str(message.from_user.id)
#if str(message.from_user.id)==db[str(message.chat.id)]: #if str(message.from_user.id)==db[str(message.chat.id)]:
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.send_message(chat_id, f"Количество потреченных обедов [{telebot.util.user_link(message.from_user)}]: {db[chat_id][user_id]}😿", parse_mode='HTML')
@bot.message_handler() @bot.message_handler()
def catch_all_messages(message): def catch_all_messages(message):
@ -112,7 +112,7 @@ def catch_all_messages(message):
def catch_edited_messages(message): def catch_edited_messages(message):
catch(message) catch(message)
mod = 2 mod = 1
if mod == 1: if mod == 1:
while True: while True:
try: try:

@ -7,16 +7,16 @@ bot = telebot.TeleBot(db['token'])
while True: while True:
now = datetime.now() now = datetime.now()
current_time = now.strftime("%H:%M") current_time = now.strftime("%H:%M")
if current_time == "16:10": if current_time == "21:00":
db = read_db() db = read_db()
for i in db: for i in db:
if i != "token" and db[i] != 0: if i != "token":
text = '' text = 'Статистика обедов за 24 часа::\n'
for j in i: for j in i:
text += f"{db[i][j]}\n" text += f'<a href="tg://user?id={j}">Пользователь</a>: {db[i][j]} обедов.\n'
db[i][j] = 0 db[i][j] = 0
write_db(db) write_db(db)
bot.send_message(int(j), bot.send_message(int(i),
text, text,
parse_mode='HTML') parse_mode='HTML')
time.sleep(61) time.sleep(61)

Loading…
Cancel
Save