diff --git a/README.md b/README.md index 76278f6..ece51c1 100644 --- a/README.md +++ b/README.md @@ -32,15 +32,16 @@ You can see config file with all the comments below: "locale": "uk", "debug": false, "owner": 0, - "bot_id": 0, "age_allowed": 0, "api": "http://example.com", "inline_preview_count": 7, - "admin_group": 0, - "destination_group": 0, "remove_application_time": -1, "search_radius": 50, "admins": [], + "groups": { + "admin": 0, + "users": 0 + }, "bot": { "api_id": 0, "api_hash": "", @@ -61,6 +62,9 @@ You can see config file with all the comments below: "location": "logs" }, "features": { + "general": { + "enabled": true + }, "applications": { "enabled": true }, diff --git a/app.py b/app.py index 0c1e383..59f33a3 100644 --- a/app.py +++ b/app.py @@ -22,7 +22,7 @@ async def isAnAdmin(admin_id): # Check if user is in admin group try: - async for member in app.get_chat_members(configGet("admin_group")): + async for member in app.get_chat_members(configGet("admin", "groups")): if member.user.id == admin_id: return True except bad_request_400.ChannelInvalid: diff --git a/classes/holo_user.py b/classes/holo_user.py index 1757a31..0c719a9 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("destination_group"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True)) + await app.promote_chat_member(configGet("admin", "users"), 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) + await app.set_administrator_title(configGet("admin", "users"), 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("destination_group"), self.id, "") + await app.set_administrator_title(configGet("admin", "users"), 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("admin", "users"), self.id, privileges=ChatPrivileges( can_manage_chat=False, can_pin_messages=False, can_manage_video_chats=False diff --git a/config_example.json b/config_example.json index 2dc555a..34751e0 100644 --- a/config_example.json +++ b/config_example.json @@ -5,11 +5,13 @@ "age_allowed": 0, "api": "http://example.com", "inline_preview_count": 7, - "admin_group": 0, - "destination_group": 0, "remove_application_time": -1, "search_radius": 50, "admins": [], + "groups": { + "admin": 0, + "users": 0 + }, "bot": { "api_id": 0, "api_hash": "", diff --git a/modules/callbacks/reapply.py b/modules/callbacks/reapply.py index b3c8141..7cc599f 100644 --- a/modules/callbacks/reapply.py +++ b/modules/callbacks/reapply.py @@ -16,7 +16,7 @@ async def callback_reapply_query_accept(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("approved_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("approved_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) logWrite(f"User {holo_user.id} got their reapplication approved by {clb.from_user.id}") await app.send_message(holo_user.id, locale("approved_joined", "message", locale=holo_user)) @@ -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("destination_group")): + async for member in app.get_chat_members(configGet("admin", "users")): if member.user.id == holo_user.id: need_link = False if need_link: - link = await app.create_chat_invite_link(configGet("destination_group"), 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("admin", "users"), 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)) @@ -62,7 +62,7 @@ async def callback_query_reapply_reject(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("rejected_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("rejected_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) await app.send_message(holo_user.id, locale("rejected", "message", locale=holo_user)) logWrite(f"User {fullclb[2]} got their reapplication rejected by {clb.from_user.id}") diff --git a/modules/callbacks/sponsorship.py b/modules/callbacks/sponsorship.py index 910a5f6..37cc5bb 100644 --- a/modules/callbacks/sponsorship.py +++ b/modules/callbacks/sponsorship.py @@ -34,7 +34,7 @@ async def callback_query_sponsor_yes(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("sponsor_approved_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("sponsor_approved_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) await app.send_message(holo_user.id, locale("sponsor_approved", "message", locale=holo_user)) logWrite(f"User {holo_user.id} got sponsorship approved by {clb.from_user.id}") @@ -67,7 +67,7 @@ async def callback_query_sponsor_yes(app: Client, clb: CallbackQuery): } ) - await holo_user.label_set(configGet("destination_group"), col_tmp.find_one({"user": {"$eq": holo_user.id}, "type": {"$eq": "sponsorship"}})["sponsorship"]["label"]) + await holo_user.label_set(configGet("admin", "users"), 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")]] @@ -80,7 +80,7 @@ async def callback_query_sponsor_no(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("sponsor_rejected_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("sponsor_rejected_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) await app.send_message(holo_user.id, locale("sponsor_rejected", "message", locale=holo_user)) logWrite(f"User {holo_user.id} got sponsorship rejected by {clb.from_user.id}") diff --git a/modules/callbacks/sub.py b/modules/callbacks/sub.py index 9347798..b35b8fa 100644 --- a/modules/callbacks/sub.py +++ b/modules/callbacks/sub.py @@ -15,17 +15,17 @@ async def callback_query_accept(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("approved_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("approved_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) logWrite(f"User {holo_user.id} got approved by {clb.from_user.id}") need_link = True - async for member in app.get_chat_members(configGet("destination_group")): + async for member in app.get_chat_members(configGet("admin", "users")): if member.user.id == holo_user.id: need_link = False if need_link: - link = await app.create_chat_invite_link(configGet("destination_group"), 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("admin", "users"), 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)) @@ -57,7 +57,7 @@ async def callback_query_reject(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("rejected_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("rejected_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) await app.send_message(holo_user.id, locale("rejected", "message", locale=holo_user)) logWrite(f"User {holo_user.id} got rejected by {clb.from_user.id}") @@ -74,7 +74,7 @@ async def callback_query_reject_aggressive(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("rejected_by_agr", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("rejected_by_agr", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) await app.send_message(holo_user.id, locale("rejected_aggressive", "message", locale=holo_user)) logWrite(f"User {holo_user.id} got rejected by {clb.from_user.id} due to being aggressive") @@ -91,7 +91,7 @@ async def callback_query_reject_russian(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("rejected_by_rus", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("rejected_by_rus", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) await app.send_message(holo_user.id, locale("rejected_russian", "message", locale=holo_user)) logWrite(f"User {holo_user.id} got rejected by {clb.from_user.id} due to being russian") diff --git a/modules/callbacks/sus.py b/modules/callbacks/sus.py index ae37ca1..b768448 100644 --- a/modules/callbacks/sus.py +++ b/modules/callbacks/sus.py @@ -13,7 +13,7 @@ async def callback_query_sus_allow(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("sus_allowed_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("sus_allowed_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) logWrite(f"User {holo_user.id} was allowed to join with another link by {clb.from_user.id}") edited_markup = [[InlineKeyboardButton(text=str(locale("sus_allowed", "button")), callback_data="nothing")]] @@ -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("destination_group"), holo_user.id, permissions=ChatPermissions( + await app.restrict_chat_member(configGet("admin", "users"), holo_user.id, permissions=ChatPermissions( can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, @@ -35,7 +35,7 @@ async def callback_query_sus_reject(app: Client, clb: CallbackQuery): fullclb = clb.data.split("_") holo_user = HoloUser(int(fullclb[2])) - await app.send_message(configGet("admin_group"), locale("sus_rejected_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) + await app.send_message(configGet("admin", "groups"), locale("sus_rejected_by", "message").format(clb.from_user.first_name, holo_user.id), disable_notification=True) logWrite(f"User {holo_user.id} was rejected to join with another link by {clb.from_user.id}") edited_markup = [[InlineKeyboardButton(text=str(locale("sus_rejected", "button")), callback_data="nothing")]] @@ -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("destination_group"), holo_user.id) + await app.ban_chat_member(configGet("admin", "users"), 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 fc6556e..9e245f0 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("destination_group"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): + # async for m in app.get_chat_members(configGet("admin", "users"), 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 5d2d5c3..f9c0275 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_group")) | filters.chat(configGet("destination_group")))) & 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("admin", "users")))) & 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 7bd6d09..301113d 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("destination_group")): + async for member in app.get_chat_members(configGet("admin", "users")): if member.user.id == msg.from_user.id: left_chat = False diff --git a/modules/commands/warn.py b/modules/commands/warn.py index 6399212..8f4a771 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("destination_group"): + if msg.chat.id == configGet("admin", "users"): 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 03fccfc..3323093 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("destination_group"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): + async for m in app.get_chat_members(configGet("admin", "users"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]): list_of_users.append(m) if len(list_of_users) != 0: diff --git a/modules/handlers/confirmation.py b/modules/handlers/confirmation.py index b1c5fb7..76413d2 100644 --- a/modules/handlers/confirmation.py +++ b/modules/handlers/confirmation.py @@ -57,7 +57,7 @@ async def confirm_yes(app: Client, msg: Message, kind: Literal["application", "s i += 1 if tmp_application["reapply"]: - await app.send_message(chat_id=configGet("admin_group"), text=(locale("reapply_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(application_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( + await app.send_message(chat_id=configGet("admin", "groups"), text=(locale("reapply_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(application_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton(text=str(locale("reapply_yes", "button")), callback_data=f"reapply_yes_{holo_user.id}") @@ -69,7 +69,7 @@ async def confirm_yes(app: Client, msg: Message, kind: Literal["application", "s ) ) else: - await app.send_message(chat_id=configGet("admin_group"), text=(locale("application_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(application_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( + await app.send_message(chat_id=configGet("admin", "groups"), text=(locale("application_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(application_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton(text=str(locale("sub_yes", "button")), callback_data=f"sub_yes_{holo_user.id}") @@ -124,7 +124,7 @@ async def confirm_yes(app: Client, msg: Message, kind: Literal["application", "s else: sponsorship_content.append(f"{locale(f'question_{question}', 'message', 'sponsor_titles')} {tmp_sponsorship['sponsorship'][question]}") - await app.send_photo(chat_id=configGet("admin_group"), photo=f"tmp{sep}{filename}.jpg", caption=(locale("sponsor_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(sponsorship_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( + await app.send_photo(chat_id=configGet("admin", "groups"), photo=f"tmp{sep}{filename}.jpg", caption=(locale("sponsor_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(sponsorship_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton(text=str(locale("sponsor_yes", "button")), callback_data=f"sponsor_yes_{holo_user.id}") diff --git a/modules/handlers/everything.py b/modules/handlers/everything.py index 0297ad3..fc834f4 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("destination_group")): + if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("admin", "users")): 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 82adfda..3ac1119 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("destination_group")) -#@app.on_message(filters.new_chat_members, group=configGet("destination_group")) +@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")) async def filter_join(app: Client, member: ChatMemberUpdated): if member.invite_link != None: @@ -25,7 +25,7 @@ async def filter_join(app: Client, member: ChatMemberUpdated): logWrite(f"User {holo_user.id} joined destination group with stolen/unapproved link {holo_user.link}") - await app.send_message(configGet("admin_group"), locale("joined_false_link", "message").format(member.from_user.first_name, member.from_user.id), reply_markup=InlineKeyboardMarkup( + await app.send_message(configGet("admin", "groups"), locale("joined_false_link", "message").format(member.from_user.first_name, member.from_user.id), reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton(text=str(locale("sus_allow", "button")), callback_data=f"sus_allow_{member.from_user.id}") diff --git a/modules/handlers/voice.py b/modules/handlers/voice.py index 289fa03..f39dd22 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("destination_group"))) +@app.on_message(custom_filters.enabled_dinovoice & ~filters.scheduled & filters.voice & filters.chat(configGet("admin", "users"))) 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 0637c53..ac61ea9 100644 --- a/modules/inline.py +++ b/modules/inline.py @@ -51,7 +51,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("destination_group"), limit=max_results, filter=ChatMembersFilter.SEARCH, query=inline_query.query): + async for m in app.get_chat_members(configGet("admin", "users"), limit=max_results, filter=ChatMembersFilter.SEARCH, query=inline_query.query): list_of_users.append(m) results = [] diff --git a/modules/scheduled.py b/modules/scheduled.py index a012490..0bcccd6 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("destination_group")): + async for member in app.get_chat_members(configGet("admin", "users")): list_of_users.append(member.user.id) makedirs("cache", exist_ok=True) jsonSave(list_of_users, path.join(configGet("cache", "locations"), "group_members")) @@ -28,7 +28,7 @@ if configGet("enabled", "scheduler", "cache_admins"): @scheduler.scheduled_job(trigger="interval", seconds=configGet("interval", "scheduler", "cache_admins")) async def cache_admins(): list_of_users = [] - async for member in app.get_chat_members(configGet("admin_group")): + async for member in app.get_chat_members(configGet("admin", "groups")): list_of_users.append(member.user.id) makedirs("cache", exist_ok=True) jsonSave(list_of_users, path.join(configGet("cache", "locations"), "admins")) @@ -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("destination_group"), filter=ChatMembersFilter.SEARCH, query=""): + async for member in app.get_chat_members(configGet("admin", "users"), filter=ChatMembersFilter.SEARCH, query=""): list_of_users.append(member.user) for user in list_of_users: if user.photo != None: @@ -58,7 +58,7 @@ if configGet("enabled", "features", "applications") is True: if entry["application"]["2"].strftime("%d.%m") == datetime.now().strftime("%d.%m"): try: tg_user = await app.get_users(entry["user"]) - await app.send_message( configGet("admin_group"), locale("birthday", "message").format(str(tg_user.first_name), str(tg_user.username), str(relativedelta(datetime.now(), entry["application"]["2"], '%d.%m.%Y').years)) ) # type: ignore + await app.send_message( configGet("admin", "groups"), locale("birthday", "message").format(str(tg_user.first_name), str(tg_user.username), str(relativedelta(datetime.now(), entry["application"]["2"], '%d.%m.%Y').years)) ) # type: ignore logWrite(f"Notified admins about {entry['user']}'s birthday") except Exception as exp: logWrite(f"Could not find user {entry['user']} to send a message about birthday due to '{exp}'") @@ -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("destination_group")) + await holo_user.label_reset(configGet("admin", "users")) col_sponsorships.find_one_and_delete({"user": holo_user.id}) try: tg_user = await app.get_users(entry["user"]) @@ -165,14 +165,14 @@ async def commands_register(): # Registering admin group commands try: - await app.set_bot_commands(commands["group_admins"], scope=BotCommandScopeChat(chat_id=configGet("admin_group"))) + await app.set_bot_commands(commands["group_admins"], scope=BotCommandScopeChat(chat_id=configGet("admin", "groups"))) logWrite("Registered admin group commands for default locale") except bad_request_400.ChannelInvalid: logWrite(f"Could not register commands for admin group. Bot is likely not in the group.") # Registering destination group commands try: - await app.set_bot_commands(commands["group_users"], scope=BotCommandScopeChat(chat_id=configGet("destination_group"))) + await app.set_bot_commands(commands["group_users"], scope=BotCommandScopeChat(chat_id=configGet("admin", "users"))) 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