mirror of
https://github.com/civsocit/olgram.git
synced 2025-12-16 20:26:16 +00:00
fix group chat remove, some minor fixes
This commit is contained in:
@@ -5,7 +5,7 @@ from olgram.models.models import Bot, User
|
||||
from aiogram.dispatcher import FSMContext
|
||||
from aiogram.utils.callback_data import CallbackData
|
||||
from textwrap import dedent
|
||||
from olgram.utils.mix import edit_or_create
|
||||
from olgram.utils.mix import edit_or_create, button_text_limit
|
||||
from olgram.commands import bot_actions
|
||||
|
||||
import typing as ty
|
||||
@@ -57,7 +57,7 @@ async def send_chats_menu(bot: Bot, call: types.CallbackQuery):
|
||||
|
||||
for chat in chats:
|
||||
keyboard.insert(
|
||||
types.InlineKeyboardButton(text=chat.name,
|
||||
types.InlineKeyboardButton(text=button_text_limit(chat.name),
|
||||
callback_data=menu_callback.new(level=3, bot_id=bot.id, operation="chat",
|
||||
chat=chat.id))
|
||||
)
|
||||
|
||||
@@ -20,3 +20,10 @@ async def edit_or_create(call: CallbackQuery, message: str,
|
||||
except TelegramAPIError: # кнопка устарела
|
||||
await call.bot.send_message(call.message.chat.id, text=message, reply_markup=reply_markup,
|
||||
parse_mode=parse_mode)
|
||||
|
||||
|
||||
def button_text_limit(data: str) -> str:
|
||||
max_len = 30
|
||||
if len(data) > max_len:
|
||||
data = data[:max_len-4] + "..."
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user