Updated locale for sponsorship

This commit is contained in:
2023-01-02 14:19:35 +01:00
parent a82adc4d1f
commit ba13f36769
2 changed files with 16 additions and 8 deletions

View File

@@ -286,10 +286,15 @@ class HoloUser():
if len(label) > 16:
raise LabelTooLongError(label)
self.label = label
self.set("label", label)
await app.promote_chat_member(configGet("destination_group"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True))
if not await isAnAdmin(self.id):
await app.set_administrator_title(configGet("destination_group"), self.id, label)
try:
await app.promote_chat_member(configGet("destination_group"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True))
if not await isAnAdmin(self.id):
await app.set_administrator_title(configGet("destination_group"), self.id, label)
self.set("label", label)
except bad_request_400.UserCreator:
logWrite(f"Could not set {self.id}'s title to '{self.label}' because of bad_request_400.UserCreator")
except bad_request_400.ChatAdminRequired:
logWrite(f"Could not set {self.id}'s title to '{self.label}' because of bad_request_400.ChatAdminRequired")
async def label_reset(self, chat: Chat) -> None:
"""Reset label in destination group
@@ -346,6 +351,9 @@ class HoloUser():
if col_tmp.find_one({"user": self.id, "type": "application"}) is None:
if self.sponsorship_state()[0] == "fill":
return
col_tmp.insert_one(
document=DefaultApplicationTemp(self.id).dict
)
@@ -524,7 +532,7 @@ class HoloUser():
elif stage == 4:
if len(query) > 16:
await msg.reply_text(locale("label_too_long", "message"))
await msg.reply_text(locale("label_too_long", "message"), reply_markup=ForceReply(placeholder=str(locale("sponsor4", "force_reply", locale=self.locale))))
return
progress["sponsorship"]["label"] = query
col_tmp.update_one({"user": {"$eq": self.id}, "type": {"$eq": "sponsorship"}}, {"$set": {"sponsorship": progress["sponsorship"], "complete": True}})