forked from ShivangKakkar/StringSessionBot
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfsub.py
More file actions
32 lines (27 loc) · 1.52 KB
/
fsub.py
File metadata and controls
32 lines (27 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pyrogram import Client, filters, enums
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from pyrogram.errors import UserNotParticipant
FORCE_SUB = "mlz_boz""
async def not_subscribed(_, client, message):
if not FORCE_SUB:
return False
try:
user = await client.get_chat_member(FORCE_SUB, message.from_user.id)
if user.status == enums.ChatMemberStatus.BANNED:
return True
else:
return False
except UserNotParticipant:
pass
return True
@Client.on_message(filters.private & filters.create(not_subscribed))
async def forces_sub(client, message):
buttons = [[InlineKeyboardButton(text="📢 Join Update Channel 📢", url=f"https://t.me/MLZ_BOTZ") ]]
text = "**Sᴏʀʀy Dᴜᴅᴇ Yᴏᴜ'ʀᴇ Nᴏᴛ Jᴏɪɴᴇᴅ My Cʜᴀɴɴᴇʟ 😐. Sᴏ Pʟᴇᴀꜱᴇ Jᴏɪɴ Oᴜʀ Uᴩᴅᴀᴛᴇ Cʜᴀɴɴᴇʟ Tᴏ Cᴄᴏɴᴛɪɴᴜᴇ**"
try:
user = await client.get_chat_member(FORCE_SUB, message.from_user.id)
if user.status == enums.ChatMemberStatus.BANNED:
return await client.send_message(message.from_user.id, text="Sᴏʀʀy Yᴏᴜ'ʀᴇ Bᴀɴɴᴇᴅ Tᴏ Uꜱᴇ Mᴇ")
except UserNotParticipant:
return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons))
return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons))