Updated label_set

This commit is contained in:
Profitroll
2022-12-23 01:44:07 +01:00
parent 426b1550f6
commit eecb71a91e
2 changed files with 8 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
from app import app, isAnAdmin
from pyrogram import filters
from modules.utils import locale, should_quote, find_user
from classes.holo_user import HoloUser
from classes.holo_user import HoloUser, LabelTooLongError
@app.on_message(~ filters.scheduled & filters.private & filters.command(["label"], prefixes=["/"]))
async def cmd_label(app, msg):
@@ -25,10 +25,11 @@ async def cmd_label(app, msg):
await msg.reply_text(f"Resetting **{target.id}**'s label...", quote=should_quote(msg))
else:
if len(label) > 16:
try:
await target.label_set(msg.chat, label)
except LabelTooLongError:
await msg.reply_text(locale("label_too_long", "message"))
return
await target.label_set(msg.chat, label)
await msg.reply_text(f"Setting **{target.id}**'s label to **{label}**...", quote=should_quote(msg))
else: