From df07db973318f1a2fd11cf77cad924f1b2d824cf Mon Sep 17 00:00:00 2001 From: Igor Tolmachov Date: Sat, 9 Jul 2022 01:45:37 +0900 Subject: Фикс багов и /void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handlers/member.py | 55 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'handlers/member.py') diff --git a/handlers/member.py b/handlers/member.py index 3704c33..83fd39f 100644 --- a/handlers/member.py +++ b/handlers/member.py @@ -3,38 +3,34 @@ from aiogram import types as t from shared.instances import bot, dp from utils import filters as f -request_queue: list[int] = [] - @dp.chat_join_request_handler() async def приём_запроса(cjr: t.ChatJoinRequest): - if cjr.from_user.id not in request_queue: - request_queue.append(cjr.from_user.id) - r = await bot.send_message( - cjr.chat.id, - f'{cjr.from_user.mention} хочет в чат', - parse_mode=t.ParseMode.HTML, - ) - await bot.send_poll( - cjr.chat.id, - "Пускаем ?", - [ - "Да", - "Нет", - ], - False, - reply_to_message_id=r.message_id, - open_period=600, - reply_markup=t.InlineKeyboardMarkup().add( - t.InlineKeyboardButton( - "Проверить опрос", - callback_data=f"check_request_poll:{cjr.from_user.id}", - ) - ), - ) - await bot.send_message( - cjr.from_user.id, "Заявка на вступление в группу будет вскоре рассмотрена" - ) + r = await bot.send_message( + cjr.chat.id, + f'{cjr.from_user.mention} хочет в чат', + parse_mode=t.ParseMode.HTML, + ) + await bot.send_poll( + cjr.chat.id, + "Пускаем ?", + [ + "Да", + "Нет", + ], + False, + reply_to_message_id=r.message_id, + open_period=600, + reply_markup=t.InlineKeyboardMarkup().add( + t.InlineKeyboardButton( + "Проверить опрос", + callback_data=f"check_request_poll:{cjr.from_user.id}", + ) + ), + ) + await bot.send_message( + cjr.from_user.id, "Заявка на вступление в группу будет вскоре рассмотрена" + ) @dp.callback_query_handler( @@ -52,7 +48,6 @@ async def проверить_запрос(clb: t.CallbackQuery): if not poll.is_closed: await bot.stop_poll(msg.chat.id, msg.message_id) - request_queue.remove(user_id) yes = poll.options[0].voter_count no = poll.options[1].voter_count win = max(yes, no) -- cgit v1.2.3