feat: /new_creative tg_bot

This commit is contained in:
Artem Tsyrulnikov
2025-12-01 13:20:08 +03:00
parent 3508a522ac
commit f7754b707d
21 changed files with 688 additions and 113 deletions

View File

@@ -1,7 +1,7 @@
import logging
from typing import Any
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from aiogram.types import BotCommand, InlineKeyboardButton, InlineKeyboardMarkup
from shared.telegram_base import TelegramBase
@@ -23,3 +23,20 @@ class TelegramBot(TelegramBase):
async def create_chat_invite_link(self, chat_id: int, requires_approval: bool = False) -> str:
invite_link = await self.bot.create_chat_invite_link(chat_id=chat_id, creates_join_request=requires_approval)
return invite_link.invite_link
async def send_message_with_inline_keyboard(
self, text: str, chat_id: int, buttons: list[list[InlineKeyboardButton]]
) -> None:
keyboard = InlineKeyboardMarkup(inline_keyboard=buttons)
await self.bot.send_message(chat_id=chat_id, text=text, reply_markup=keyboard)
async def edit_message_reply_markup(self, chat_id: int, message_id: int) -> None:
await self.bot.edit_message_reply_markup(chat_id=chat_id, message_id=message_id, reply_markup=None)
async def set_commands(self) -> None:
commands = [
BotCommand(command='start', description='Начать работу с ботом'),
BotCommand(command='new_creative', description='Создать новый креатив'),
]
await self.bot.set_my_commands(commands)