diff --git a/for_db.py b/for_db.py index 3b1f0de..da21b5a 100644 --- a/for_db.py +++ b/for_db.py @@ -195,6 +195,9 @@ def new_message(message: types.Message) -> int: def check_old_notes() -> list[int, str, int]: # возвращает первую устаревшую заметку users = yaml.safe_load(open(users_path, "r", encoding="utf-8")) + if not users: + users = {} + for user_id in users.keys(): notes = yaml.safe_load(open(user_path.format(user_id), "r", encoding="utf-8")) diff --git a/lang.yaml b/lang.yaml index da47ad9..7234382 100644 --- a/lang.yaml +++ b/lang.yaml @@ -13,3 +13,80 @@ \nПожалуйста, попробуйте снова или свяжитесь с @Kr0sH_512" no_reminders: "У вас нет напоминаний." not_registered: "Пожалуйста, воспользуйтесь сперва командой /start" + +"list_reaction": + [ + "👍", + "👎", + "❤", + "🔥", + "🥰", + "👏", + "😁", + "🤔", + "🤯", + "😱", + "🤬", + "😢", + "🎉", + "🤩", + "🤮", + "💩", + "🙏", + "👌", + "🕊", + "🤡", + "🥱", + "🥴", + "😍", + "🐳", + "❤‍🔥", + "🌚", + "🌭", + "💯", + "🤣", + "⚡", + "🍌", + "🏆", + "💔", + "🤨", + "😐", + "🍓", + "🍾", + "💋", + "🖕", + "😈", + "😴", + "😭", + "🤓", + "👻", + "👨‍💻", + "👀", + "🎃", + "🙈", + "😇", + "😨", + "🤝", + "✍", + "🤗", + "🫡", + "🎅", + "🎄", + "☃", + "💅", + "🤪", + "🗿", + "🆒", + "💘", + "🙉", + "🦄", + "😘", + "💊", + "🙊", + "😎", + "👾", + "🤷‍♂", + "🤷", + "🤷‍♀", + "😡", + ] diff --git a/tg.py b/tg.py index 9eca199..ae19c7f 100644 --- a/tg.py +++ b/tg.py @@ -1,14 +1,15 @@ #!/usr/bin/python3.3 import threading, telebot, schedule, time, yaml from datetime import datetime -import os, sys, inspect +import os, sys, inspect, random import re, locale from telegram.constants import ParseMode from telebot import types import for_db as db config = yaml.safe_load(open("config.yaml")) -lang = yaml.safe_load(open("lang.yaml"))["ru"] +lang = yaml.safe_load(open("lang.yaml", encoding="utf-8"))["ru"] +list_reactions = yaml.safe_load(open("lang.yaml", encoding="utf-8"))["list_reaction"] bot = telebot.TeleBot( config["api_token"], colorful_logs=True, @@ -310,6 +311,11 @@ def list_notes(message: types.Message, list: str = "Default", edit: bool = False msg = send_message(message, notes_msg, markup) + reaction = types.ReactionTypeEmoji(random.choice(list_reactions)) + bot.set_message_reaction( + message.chat.id, message.message_id, [reaction], is_big=True + ) + old_msg_id = db.new_message(msg) if old_msg_id: @@ -397,6 +403,11 @@ def text_message(message: types.Message): date_found_dt, ) + reaction = types.ReactionTypeEmoji(random.choice(list_reactions)) + + bot.set_message_reaction( + message.chat.id, message.message_id, [reaction], is_big=True + ) send_message(message, "📝 Напоминание добавлено:") list_notes(message)