-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
166 lines (142 loc) Β· 6.14 KB
/
main.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
from telethon import TelegramClient, events, Button
from telethon.sessions import StringSession
api_id = {your api}
api_hash = {your api hash}
bot_token = "{your bot token}"
session = "{yur string session}"
#-------------------------DONT TOUCH OTHERS---------------------------
client = TelegramClient(StringSession(session), api_id, api_hash)
#client = TelegramClient("botty", api_id, api_hash)
bot = TelegramClient('bot', api_id, api_hash).start(bot_token=bot_token)
anime = ["@MC_Filterv2bot", "@TheMinatoBot"]
series = ["@tvseriezzz_bot", "@MC_Filterv2bot", "@TheMinatoBot"]
movie = ["@MC_Filterv2bot", "@TheMinatoBot", "@Moviesearchx1bot", "@TGMovieRobot", "@tvseriezzz_bot", "@TheZerinaBot"]
movieGroup = 1623526540
_movieGroup = -1001623526540
movie_request = -1001678296931
movie_send = -1001761125039
botusername = "getmovies_beastbot"
user = ""
username = ""
wait_mmsg = ""
userid = 0
chat_id = ""
noOfFiles = 0
first_name = ""
res = ""
movie_name = ""
puserid = 0
requesting_bot = ""
file_ids = []
nooffiles = 0
noOfFiles = 0
@bot.on(events.NewMessage())
async def main(event):
global noOfFiles, user, username, userid, chat_id, first_name, res, movie_name, requesting_bot, puserid
chat = await event.get_chat()
chat_id = chat.id
user = await event.get_sender()
userid = user.id
print(chat_id)
username = user.username
if chat_id == movieGroup and username!= botusername and username!= movieGroup:
print
puserid = user.id
first_name = user.first_name
movie_name = str(event.text)
res = await bot.send_message(_movieGroup, f" π πππ₯πππ ππ²π©π π \n [{first_name}](tg://user?id={userid})",buttons=[
[Button.inline("γ α΄Ι΄Ιͺα΄α΄",data=b'anim'), Button.inline("π¬ α΄α΄α΄ Ιͺα΄κ±",data=b'movie')],
[Button.inline("πΏ κ±α΄ΚΙͺα΄κ±",data=b'series'), Button.url("β»οΈ α΄α΄ΙͺΙ΄",url="https://t.me/+i5F3Uzb0a5JhZDg1")]])
@bot.on(events.CallbackQuery)
async def call(event):
global user, requesting_bot, wait_mmsg
if event.original_update.user_id == userid:
wait_mmsg = await event.reply(f"πππ [{first_name}](tg://user?id={userid})\n\nππππΌππ ππΌππ!")
if event.data == b'anim':
await bot.delete_messages(movieGroup, res)
await calling_movie(anime)
elif event.data == b'movie':
await bot.delete_messages(movieGroup, res)
await calling_movie(movie)
elif event.data == b'series':
await bot.delete_messages(movieGroup, res)
await calling_movie(series)
async def calling_movie(list_of_things):
global noOfFiles, nooffiles
for i in list_of_things:
if noOfFiles <= 2:
await getmovie(i)
else:
break
await bot.delete_messages(movieGroup, wait_mmsg)
if noOfFiles >= 1:
await bot.send_message(movieGroup, f"[{first_name}](tg://user?id={puserid})\n\nπ² ππ₯π’ππ€ ππ¨π°π§π₯π¨ππ π²",buttons=[[Button.url("β¬οΈπΏππππππΌπΏ",url=f"http://t.me/{botusername}?start=I_love_krishna"),Button.url("β»οΈπ
πππ", url="https://t.me/+IJ_hbX7qJ6o2NzI1")]])
elif noOfFiles == 0:
await bot.send_message(movieGroup,"κ±α΄α΄Κα΄Κ α΄‘Ιͺα΄Κα΄α΄α΄ κ±α΄α΄ΚΚΙͺΙ΄Ι’ α΄Ιͺκ±α΄α΄α΄α΄,\n α΄
α΄Ι΄α΄ κ±α΄α΄Κα΄Κ α΄Κα΄α΄α΄Κα΄ α΄ΚΙͺΙ΄α΄κ±")
async def getmovie(requesting_bot):
try:
requested_movies = await client.inline_query(requesting_bot, movie_name ,entity=movie_request)
global file_ids, noOfFiles
nooffiles = 0
for no in range(30):
try:
message = await requested_movies[no].click(0)
files_to_data = await client.send_file(movie_send, file=message)
await bot.delete_messages(movie_request, message.id)
file_ids.append(files_to_data.id)
nooffiles += 1
except:
break
if nooffiles == 0:
pass
else:
noOfFiles += 1
nooffiles = 0
except:
pass
@bot.on(events.NewMessage(incoming=True, pattern="/start I_love_krishna"))
async def send(event):
global noOfFiles, user, username, userid, chat_id, first_name, res, movie_name, requesting_bot, puserid, nooffiles
bot_chat = await event.get_chat()
bot_pm_user_id = bot_chat.id
if bot_pm_user_id == puserid:
name_of_user = bot_chat.first_name
for files in file_ids:
async for message in bot.iter_messages(movie_send, ids=files):
file_name = str(message.file.name)
try:
file_name = file_name.replace("[", " ")
file_name = file_name.replace("]", " ")
except:
pass
cmsg = f"""
ππππ πππ ππ {name_of_user}!
{file_name}
ββββββ πΉπππ ππ βββββ
β»οΈ π
πππ :- [ππππ](https://t.me/+i5F3Uzb0a5JhZDg1)
ββββββ πΉπππ ππ βββββ
ββββββ π±ππ π³ππ βββββ
πππππππππ - [ππππ πππππ](http://t.me/elbeastz)
ββββββ π±ππ π³ππ βββββ
"""
await bot.send_file(bot_chat, message, caption=cmsg)
await bot.delete_messages(movie_send, message)
else:
await bot.send_message(bot_chat, "πππππππ ππππππ ππππππππ")
file_ids.clear()
user = ""
username = ""
userid = ""
chat_id = ""
noOfFiles = 0
first_name = ""
res = ""
movie_name = ""
requesting_bot = ""
puserid = 0
nooffiles = 0
print("run")
bot.start()
client.start()
client.run_until_disconnected()
bot.run_until_disconnected()