Removed legacy, fixed some bugs, improved spoilers #6
@ -6,9 +6,11 @@ from modules.utils import should_quote, logWrite, locale
|
|||||||
from modules.database import col_tmp, col_spoilers
|
from modules.database import col_tmp, col_spoilers
|
||||||
from modules import custom_filters
|
from modules import custom_filters
|
||||||
|
|
||||||
|
# Cancel command ===============================================================================================================
|
||||||
@app.on_message((custom_filters.enabled_applications | custom_filters.enabled_sponsorships) & ~filters.scheduled & filters.command("cancel", prefixes=["/"]))
|
@app.on_message((custom_filters.enabled_applications | custom_filters.enabled_sponsorships) & ~filters.scheduled & filters.command("cancel", prefixes=["/"]))
|
||||||
async def command_cancel(app: Client, msg: Message):
|
async def command_cancel(app: Client, msg: Message):
|
||||||
col_tmp.delete_many( {"user": msg.from_user.id} )
|
col_tmp.delete_many( {"user": msg.from_user.id} )
|
||||||
col_spoilers.delete_many( {"user": msg.from_user.id, "completed": False} )
|
col_spoilers.delete_many( {"user": msg.from_user.id, "completed": False} )
|
||||||
await msg.reply_text(locale("cancel", "message", locale=msg.from_user), quote=should_quote(msg))
|
await msg.reply_text(locale("cancel", "message", locale=msg.from_user), quote=should_quote(msg))
|
||||||
logWrite(f"Cancelling all ongoing tmp operations for {msg.from_user.id}")
|
logWrite(f"Cancelling all ongoing tmp operations for {msg.from_user.id}")
|
||||||
|
# ==============================================================================================================================
|
@ -9,8 +9,9 @@ from classes.holo_user import HoloUser, UserNotFoundError, UserInvalidError
|
|||||||
from modules.utils import jsonLoad, should_quote, logWrite, locale, download_tmp, create_tmp, find_user
|
from modules.utils import jsonLoad, should_quote, logWrite, locale, download_tmp, create_tmp, find_user
|
||||||
from modules import custom_filters
|
from modules import custom_filters
|
||||||
|
|
||||||
|
# Identify command =============================================================================================================
|
||||||
@app.on_message((custom_filters.enabled_applications | custom_filters.enabled_sponsorships) & ~filters.scheduled & filters.command("identify", prefixes=["/"]) & custom_filters.admin)
|
@app.on_message((custom_filters.enabled_applications | custom_filters.enabled_sponsorships) & ~filters.scheduled & filters.command("identify", prefixes=["/"]) & custom_filters.admin)
|
||||||
async def command_identify(app: Client, msg: Message):
|
async def cmd_identify(app: Client, msg: Message):
|
||||||
|
|
||||||
if len(msg.command) != 2:
|
if len(msg.command) != 2:
|
||||||
await msg.reply_text(locale("identify_invalid_syntax", "message", locale=msg.from_user))
|
await msg.reply_text(locale("identify_invalid_syntax", "message", locale=msg.from_user))
|
||||||
@ -60,4 +61,5 @@ async def command_identify(app: Client, msg: Message):
|
|||||||
quote=should_quote(msg)
|
quote=should_quote(msg)
|
||||||
)
|
)
|
||||||
|
|
||||||
logWrite(f"User {msg.from_user.id} identified user {holo_user.id}")
|
logWrite(f"User {msg.from_user.id} identified user {holo_user.id}")
|
||||||
|
# ==============================================================================================================================
|
@ -6,6 +6,7 @@ from modules.utils import locale, should_quote, find_user
|
|||||||
from classes.holo_user import HoloUser, LabelTooLongError
|
from classes.holo_user import HoloUser, LabelTooLongError
|
||||||
from modules import custom_filters
|
from modules import custom_filters
|
||||||
|
|
||||||
|
# Label command ================================================================================================================
|
||||||
@app.on_message(custom_filters.enabled_applications & ~filters.scheduled & filters.command(["label"], prefixes=["/"]) & custom_filters.admin)
|
@app.on_message(custom_filters.enabled_applications & ~filters.scheduled & filters.command(["label"], prefixes=["/"]) & custom_filters.admin)
|
||||||
async def cmd_label(app: Client, msg: Message):
|
async def cmd_label(app: Client, msg: Message):
|
||||||
|
|
||||||
@ -34,4 +35,5 @@ async def cmd_label(app: Client, msg: Message):
|
|||||||
await msg.reply_text(f"Setting **{target.id}**'s label to **{label}**...", quote=should_quote(msg))
|
await msg.reply_text(f"Setting **{target.id}**'s label to **{label}**...", quote=should_quote(msg))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await msg.reply_text(f"User not found")
|
await msg.reply_text(f"User not found")
|
||||||
|
# ==============================================================================================================================
|
@ -9,9 +9,9 @@ from modules import custom_filters
|
|||||||
|
|
||||||
pid = getpid()
|
pid = getpid()
|
||||||
|
|
||||||
# Shutdown command =============================================================================================================
|
# Reset commands command =======================================================================================================
|
||||||
@app.on_message(custom_filters.enabled_general & ~filters.scheduled & filters.private & filters.command(["resetcommands"], prefixes=["/"]) & custom_filters.admin)
|
@app.on_message(custom_filters.enabled_general & ~filters.scheduled & filters.private & filters.command(["resetcommands"], prefixes=["/"]) & custom_filters.admin)
|
||||||
async def cmd_kill(app: Client, msg: Message):
|
async def cmd_resetcommands(app: Client, msg: Message):
|
||||||
|
|
||||||
if msg.from_user.id == configGet("owner"):
|
if msg.from_user.id == configGet("owner"):
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user