some fix with emoji function
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -424,19 +424,21 @@ async def update_user_info(source: str, message: types.Message):
|
||||
BotDB.update_date_for_user(date, user_id)
|
||||
|
||||
|
||||
def check_user_emoji(user_id: int):
|
||||
if BotDB.check_emoji_for_user(user_id=user_id) is None:
|
||||
def check_user_emoji(message: types.Message):
|
||||
user_id = message.from_user.id
|
||||
user_emoji = BotDB.check_emoji_for_user(user_id=user_id)
|
||||
if user_emoji is None:
|
||||
user_emoji = get_random_emoji()
|
||||
BotDB.update_emoji_for_user(user_id=user_id, emoji=user_emoji)
|
||||
return user_emoji
|
||||
|
||||
|
||||
def get_random_emoji():
|
||||
attempts = 0
|
||||
while attempts < 100:
|
||||
print(attempts)
|
||||
user_emoji = random.choice(emoji_list)
|
||||
if not BotDB.check_emoji(user_emoji):
|
||||
return user_emoji
|
||||
attempts += 1
|
||||
logger.error("Не удалось найти уникальный эмодзи после нескольких попыток.")
|
||||
return None
|
||||
return "Эмоджи не определен"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_message(username: str, type_message: str):
|
||||
constants = {
|
||||
'HELLO_MESSAGE': "Привет, username!👋🏼&Меня зовут Виби, я бот канала 'Влюбленный Бийск'❤🤖"
|
||||
@@ -25,7 +23,7 @@ def get_message(username: str, type_message: str):
|
||||
"&Мы рассмотрим и ответим тебе в ближайшее время☺️❤️",
|
||||
"DEL_MESSAGE": "username, напиши свое обращение или предложение✍"
|
||||
"&Мы рассмотрим и ответим тебе в ближайшее время☺❤",
|
||||
"BYE_MESSAGE": "Если позднее захочешь предложить еще один пост или обратиться к админам с вопросом, то просто пришли в чат команду 👉 /start"
|
||||
"BYE_MESSAGE": "Если позднее захочешь предложить еще один пост или обратиться к админам с вопросом, то просто пришли в чат команду 👉 /restart"
|
||||
"&&И тебе пока!👋🏼❤️",
|
||||
"USER_ERROR": "Увы, я не понимаю тебя😐💔 Выбери один из пунктов в нижнем меню, а затем пиши.",
|
||||
"QUESTION": "Сообщение успешно отправлено❤️ Ответим, как только сможем😉",
|
||||
|
||||
Reference in New Issue
Block a user