From 8dd8e34d2d175e445fe4802a4436b67afb50e408 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 23 Nov 2023 18:38:46 +0300 Subject: [PATCH 1/2] fix: remove unused BOT_NAME from .env --- .env.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/.env.dist b/.env.dist index 76ffbce..c82a606 100644 --- a/.env.dist +++ b/.env.dist @@ -7,7 +7,6 @@ SUBSCRIPTION_CHANNELS_IDS=-12345678901234,-12345678901235 # Docker settings BOT_CONTAINER_NAME=bot_container_name BOT_IMAGE_NAME=botimage_name -BOT_NAME=mybotname # DB settings DB_USER=exampleDBUserName From de65c1db41013a1aefb50e4aadbb05de7af3c754 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 23 Nov 2023 18:39:04 +0300 Subject: [PATCH 2/2] fix: add send_all support for redis storage --- tgbot/handlers/admin/send_all.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tgbot/handlers/admin/send_all.py b/tgbot/handlers/admin/send_all.py index 4f777de..29ec782 100644 --- a/tgbot/handlers/admin/send_all.py +++ b/tgbot/handlers/admin/send_all.py @@ -35,6 +35,8 @@ async def _confirm_send(message: types.Message, user: UserTG, state: FSMContext) async def _ask_to_change_buttons(call: types.CallbackQuery, user: UserTG, state: FSMContext) -> None: + await call.answer() + text = """ Введите ВСЕ кнопки в формате: @@ -66,7 +68,7 @@ async def _change_buttons(message: types.Message, user: UserTG, state: FSMContex if buttons: keyboard = send_all.broadcast_message_keyboard(buttons) await user.edit_message_reply_markup(broadcast_message_id, reply_markup=keyboard) - await state.update_data(keyboard=keyboard) + await state.update_data(buttons=buttons) await SendAllState.waiting_for_confirm.set() @@ -81,14 +83,18 @@ async def _cancel(call: types.CallbackQuery, state: FSMContext, user: UserTG) -> async def _start_broadcast(call: types.CallbackQuery, user: UserTG, state: FSMContext) -> None: + await call.answer() + data = await state.get_data() broadcast_message_id: int = data.get("broadcast_message_id") - keyboard: types.InlineKeyboardMarkup = data.get("keyboard") + buttons: list[list[str]] | None = data.get("buttons") + keyboard = send_all.broadcast_message_keyboard(buttons) if buttons else None await state.finish() users_id = [user_id[0] for user_id in await User.select("id").where(User.is_banned == False).gino.all()] await user.send_message(f'Рассылка на всех пользователей ({len(users_id)}) началась!') + broadcast_message = await call.bot.forward_message(call.message.chat.id, call.message.chat.id, broadcast_message_id) await user.delete_message(broadcast_message.message_id) await MessageBroadcaster(chats=users_id, message=broadcast_message, reply_markup=keyboard).run()