welcomecenterbot/handlers/handle_join_request.py
2024-01-07 12:19:46 +03:00

29 lines
883 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from bot.api import telegram_api
from bot.announce import show_announce
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
positive_reactions = [] # TODO: set positive reaction kinds
async def handle_join_request(join_request):
logger.info(f"handle join request {join_request}")
# показываем сообщение с кнопкой "поручиться"
await show_announce(join_request)
async def handle_reaction_on_request(update):
chat_id = str(update["chat"]["id"])
from_id = str(update["from"]["id"])
logger.debug(update)
reaction = None # TODO: get reaction kind from update
if reaction in positive_reactions:
# за пользователя поручились
r = await telegram_api("approveChatJoinRequest", chat_id=chat_id, from_id=from_id)
logger.debug(r)