29 lines
883 B
Python
29 lines
883 B
Python
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)
|