""" Apache License 2.0 Copyright (c) 2022 @Digital_Botz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Telegram Link : https://t.me/Digital_Botz Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE """ # pyrogram imports from pyrogram import Client, filters, enums from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from pyrogram.errors import UserNotParticipant # extra imports from config import Config from helper.database import digital_botz import datetime async def not_subscribed(_, client, message): await digital_botz.add_user(client, message) if not Config.FORCE_SUB: return False try: user = await client.get_chat_member(Config.FORCE_SUB, message.from_user.id) return user.status not in [enums.ChatMemberStatus.MEMBER, enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER] except UserNotParticipant: return True except Exception as e: print(f"Error checking subscription: {e}") return False async def handle_banned_user_status(bot, message): await digital_botz.add_user(bot, message) user_id = message.from_user.id ban_status = await digital_botz.get_ban_status(user_id) if ban_status.get("is_banned", False): if ( datetime.date.today() - datetime.date.fromisoformat(ban_status["banned_on"]) ).days > ban_status["ban_duration"]: await digital_botz.remove_ban(user_id) else: return await message.reply_text("Sorry Sir, 😔 You are Banned!.. Please Contact - @DigitalBotz") await message.continue_propagation() async def forces_sub(client, message): buttons = [[InlineKeyboardButton(text="📢 Join Update Channel 📢", url=f"https://t.me/{Config.FORCE_SUB}")]] text = "**Sᴏʀʀy Dᴜᴅᴇ Yᴏᴜ'ʀᴇ Nᴏᴛ Jᴏɪɴᴇᴅ My Cʜᴀɴɴᴇʟ 😐. Sᴏ Pʟᴇᴀꜱᴇ Jᴏɪɴ Oᴜʀ Uᴩᴅᴀᴛᴇ Cʜᴀɴɴᴇʟ Tᴏ Cᴄᴏɴᴛɪɴᴜᴇ**" try: user = await client.get_chat_member(Config.FORCE_SUB, message.from_user.id) if user.status == enums.ChatMemberStatus.BANNED: return await message.reply_text("Sᴏʀʀy Yᴏᴜ'ʀᴇ Bᴀɴɴᴇᴅ Tᴏ Uꜱᴇ Mᴇ") elif user.status not in [enums.ChatMemberStatus.MEMBER, enums.ChatMemberStatus.ADMINISTRATOR]: return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons)) except UserNotParticipant: return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons)) return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons)) # (c) @RknDeveloperr # Rkn Developer # Don't Remove Credit 😔 # Telegram Channel @RknDeveloper & @Rkn_Botz # Developer @RknDeveloperr # Update Channel @Digital_Botz & @DigitalBotz_Support