Update main.py
Browse files
main.py
CHANGED
@@ -53,31 +53,32 @@ api = ak.PornoHub(key=API_KEY)
|
|
53 |
|
54 |
not_allowed = ["hi", "hello", "hey", "hai", "help"]
|
55 |
|
56 |
-
@Client.on_message(filters.incoming & filters.private)
|
57 |
async def must_join_channel(bot: Client, msg: Message):
|
58 |
MUST_JOIN = "RendyProjects"
|
|
|
|
|
59 |
try:
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
except Exception:
|
81 |
pass
|
82 |
|
83 |
async def check_membership(channel_id, bot, msg):
|
@@ -107,7 +108,11 @@ async def check_membership(channel_id, bot, msg):
|
|
107 |
except UserNotParticipant:
|
108 |
return False
|
109 |
|
110 |
-
@client.on_message(
|
|
|
|
|
|
|
|
|
111 |
async def welcome_start(client: Client, message: Message):
|
112 |
keyboard = InlineKeyboardMarkup(
|
113 |
[
|
|
|
53 |
|
54 |
not_allowed = ["hi", "hello", "hey", "hai", "help"]
|
55 |
|
56 |
+
@Client.on_message(filters.incoming & filters.private, group=-1)
|
57 |
async def must_join_channel(bot: Client, msg: Message):
|
58 |
MUST_JOIN = "RendyProjects"
|
59 |
+
if not MUST_JOIN:
|
60 |
+
return
|
61 |
try:
|
62 |
+
try:
|
63 |
+
await bot.get_chat_member(MUST_JOIN, msg.from_user.id)
|
64 |
+
except UserNotParticipant:
|
65 |
+
if MUST_JOIN.isalpha():
|
66 |
+
link = "https://t.me/" + MUST_JOIN
|
67 |
+
else:
|
68 |
+
chat_info = await bot.get_chat(MUST_JOIN)
|
69 |
+
link = chat_info.invite_link
|
70 |
+
try:
|
71 |
+
await msg.reply(
|
72 |
+
f"You must join [this channel]({link}) to use me. After joining try again !",
|
73 |
+
disable_web_page_preview=True,
|
74 |
+
reply_markup=InlineKeyboardMarkup([
|
75 |
+
[InlineKeyboardButton("Join Channel", url=link)]
|
76 |
+
])
|
77 |
+
)
|
78 |
+
await msg.stop_propagation()
|
79 |
+
except ChatWriteForbidden:
|
80 |
+
pass
|
81 |
+
except ChatAdminRequired:
|
|
|
82 |
pass
|
83 |
|
84 |
async def check_membership(channel_id, bot, msg):
|
|
|
108 |
except UserNotParticipant:
|
109 |
return False
|
110 |
|
111 |
+
@client.on_message(
|
112 |
+
filters.incoming
|
113 |
+
& filters.command("start")
|
114 |
+
& filters.private
|
115 |
+
)
|
116 |
async def welcome_start(client: Client, message: Message):
|
117 |
keyboard = InlineKeyboardMarkup(
|
118 |
[
|