First commit
This commit is contained in:
39
userbot/client.py
Normal file
39
userbot/client.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from pyrogram import Client, types
|
||||
from configs import UserIn
|
||||
|
||||
userbot = Client(
|
||||
name="premium_user",
|
||||
api_id=UserIn.TG_API_UID,
|
||||
api_hash=UserIn.TG_API_HASH,
|
||||
session_string=UserIn.SESSION_STRING
|
||||
)
|
||||
|
||||
async def userbot_send_message(chat_id: int | str, text: str, parse_mode: str | None = None) -> types.Message:
|
||||
"""
|
||||
Отправка сообщения от имени Premium-аккаунта.
|
||||
Поддерживает premium emoji, HTML и Markdown форматирование.
|
||||
"""
|
||||
if not userbot.is_connected:
|
||||
await userbot.start()
|
||||
|
||||
log.info(f"📤 Отправка сообщения через Premium user в {chat_id}")
|
||||
return await userbot.send_message(
|
||||
chat_id=chat_id,
|
||||
text=text,
|
||||
parse_mode=parse_mode
|
||||
)
|
||||
|
||||
async def userbot_edit_message(chat_id: int | str, message_id: int, text: str, parse_mode: str | None = None) -> types.Message:
|
||||
"""
|
||||
Редактирование сообщения от имени Premium-аккаунта.
|
||||
"""
|
||||
if not userbot.is_connected:
|
||||
await userbot.start()
|
||||
|
||||
log.info(f"✏️ Редактирование сообщения {message_id} в чате {chat_id}")
|
||||
return await userbot.edit_message_text(
|
||||
chat_id=chat_id,
|
||||
message_id=message_id,
|
||||
text=text,
|
||||
parse_mode=parse_mode
|
||||
)
|
||||
Reference in New Issue
Block a user