diff --git a/classes/holo_user.py b/classes/holo_user.py index eeba107..7e423dd 100644 --- a/classes/holo_user.py +++ b/classes/holo_user.py @@ -498,6 +498,9 @@ class HoloUser(): await msg.reply_text(locale(f"sponsor{stage+1}", "message", locale=self.locale), reply_markup=ForceReply(placeholder=str(locale(f"sponsor{stage+1}", "force_reply", locale=self.locale)))) elif stage == 4: + if len(query) > 16: + await msg.reply_text(locale("label_too_long", "message")) + return progress["sponsorship"]["label"] = query col_tmp.update_one({"user": {"$eq": self.id}, "type": {"$eq": "sponsorship"}}, {"$set": {"sponsorship": progress["sponsorship"], "complete": True}}) await msg.reply_text("Sponsorship application is filled. Want to send it?", reply_markup=ReplyKeyboardMarkup(locale("confirm", "keyboard", locale=self.locale), resize_keyboard=True)) diff --git a/locale/uk.json b/locale/uk.json index 1a4e63c..292964f 100644 --- a/locale/uk.json +++ b/locale/uk.json @@ -87,6 +87,7 @@ "joined_false_link": "Користувач **{0}** (`{1}`) приєднався до групи не за своїм посиланням", "sponsorships_expires": "⚠️ **Нагадування**\nНадана платна підписка припинить діяти **за {0} д**. Будь ласка, оновіть дані про неї командою /sponsorship інакше роль буде втрачено!", "sponsorships_expired": "⚠️ **Нагадування**\nТермін дії вказаної підписки сплив. Для повторного отримання ролі користуйся командою /sponsorship.", + "label_too_long": "Довжина назви ролі не повинна перевищувати 16 символів", "voice_message": [ "why are u gae", "руки відірвало? пиши як людина", diff --git a/modules/callbacks/sponsorship.py b/modules/callbacks/sponsorship.py index ad52f1f..43e6cca 100644 --- a/modules/callbacks/sponsorship.py +++ b/modules/callbacks/sponsorship.py @@ -34,7 +34,7 @@ async def callback_query_sponsor_yes(app, clb): logWrite(f"User {holo_user.id} got approved by {clb.from_user.id}") if col_sponsorships.find_one({"user": holo_user.id}) is not None: - col_sponsorships.update_one({"date": {"$eq": datetime.now()}, "admin": {"$eq": clb.from_user.id}, "sponsorship": {"$eq": col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]}}) + col_sponsorships.update_one({"user": holo_user.id}, {"date": {"$eq": datetime.now()}, "admin": {"$eq": clb.from_user.id}, "sponsorship": {"$eq": col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]}}) else: col_sponsorships.insert_one({"user": holo_user.id, "date": datetime.now(), "admin": clb.from_user.id, "sponsorship": col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]}) diff --git a/modules/commands/label.py b/modules/commands/label.py index 5a3edcd..d871b47 100644 --- a/modules/commands/label.py +++ b/modules/commands/label.py @@ -1,6 +1,6 @@ from app import app, isAnAdmin from pyrogram import filters -from modules.utils import should_quote, find_user +from modules.utils import locale, should_quote, find_user from classes.holo_user import HoloUser @app.on_message(~ filters.scheduled & filters.private & filters.command(["label"], prefixes=["/"])) @@ -25,6 +25,9 @@ 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: + await msg.reply_text(locale("label_too_long", "message")) + return await target.set_label(msg.chat, label) await msg.reply_text(f"Setting **{target.id}**'s label to **{label}**...", quote=should_quote(msg))