(bot: Client, message: Message)
| 140 | |
| 141 | |
| 142 | async def get_fsub(bot: Client, message: Message) -> bool: |
| 143 | user_id = message.from_user.id |
| 144 | |
| 145 | if user_id == Config.ADMIN: |
| 146 | return True |
| 147 | |
| 148 | old_msg_id = await tb.get_fsub_msg(user_id) |
| 149 | |
| 150 | if old_msg_id: |
| 151 | try: |
| 152 | await bot.delete_messages(user_id, old_msg_id) |
| 153 | except Exception: |
| 154 | pass |
| 155 | await tb.delete_fsub_msg_db(user_id) |
| 156 | |
| 157 | missing = [] |
| 158 | |
| 159 | if Config.AUTH_CHANNELS: |
| 160 | missing.extend(await is_subscribed(bot, user_id)) |
| 161 | |
| 162 | if Config.AUTH_REQ_CHANNELS: |
| 163 | missing.extend(await is_req_subscribed(bot, user_id)) |
| 164 | |
| 165 | if not missing: |
| 166 | return True |
| 167 | |
| 168 | bot_user = await bot.get_me() |
| 169 | buttons = [] |
| 170 | |
| 171 | for i in range(0, len(missing), 2): |
| 172 | row = [] |
| 173 | for j in range(2): |
| 174 | if i + j < len(missing): |
| 175 | title, link = missing[i + j] |
| 176 | row.append(InlineKeyboardButton(f"{i + j + 1}. {title}", url=link)) |
| 177 | buttons.append(row) |
| 178 | |
| 179 | buttons.append( |
| 180 | [InlineKeyboardButton("🔄 𝖳𝗋𝗒 𝖠𝗀𝖺𝗂𝗇", url=f"https://telegram.me/{bot_user.username}?start=start")] |
| 181 | ) |
| 182 | msg = await message.reply( |
| 183 | f"<blockquote>**🔒 𝖠𝖼𝖼𝖾𝗌𝗌 𝖱𝖾𝗌𝗍𝗋𝗂𝖼𝗍𝖾𝖽!**</blockquote>\n\n" |
| 184 | f"{message.from_user.mention}, 𝖳𝗈 𝖴𝗌𝖾 𝖳𝗁𝗂𝗌 𝖡𝗈𝗍, 𝖸𝗈𝗎 𝖭𝖾𝖾𝖽 𝖳𝗈 𝖩𝗈𝗂𝗇 𝖠𝖫𝖫 𝖱𝖾𝗊𝗎𝗂𝗋𝖾𝖽 𝖢𝗁𝖺𝗇𝗇𝖾𝗅𝗌.\n\n" |
| 185 | f"𝖱𝖾𝗊𝗎𝗂𝗋𝖾𝖽 𝖢𝗁𝖺𝗇𝗇𝖾𝗅𝗌 ({len(missing)})\n\n" |
| 186 | f"𝖠𝖿𝗍𝖾𝗋 𝖩𝗈𝗂𝗇𝗂𝗇𝗀, 𝖢𝗅𝗂𝖼𝗄 **“𝖳𝗋𝗒 𝖠𝗀𝖺𝗂𝗇”** 𝖡𝖾𝗅𝗈𝗐.", |
| 187 | reply_markup=InlineKeyboardMarkup(buttons) |
| 188 | ) |
| 189 | await tb.save_fsub_msg(user_id, msg.id) |
| 190 | return False |
| 191 | |
| 192 | |
| 193 | @Client.on_message(filters.private & ~filters.user(Config.ADMIN) & ~filters.bot & ~filters.service & ~filters.me, group=-10) |
no test coverage detected