From 3fd56e8b41c33df557557db1083e13eb9fa2e42e Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Wed, 4 Jan 2023 19:59:09 +0100 Subject: [PATCH] Fixed a typo in config keys --- classes/holo_user.py | 8 ++++---- modules/callbacks/reapply.py | 4 ++-- modules/callbacks/sponsorship.py | 2 +- modules/callbacks/sub.py | 4 ++-- modules/callbacks/sus.py | 4 ++-- modules/commands/application.py | 2 +- modules/commands/nearby.py | 2 +- modules/commands/reapply.py | 2 +- modules/commands/warn.py | 2 +- modules/commands/warnings.py | 2 +- modules/handlers/everything.py | 2 +- modules/handlers/group_join.py | 4 ++-- modules/handlers/voice.py | 2 +- modules/inline.py | 2 +- modules/scheduled.py | 8 ++++---- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/classes/holo_user.py b/classes/holo_user.py index d0a4537..d8f5ef8 100644 --- a/classes/holo_user.py +++ b/classes/holo_user.py @@ -284,9 +284,9 @@ class HoloUser(): raise LabelTooLongError(label) self.label = label try: - await app.promote_chat_member(configGet("admin", "users"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True)) + await app.promote_chat_member(configGet("users", "groups"), 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("admin", "users"), self.id, label) + await app.set_administrator_title(configGet("users", "groups"), 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") @@ -301,9 +301,9 @@ class HoloUser(): """ self.label = "" self.set("label", "") - await app.set_administrator_title(configGet("admin", "users"), self.id, "") + await app.set_administrator_title(configGet("users", "groups"), self.id, "") if not await isAnAdmin(self.id): - await app.promote_chat_member(configGet("admin", "users"), self.id, privileges=ChatPrivileges( + await app.promote_chat_member(configGet("users", "groups"), self.id, privileges=ChatPrivileges( can_manage_chat=False, can_pin_messages=False, can_manage_video_chats=False diff --git a/modules/callbacks/reapply.py b/modules/callbacks/reapply.py index 7cc599f..3f6a523 100644 --- a/modules/callbacks/reapply.py +++ b/modules/callbacks/reapply.py @@ -32,12 +32,12 @@ async def callback_reapply_query_accept(app: Client, clb: CallbackQuery): need_link = True - async for member in app.get_chat_members(configGet("admin", "users")): + async for member in app.get_chat_members(configGet("users", "groups")): if member.user.id == holo_user.id: need_link = False if need_link: - link = await app.create_chat_invite_link(configGet("admin", "users"), name=f"Invite for {holo_user.id}", member_limit=1) #, expire_date=datetime.now()+timedelta(days=1)) + link = await app.create_chat_invite_link(configGet("users", "groups"), name=f"Invite for {holo_user.id}", member_limit=1) #, expire_date=datetime.now()+timedelta(days=1)) await app.send_message(holo_user.id, locale("read_rules", "message", locale=holo_user)) diff --git a/modules/callbacks/sponsorship.py b/modules/callbacks/sponsorship.py index 37cc5bb..429aa2b 100644 --- a/modules/callbacks/sponsorship.py +++ b/modules/callbacks/sponsorship.py @@ -67,7 +67,7 @@ async def callback_query_sponsor_yes(app: Client, clb: CallbackQuery): } ) - await holo_user.label_set(configGet("admin", "users"), col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]["label"]) + await holo_user.label_set(configGet("users", "groups"), col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]["label"]) edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]] diff --git a/modules/callbacks/sub.py b/modules/callbacks/sub.py index b35b8fa..eb76d06 100644 --- a/modules/callbacks/sub.py +++ b/modules/callbacks/sub.py @@ -20,12 +20,12 @@ async def callback_query_accept(app: Client, clb: CallbackQuery): need_link = True - async for member in app.get_chat_members(configGet("admin", "users")): + async for member in app.get_chat_members(configGet("users", "groups")): if member.user.id == holo_user.id: need_link = False if need_link: - link = await app.create_chat_invite_link(configGet("admin", "users"), name=f"Invite for {holo_user.id}", member_limit=1) #, expire_date=datetime.now()+timedelta(days=1)) + link = await app.create_chat_invite_link(configGet("users", "groups"), name=f"Invite for {holo_user.id}", member_limit=1) #, expire_date=datetime.now()+timedelta(days=1)) await app.send_message(holo_user.id, locale("read_rules", "message", locale=holo_user)) diff --git a/modules/callbacks/sus.py b/modules/callbacks/sus.py index b768448..a01da45 100644 --- a/modules/callbacks/sus.py +++ b/modules/callbacks/sus.py @@ -21,7 +21,7 @@ async def callback_query_sus_allow(app: Client, clb: CallbackQuery): await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup)) await clb.answer(text=locale("sus_allowed", "callback", locale=clb.from_user).format(holo_user.id), show_alert=True) - await app.restrict_chat_member(configGet("admin", "users"), holo_user.id, permissions=ChatPermissions( + await app.restrict_chat_member(configGet("users", "groups"), holo_user.id, permissions=ChatPermissions( can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, @@ -43,7 +43,7 @@ async def callback_query_sus_reject(app: Client, clb: CallbackQuery): await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup)) await clb.answer(text=locale("sus_rejected", "callback", locale=clb.from_user).format(holo_user.id), show_alert=True) - await app.ban_chat_member(configGet("admin", "users"), holo_user.id) + await app.ban_chat_member(configGet("users", "groups"), holo_user.id) col_tmp.update_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "application"}}, {"$set": {"state": "rejected", "sent": False}}) # ============================================================================================================================== \ No newline at end of file diff --git a/modules/commands/application.py b/modules/commands/application.py index 9e245f0..46b0122 100644 --- a/modules/commands/application.py +++ b/modules/commands/application.py @@ -60,7 +60,7 @@ async def cmd_application(app: Client, msg: Message): # user_id = int(msg.command[1]) # else: # list_of_users = [] - # async for m in app.get_chat_members(configGet("admin", "users"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): + # async for m in app.get_chat_members(configGet("users", "groups"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): # list_of_users.append(m) # user_id = list_of_users[0].user.id # try: diff --git a/modules/commands/nearby.py b/modules/commands/nearby.py index f9c0275..6ef09de 100644 --- a/modules/commands/nearby.py +++ b/modules/commands/nearby.py @@ -11,7 +11,7 @@ from modules.database import col_applications, col_users from classes.errors.geo import PlaceNotFoundError # Nearby command =============================================================================================================== -@app.on_message(custom_filters.enabled_applications & ~filters.scheduled & (filters.private | (filters.chat(configGet("admin", "groups")) | filters.chat(configGet("admin", "users")))) & filters.command(["nearby"], prefixes=["/"]) & (custom_filters.allowed | custom_filters.admin)) +@app.on_message(custom_filters.enabled_applications & ~filters.scheduled & (filters.private | (filters.chat(configGet("admin", "groups")) | filters.chat(configGet("users", "groups")))) & filters.command(["nearby"], prefixes=["/"]) & (custom_filters.allowed | custom_filters.admin)) async def cmd_nearby(app: Client, msg: Message): holo_user = HoloUser(msg.from_user) diff --git a/modules/commands/reapply.py b/modules/commands/reapply.py index 301113d..35f7467 100644 --- a/modules/commands/reapply.py +++ b/modules/commands/reapply.py @@ -22,7 +22,7 @@ async def cmd_reapply(app: Client, msg: Message): left_chat = True - async for member in app.get_chat_members(configGet("admin", "users")): + async for member in app.get_chat_members(configGet("users", "groups")): if member.user.id == msg.from_user.id: left_chat = False diff --git a/modules/commands/warn.py b/modules/commands/warn.py index 8f4a771..3482eaf 100644 --- a/modules/commands/warn.py +++ b/modules/commands/warn.py @@ -11,7 +11,7 @@ from modules import custom_filters @app.on_message(custom_filters.enabled_warnings & ~filters.scheduled & filters.command(["warn"], prefixes=["/"]) & custom_filters.admin) async def cmd_warn(app: Client, msg: Message): - if msg.chat.id == configGet("admin", "users"): + if msg.chat.id == configGet("users", "groups"): if msg.reply_to_message_id != None: message = " ".join(msg.command[1:]) if len(msg.command) > 1 else "" col_warnings.insert_one({"user": msg.reply_to_message.from_user.id, "admin": msg.from_user.id, "date": datetime.now(), "reason": message}) diff --git a/modules/commands/warnings.py b/modules/commands/warnings.py index 3323093..a25e734 100644 --- a/modules/commands/warnings.py +++ b/modules/commands/warnings.py @@ -21,7 +21,7 @@ async def cmd_warnings(app: Client, msg: Message): target_name = user_db["tg_name"] except: list_of_users = [] - async for m in app.get_chat_members(configGet("admin", "users"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): + async for m in app.get_chat_members(configGet("users", "groups"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): list_of_users.append(m) if len(list_of_users) != 0: diff --git a/modules/handlers/everything.py b/modules/handlers/everything.py index fc834f4..f2b2273 100644 --- a/modules/handlers/everything.py +++ b/modules/handlers/everything.py @@ -120,7 +120,7 @@ async def any_stage(app: Client, msg: Message): @app.on_message(~ filters.scheduled & filters.group) async def message_in_group(app: Client, msg: Message): if (msg.chat is not None) and (msg.via_bot is not None): - if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("admin", "users")): + if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("users", "groups")): if configGet("remove_application_time") > 0: logWrite(f"User {msg.from_user.id} requested application in destination group, removing in {configGet('remove_application_time')} minutes") await asyncio.sleep(configGet("remove_application_time")*60) diff --git a/modules/handlers/group_join.py b/modules/handlers/group_join.py index 3ac1119..2ee00a6 100644 --- a/modules/handlers/group_join.py +++ b/modules/handlers/group_join.py @@ -7,8 +7,8 @@ from classes.holo_user import HoloUser from modules import custom_filters # Filter users on join ========================================================================================================= -@app.on_chat_member_updated(custom_filters.enabled_invites_check, group=configGet("admin", "users")) -#@app.on_message(filters.new_chat_members, group=configGet("admin", "users")) +@app.on_chat_member_updated(custom_filters.enabled_invites_check, group=configGet("users", "groups")) +#@app.on_message(filters.new_chat_members, group=configGet("users", "groups")) async def filter_join(app: Client, member: ChatMemberUpdated): if member.invite_link != None: diff --git a/modules/handlers/voice.py b/modules/handlers/voice.py index f39dd22..abdb4ac 100644 --- a/modules/handlers/voice.py +++ b/modules/handlers/voice.py @@ -7,7 +7,7 @@ from modules.logging import logWrite from modules.utils import configGet, locale from modules import custom_filters -@app.on_message(custom_filters.enabled_dinovoice & ~filters.scheduled & filters.voice & filters.chat(configGet("admin", "users"))) +@app.on_message(custom_filters.enabled_dinovoice & ~filters.scheduled & filters.voice & filters.chat(configGet("users", "groups"))) async def voice_message(app: Client, msg: Message): logWrite(f"User {msg.from_user.id} sent voice message in destination group") await msg.reply_text(choice(locale("voice_message", "message"))) \ No newline at end of file diff --git a/modules/inline.py b/modules/inline.py index 45e25aa..2f30ac2 100644 --- a/modules/inline.py +++ b/modules/inline.py @@ -84,7 +84,7 @@ async def inline_answer(client: Client, inline_query: InlineQuery): max_results = configGet("inline_preview_count") if inline_query.query != "" else 200 list_of_users = [] - async for m in app.get_chat_members(configGet("admin", "users"), limit=max_results, filter=ChatMembersFilter.SEARCH, query=inline_query.query): + async for m in app.get_chat_members(configGet("users", "groups"), limit=max_results, filter=ChatMembersFilter.SEARCH, query=inline_query.query): list_of_users.append(m) for match in list_of_users: diff --git a/modules/scheduled.py b/modules/scheduled.py index 0bcccd6..b5f954f 100644 --- a/modules/scheduled.py +++ b/modules/scheduled.py @@ -19,7 +19,7 @@ if configGet("enabled", "scheduler", "cache_members"): @scheduler.scheduled_job(trigger="interval", seconds=configGet("interval", "scheduler", "cache_members")) async def cache_group_members(): list_of_users = [] - async for member in app.get_chat_members(configGet("admin", "users")): + async for member in app.get_chat_members(configGet("users", "groups")): list_of_users.append(member.user.id) makedirs("cache", exist_ok=True) jsonSave(list_of_users, path.join(configGet("cache", "locations"), "group_members")) @@ -39,7 +39,7 @@ if configGet("enabled", "scheduler", "cache_avatars"): @scheduler.scheduled_job(trigger="interval", hours=configGet("interval", "scheduler", "cache_avatars")) async def cache_avatars(): list_of_users = [] - async for member in app.get_chat_members(configGet("admin", "users"), filter=ChatMembersFilter.SEARCH, query=""): + async for member in app.get_chat_members(configGet("users", "groups"), filter=ChatMembersFilter.SEARCH, query=""): list_of_users.append(member.user) for user in list_of_users: if user.photo != None: @@ -84,7 +84,7 @@ if configGet("enabled", "features", "sponsorships") is True: try: holo_user = HoloUser(entry["user"]) await app.send_message( entry["user"], locale("sponsorships_expired", "message") ) # type: ignore - await holo_user.label_reset(configGet("admin", "users")) + await holo_user.label_reset(configGet("users", "groups")) col_sponsorships.find_one_and_delete({"user": holo_user.id}) try: tg_user = await app.get_users(entry["user"]) @@ -172,7 +172,7 @@ async def commands_register(): # Registering destination group commands try: - await app.set_bot_commands(commands["group_users"], scope=BotCommandScopeChat(chat_id=configGet("admin", "users"))) + await app.set_bot_commands(commands["group_users"], scope=BotCommandScopeChat(chat_id=configGet("users", "groups"))) logWrite("Registered destination group commands") except bad_request_400.ChannelInvalid: logWrite(f"Could not register commands for destination group. Bot is likely not in the group.") \ No newline at end of file