| 103 | await message.reply("**⚙ Successfully join request cache deleted.**") |
| 104 | |
| 105 | async def is_subscribed(bot: Client, user_id: int): |
| 106 | missing = [] |
| 107 | expire_at = datetime.datetime.utcnow() + datetime.timedelta(minutes=Config.FSUB_EXPIRE) if Config.FSUB_EXPIRE > 0 else None |
| 108 | for channel_id in Config.AUTH_CHANNELS: |
| 109 | try: |
| 110 | await bot.get_chat_member(channel_id, user_id) |
| 111 | except UserNotParticipant: |
| 112 | try: |
| 113 | chat = await bot.get_chat(channel_id) |
| 114 | invite = await bot.create_chat_invite_link(channel_id, expire_date=expire_at) |
| 115 | missing.append((chat.title, invite.invite_link)) |
| 116 | except ChatAdminRequired: |
| 117 | logging.error(f"Bot not admin in auth channel {channel_id}") |
| 118 | except Exception: |
| 119 | pass |
| 120 | except Exception: |
| 121 | pass |
| 122 | return missing |
| 123 | |
| 124 | |
| 125 | async def is_req_subscribed(bot: Client, user_id: int): |