Compare commits
6 Commits
bcaf80e2e1
...
v1.1
Author | SHA1 | Date | |
---|---|---|---|
234b73add0 | |||
f4fb85f7a4 | |||
4fba305b05 | |||
68c7cc0ada | |||
79304816b0 | |||
2cfa5a8f8d |
@@ -1,5 +1,4 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from asyncio import sleep
|
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
from app import app, isAnAdmin
|
from app import app, isAnAdmin
|
||||||
from typing import Any, List, Literal, Union
|
from typing import Any, List, Literal, Union
|
||||||
@@ -124,11 +123,11 @@ class HoloUser():
|
|||||||
|
|
||||||
# Check if any text available and log message sending
|
# Check if any text available and log message sending
|
||||||
if text is not None:
|
if text is not None:
|
||||||
logWrite(f"{context.from_user.id} sent message '{text}' to {self.id} (source message: {context.id})")
|
logWrite(f"{context.from_user.id} sent message '{text}' to {self.id}")
|
||||||
elif caption is not None:
|
elif caption is not None:
|
||||||
logWrite(f"{context.from_user.id} sent message '{caption}' to {self.id} (source message: {context.id})")
|
logWrite(f"{context.from_user.id} sent message '{caption}' to {self.id}")
|
||||||
else:
|
else:
|
||||||
logWrite(f"{context.from_user.id} sent message to {self.id} (source message: {context.id})")
|
logWrite(f"{context.from_user.id} sent message to {self.id}")
|
||||||
|
|
||||||
# Add notices for admin or user
|
# Add notices for admin or user
|
||||||
if text is not None:
|
if text is not None:
|
||||||
@@ -165,7 +164,7 @@ class HoloUser():
|
|||||||
elif file is not None:
|
elif file is not None:
|
||||||
if isinstance(file, Document):
|
if isinstance(file, Document):
|
||||||
file = file.file_id
|
file = file.file_id
|
||||||
new_message = await origin.reply_cached_media(file, caption=caption, quote=True)
|
new_message = await origin.reply_document(file, caption=caption, quote=True)
|
||||||
elif animation is not None:
|
elif animation is not None:
|
||||||
if isinstance(animation, Animation):
|
if isinstance(animation, Animation):
|
||||||
animation = animation.file_id
|
animation = animation.file_id
|
||||||
@@ -190,7 +189,7 @@ class HoloUser():
|
|||||||
elif file is not None:
|
elif file is not None:
|
||||||
if isinstance(file, Document):
|
if isinstance(file, Document):
|
||||||
file = file.file_id
|
file = file.file_id
|
||||||
new_message = await app.send_cached_media(self.id, file, caption=caption)
|
new_message = await app.send_document(self.id, file, caption=caption)
|
||||||
elif animation is not None:
|
elif animation is not None:
|
||||||
if isinstance(animation, Animation):
|
if isinstance(animation, Animation):
|
||||||
animation = animation.file_id
|
animation = animation.file_id
|
||||||
@@ -228,7 +227,6 @@ class HoloUser():
|
|||||||
try:
|
try:
|
||||||
await app.promote_chat_member(configGet("users", "groups"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True))
|
await app.promote_chat_member(configGet("users", "groups"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True))
|
||||||
if not await isAnAdmin(self.id):
|
if not await isAnAdmin(self.id):
|
||||||
await sleep(0.5)
|
|
||||||
await app.set_administrator_title(configGet("users", "groups"), self.id, label)
|
await app.set_administrator_title(configGet("users", "groups"), self.id, label)
|
||||||
self.set("label", label)
|
self.set("label", label)
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
|
@@ -33,13 +33,13 @@ async def cmd_start(app: Client, msg: Message):
|
|||||||
try:
|
try:
|
||||||
spoiler = col_spoilers.find_one( {"_id": ObjectId(msg.command[1])} )
|
spoiler = col_spoilers.find_one( {"_id": ObjectId(msg.command[1])} )
|
||||||
if spoiler["photo"] is not None:
|
if spoiler["photo"] is not None:
|
||||||
await msg.reply_cached_media(spoiler["photo"], caption=spoiler["caption"])
|
await msg.reply_document(spoiler["photo"], caption=spoiler["caption"])
|
||||||
if spoiler["video"] is not None:
|
if spoiler["video"] is not None:
|
||||||
await msg.reply_cached_media(spoiler["video"], caption=spoiler["caption"])
|
await msg.reply_cached_media(spoiler["video"], caption=spoiler["caption"])
|
||||||
if spoiler["animation"] is not None:
|
if spoiler["animation"] is not None:
|
||||||
await msg.reply_cached_media(spoiler["animation"], caption=spoiler["caption"])
|
await msg.reply_cached_media(spoiler["animation"], caption=spoiler["caption"])
|
||||||
if spoiler["document"] is not None:
|
if spoiler["document"] is not None:
|
||||||
await msg.reply_cached_media(spoiler["document"], caption=spoiler["caption"])
|
await msg.reply_document(spoiler["document"], caption=spoiler["caption"])
|
||||||
if spoiler["text"] is not None:
|
if spoiler["text"] is not None:
|
||||||
await msg.reply_text(spoiler["text"])
|
await msg.reply_text(spoiler["text"])
|
||||||
except InvalidId:
|
except InvalidId:
|
||||||
|
@@ -117,7 +117,7 @@ async def confirm_yes(app: Client, msg: Message, kind: Literal["application", "s
|
|||||||
else:
|
else:
|
||||||
sponsorship_content.append(f"{locale(f'question_{question}', 'message', 'sponsor_titles')} {tmp_sponsorship['sponsorship'][question]}")
|
sponsorship_content.append(f"{locale(f'question_{question}', 'message', 'sponsor_titles')} {tmp_sponsorship['sponsorship'][question]}")
|
||||||
|
|
||||||
await app.send_cached_media(configGet("admin", "groups"), tmp_sponsorship["sponsorship"]["proof"], caption=(locale("sponsor_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(sponsorship_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup(
|
await app.send_cached_media(chat_id=configGet("admin", "groups"), photo=tmp_sponsorship["sponsorship"]["proof"], caption=(locale("sponsor_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(sponsorship_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup(
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(text=str(locale("sponsor_yes", "button")), callback_data=f"sponsor_yes_{holo_user.id}")
|
InlineKeyboardButton(text=str(locale("sponsor_yes", "button")), callback_data=f"sponsor_yes_{holo_user.id}")
|
||||||
|
Reference in New Issue
Block a user