First commit
This commit is contained in:
21
bot/utils/hidden_username.py
Normal file
21
bot/utils/hidden_username.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from aiogram.types import Message
|
||||
from aiogram.utils.markdown import hide_link
|
||||
|
||||
from bot import bot
|
||||
|
||||
__all__ = ("hidden_admins_message",)
|
||||
|
||||
|
||||
async def hidden_admins_message(message: Message,
|
||||
text: str = "") -> str:
|
||||
"""
|
||||
Формирует текст с упоминанием всех админов через скрытые ссылки.
|
||||
"""
|
||||
admins = await bot.get_chat_administrators(message.chat.id)
|
||||
|
||||
hidden_links: str = "".join(
|
||||
hide_link(f"tg://user?id={admin.user.id}")
|
||||
for admin in admins if not admin.user.is_bot
|
||||
)
|
||||
|
||||
return f"{hidden_links}{text}"
|
||||
Reference in New Issue
Block a user