This commit is contained in:
2024-09-27 09:23:55 +03:00
parent c1e481ded8
commit a7b1925e8d
12 changed files with 218 additions and 139 deletions

View File

@@ -9,10 +9,30 @@ logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
positive_reactions = ["👍", "", "🔥", "🥰", "👏", "🎉", "🙏", "👌", "🕊", "😍", "❤‍🔥", "🍓", "🍾", "💋", "😇", "🤝", "🤗", "💘", "😘"]
positive_reactions = [
"👍",
"",
"🔥",
"🥰",
"👏",
"🎉",
"🙏",
"👌",
"🕊",
"😍",
"❤‍🔥",
"🍓",
"🍾",
"💋",
"😇",
"🤝",
"🤗",
"💘",
"😘",
]
announced_message = {
"ru": "Запрос на вступление опубликован в чате, как только вас узнают и отреагируют - она будет принята",
"en": "The join request is posted in the chat, once you are recognized and someone reacted to - it will be accepted"
"en": "The join request is posted in the chat, once you are recognized and someone reacted to - it will be accepted",
}
@@ -22,12 +42,14 @@ async def handle_join_request(join_request):
lang = user.get("language_code", "ru")
# показываем для FEEDBACK_CHAT
await telegram_api("sendMessage", chat_id=FEEDBACK_CHAT_ID, text="новая заявка от " + mention(user))
await telegram_api(
"sendMessage", chat_id=FEEDBACK_CHAT_ID, text="новая заявка от " + mention(user)
)
# показываем анонс с заявкой
await show_announce(join_request)
# сообщаем пользователю, что опубликовали анонс его заявки
await telegram_api("sendMessage", chat_id=user['id'], text=announced_message[lang])
await telegram_api("sendMessage", chat_id=user["id"], text=announced_message[lang])
async def handle_reaction_on_request(update):
@@ -39,5 +61,7 @@ async def handle_reaction_on_request(update):
new_reaction = reaction.get("new_reaction")
if new_reaction.get("emoji") in positive_reactions:
# за пользователя поручились
r = await telegram_api("approveChatJoinRequest", chat_id=chat_id, user_id=from_id)
r = await telegram_api(
"approveChatJoinRequest", chat_id=chat_id, user_id=from_id
)
logger.debug(r)