/nearby, subscriptions check, geocoding #2

Merged
profitroll merged 30 commits from dev into master 2023-01-02 12:16:38 +02:00
2 changed files with 8 additions and 5 deletions
Showing only changes of commit eecb71a91e - Show all commits

View File

@ -286,7 +286,7 @@ class HoloUser():
raise LabelTooLongError(label) raise LabelTooLongError(label)
self.label = label self.label = label
self.set("label", label) self.set("label", label)
await app.promote_chat_member(configGet("destination_group"), self.id) 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): if not await isAnAdmin(self.id):
await app.set_administrator_title(configGet("destination_group"), self.id, label) await app.set_administrator_title(configGet("destination_group"), self.id, label)
@ -301,7 +301,9 @@ class HoloUser():
await app.set_administrator_title(configGet("destination_group"), self.id, "") await app.set_administrator_title(configGet("destination_group"), self.id, "")
if not await isAnAdmin(self.id): if not await isAnAdmin(self.id):
await app.promote_chat_member(configGet("destination_group"), self.id, privileges=ChatPrivileges( await app.promote_chat_member(configGet("destination_group"), self.id, privileges=ChatPrivileges(
can_manage_chat=False can_manage_chat=False,
can_pin_messages=False,
can_manage_video_chats=False
)) ))
def application_state(self) -> tuple[Literal["none", "fill", "approved", "rejected"], bool]: def application_state(self) -> tuple[Literal["none", "fill", "approved", "rejected"], bool]:

View File

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