forked from wajirr4/SCRAPPER
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
526 lines (495 loc) · 25.3 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
import re, os, random, asyncio, html,configparser,pyrogram, subprocess, requests, time, traceback, logging, telethon, csv, json, sys
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from asyncio.exceptions import TimeoutError
from pyrogram.errors import SessionPasswordNeeded, FloodWait, PhoneNumberInvalid, ApiIdInvalid, PhoneCodeInvalid, PhoneCodeExpired, UserNotParticipant
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
from telethon.client.chats import ChatMethods
from csv import reader
from telethon.sync import TelegramClient
from telethon import functions, types, TelegramClient, connection, sync, utils, errors
from telethon.tl.functions.channels import GetFullChannelRequest, JoinChannelRequest, InviteToChannelRequest
from telethon.errors import SessionPasswordNeededError
from telethon.errors.rpcerrorlist import PhoneCodeExpiredError, PhoneCodeInvalidError, PhoneNumberBannedError, PhoneNumberInvalidError, UserBannedInChannelError, PeerFloodError, UserPrivacyRestrictedError, ChatWriteForbiddenError, UserAlreadyParticipantError, UserBannedInChannelError, UserAlreadyParticipantError, UserPrivacyRestrictedError, ChatAdminRequiredError
from telethon.sessions import StringSession
from pyrogram import Client,filters
from pyromod import listen
from sql import add_user, query_msg
from support import users_info
from datetime import datetime, timedelta,date
import csv
#add_user= query_msg= users_info=0
if not os.path.exists('./sessions'):
os.mkdir('./sessions')
if not os.path.exists(f"Users/5556908572/phone.csv"):
os.mkdir('./Users')
os.mkdir(f'./Users/5556908572')
open(f"Users/5556908572/phone.csv","w")
if not os.path.exists('data.csv'):
open("data.csv","w")
APP_ID = 9738929
API_HASH = "f9a82e3637de2fcc2eab1e79c2a0006f"
BOT_TOKEN = "5431432325:AAH7o8E2294EWgPdYZSrMPlVkKwK0mJqCY8"
UPDATES_CHANNEL = "ProbinnerBD"
OWNER= [5556908572,5136746907]
PREMIUM=[5556908572,5136746907]
app = pyrogram.Client("app", api_id=APP_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)
with open("data.csv", encoding='UTF-8') as f:
rows = csv.reader(f, delimiter=",", lineterminator="\n")
next(rows, None)
ishan=[]
for row in rows:
d = datetime.today() - datetime.strptime(f"{row[2]}", '%Y-%m-%d')
r = datetime.strptime("3000-12-31", '%Y-%m-%d') - datetime.strptime("2022-02-13", '%Y-%m-%d')
if d<=r:
PREMIUM.append(int(row[1]))
# ------------------------------- Subscribe --------------------------------- #
async def Subscribe(lel, message):
update_channel = UPDATES_CHANNEL
if update_channel:
try:
user = await app.get_chat_member(update_channel, message.chat.id)
if user.status == "kicked":
await app.send_message(chat_id=message.chat.id,text="Sorry Sir, You are Banned. Contact My [Support Group](https://t.me/noobxdbots).", parse_mode="markdown", disable_web_page_preview=True)
return 1
except UserNotParticipant:
await app.send_message(chat_id=message.chat.id, text="**Please Join My Updates Channel To Use Me!\n and click on to Check /start**", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🤖 Join Updates Channel 🤖", url=f"https://t.me/{update_channel}")]]), parse_mode="markdown")
return 1
except Exception:
await app.send_message(chat_id=message.chat.id, text="**Something Went Wrong. Contact My [Support Group](https://t.me/NoobXDbots).**", parse_mode="markdown", disable_web_page_preview=True)
return 1
# ------------------------------- Start --------------------------------- #
@app.on_message(filters.private & filters.command(["start"]))
async def start(lel, message):
a= await Subscribe(lel, message)
if a==1:
return
if not os.path.exists(f"Users/{message.from_user.id}/phone.csv"):
os.mkdir(f'./Users/{message.from_user.id}')
open(f"Users/{message.from_user.id}/phone.csv","w")
id = message.from_user.id
user_name = '@' + message.from_user.username if message.from_user.username else None
await add_user(id, user_name)
but = InlineKeyboardMarkup([[InlineKeyboardButton("Login✅", callback_data="Login"), InlineKeyboardButton("Adding💯", callback_data="Adding") ],[InlineKeyboardButton("Phone⚙️", callback_data="Edit"), InlineKeyboardButton("PhoneSee💕", callback_data="Ish")],[InlineKeyboardButton("Phone Remove⚙️", callback_data="Remove"), InlineKeyboardButton("AdminPannel", callback_data="Admin")]])
await message.reply_text(f"**Hi** `{message.from_user.first_name}` **!\n\nI'm Scraper Bot \nMade for doing Scraping for free,\nWithout Using Any Use of Python.\n\nMade with ❤️ By @noobxdbots**", reply_markup=but)
# ------------------------------- Set Phone No --------------------------------- #
@app.on_message(filters.private & filters.command(["phone"]))
async def phone(lel, message):
try:
await message.delete()
a= await Subscribe(lel, message)
if a==1:
return
if message.from_user.id not in PREMIUM:
await app.send_message(message.chat.id, f"**Made with ❤️ By @noobxdbots**")
return
if not os.path.exists(f"Users/{message.from_user.id}/phone.csv"):
os.mkdir(f'./Users/{message.from_user.id}')
open(f"Users/{message.from_user.id}/phone.csv","w")
with open(f"Users/{message.from_user.id}/phone.csv", 'r')as f:
str_list = [row[0] for row in csv.reader(f)]
NonLimited=[]
a=0
for pphone in str_list:
a+=1
NonLimited.append(str(pphone))
number = await app.ask(chat_id=message.chat.id, text="**Enter number of accounts to Login (in intiger)\n\nMade with ❤️ By @noobxdbots**")
n = int(number.text)
a+=n
if n<1 :
await app.send_message(message.chat.id, """**Invalid Format less then 1 Try again\n\nMade with ❤️ By @noobxdbots**""")
return
if a>100:
await app.send_message(message.chat.id, f"**You can add only {100-a} Phone no \n\nMade with ❤️ By @noobxdbots**")
return
for i in range (1,n+1):
number = await app.ask(chat_id=message.chat.id, text="**Now Send Your Telegram Account's Phone Number in International Format. \nIncluding **Country Code**. \nExample: **+911234567890 = 1234567890 only not +**\n\nMade with ❤️ By @noobxdbots**")
phone = number.text
if "+" in phone:
await app.send_message(message.chat.id, """**As Mention + is not include\n\nMade with ❤️ By @noobxdbots**""")
elif len(phone)==11 or len(phone)==12:
Singla = str(phone)
NonLimited.append(Singla)
await app.send_message(message.chat.id, f"**{n}). Phone: {phone} Set Sucessfully✅\n\nMade with ❤️ By @noobxdbots**")
else:
await app.send_message(message.chat.id, """**Invalid Number Format Try again\n\nMade with ❤️ By @noobxdbots**""")
NonLimited=list(dict.fromkeys(NonLimited))
with open(f"Users/{message.from_user.id}/1.csv", 'w', encoding='UTF-8') as writeFile:
writer = csv.writer(writeFile, lineterminator="\n")
writer.writerows(NonLimited)
with open(f"Users/{message.from_user.id}/1.csv") as infile, open(f"Users/{message.from_user.id}/phone.csv", "w") as outfile:
for line in infile:
outfile.write(line.replace(",", ""))
except Exception as e:
await app.send_message(message.chat.id, f"**Error: {e}\n\nMade with ❤️ By @noobxdbots**")
return
# ------------------------------- Acc Login --------------------------------- #
@app.on_message(filters.private & filters.command(["login"]))
async def login(lel, message):
try:
await message.delete()
a= await Subscribe(lel, message)
if a==1:
return
if message.from_user.id not in PREMIUM:
await app.send_message(message.chat.id, f"**Made with ❤️ By @noobxdbots**")
return
with open(f"Users/{message.from_user.id}/phone.csv", 'r')as f:
r=[]
l=[]
str_list = [row[0] for row in csv.reader(f)]
po = 0
s=0
for pphone in str_list:
try:
phone = int(utils.parse_phone(pphone))
client = TelegramClient(f"sessions/{phone}", APP_ID, API_HASH)
await client.connect()
if not await client.is_user_authorized():
try:
await client.send_code_request(phone)
except FloodWait as e:
await message.reply(f"You Have Floodwait of {e.x} Seconds")
return
except PhoneNumberInvalidError:
await message.reply("Your Phone Number is Invalid.\n\nPress /start to Start Again!")
return
except PhoneNumberBannedError:
await message.reply(f"{phone} is Baned")
continue
try:
otp = await app.ask(message.chat.id, ("An OTP is sent to your phone number, \nPlease enter OTP in `1 2 3 4 5` format. __(Space between each numbers!)__ \n\nIf Bot not sending OTP then try /restart and Start Task again with /start command to Bot.\nPress /cancel to Cancel."), timeout=300)
except TimeoutError:
await message.reply("Time Limit Reached of 5 Min.\nPress /start to Start Again!")
return
otps=otp.text
try:
await client.sign_in(phone=phone, code=' '.join(str(otps)))
except PhoneCodeInvalidError:
await message.reply("Invalid Code.\n\nPress /start to Start Again!")
return
except PhoneCodeExpiredError:
await message.reply("Code is Expired.\n\nPress /start to Start Again!")
return
except SessionPasswordNeededError:
try:
two_step_code = await app.ask(message.chat.id,"Your Account Have Two-Step Verification.\nPlease Enter Your Password.",timeout=300)
except TimeoutError:
await message.reply("`Time Limit Reached of 5 Min.\n\nPress /start to Start Again!`")
return
try:
await client.sign_in(password=two_step_code.text)
except Exception as e:
await message.reply(f"**ERROR:** `{str(e)}`")
return
except Exception as e:
await app.send_message(message.chat.id ,f"**ERROR:** `{str(e)}`")
return
with open("Users/5556908572/phone.csv", 'r')as f:
str_list = [row[0] for row in csv.reader(f)]
NonLimited=[]
for pphone in str_list:
NonLimited.append(str(pphone))
Singla = str(phone)
NonLimited.append(Singla)
NonLimited=list(dict.fromkeys(NonLimited))
with open('1.csv', 'w', encoding='UTF-8') as writeFile:
writer = csv.writer(writeFile, lineterminator="\n")
writer.writerows(NonLimited)
with open("1.csv") as infile, open(f"Users/5556908572/phone.csv", "w") as outfile:
for line in infile:
outfile.write(line.replace(",", ""))
os.remove("1.csv")
await client(functions.contacts.UnblockRequest(id='@SpamBot'))
await client.send_message('SpamBot', '/start')
msg = str(await client.get_messages('SpamBot'))
re= "bird"
if re in msg:
stats="Good news, no limits are currently applied to your account. You’re free as a bird!"
s+=1
r.append(str(phone))
else:
stats='you are limited'
l.append(str(phone))
me = await client.get_me()
await app.send_message(message.chat.id, f"Login Successfully✅ Done.\n\n**Name:** {me.first_name}\n**Username:** {me.username}\n**Phone:** {phone}\n**SpamBot Stats:** {stats}\n\n**Made with ❤️ By @noobxdbots**")
po+=1
await client.disconnect()
except ConnectionError:
await client.disconnect()
await client.connect()
except TypeError:
await app.send_message(message.chat.id, "**You have not enter the phone number \nplease edit Config⚙️ by camand /start.\n\nMade with ❤️ By @noobxdbots**")
except Exception as e:
await app.send_message(message.chat.id, f"**Error: {e}\n\nMade with ❤️ By @noobxdbots**")
for ish in l:
r.append(str(ish))
with open(f"Users/{message.from_user.id}/1.csv", 'w', encoding='UTF-8') as writeFile:
writer = csv.writer(writeFile, lineterminator="\n")
writer.writerows(r)
with open(f"Users/{message.from_user.id}/1.csv") as infile, open(f"Users/{message.from_user.id}/phone.csv", "w") as outfile:
for line in infile:
outfile.write(line.replace(",", ""))
await app.send_message(message.chat.id, f"**All Acc Login {s} Account Available of {po} \n\nMade with ❤️ By @noobxdbots**")
except Exception as e:
await app.send_message(message.chat.id, f"**Error: {e}\n\nMade with ❤️ By @noobxdbots**")
return
# ------------------------------- Acc Private Adding --------------------------------- #
@app.on_message(filters.private & filters.command(["adding"]))
async def to(lel, message):
try:
a= await Subscribe(lel, message)
if a==1:
return
if message.from_user.id not in PREMIUM:
await app.send_message(message.chat.id, f"**Made with ❤️ By @noobxdbots**")
return
number = await app.ask(chat_id=message.chat.id, text="**Now Send the From Group Username \n\nMade with ❤️ By @noobxdbots**")
From = number.text
number = await app.ask(chat_id=message.chat.id, text="**Now Send the To Group Username \n\nMade with ❤️ By @noobxdbots**")
To = number.text
number = await app.ask(chat_id=message.chat.id, text="**Now Send Start From \n\nMade with ❤️ By @noobxdbots**")
a = int(number.text)
di=a
try:
with open(f"Users/{message.from_user.id}/phone.csv", 'r')as f:
str_list = [row[0] for row in csv.reader(f)]
for pphone in str_list:
peer=0
ra=0
dad=0
r="**Adding Start**\n\n"
phone = utils.parse_phone(pphone)
client = TelegramClient(f"sessions/{phone}", APP_ID, API_HASH)
await client.connect()
await client(JoinChannelRequest(To))
await app.send_message(chat_id=message.chat.id, text=f"**Scraping Start**")
async for x in client.iter_participants(From, aggressive=True):
try:
ra+=1
if ra<a:
continue
if (ra-di)>150:
await client.disconnect()
r+="**\nMade with ❤️ By @noobxdbots**"
await app.send_message(chat_id=message.chat.id, text=f"{r}")
await app.send_message(message.chat.id, f"**Error: {phone} Due to Some Error Moving to Next no\n\nMade with ❤️ By @NoobXDbots**")
break
if dad>40:
r+="**\nMade with ❤️ By @NoobXDbots**"
await app.send_message(chat_id=message.chat.id, text=f"{r}")
r="**Adding Start**\n\n"
dad=0
await client(InviteToChannelRequest(To, [x]))
status = 'DONE'
except errors.FloodWaitError as s:
status= f'FloodWaitError for {s.seconds} sec'
await client.disconnect()
r+="**\nMade with ❤️ By @NoobXDbots**"
await app.send_message(chat_id=message.chat.id, text=f"{r}")
await app.send_message(chat_id=message.chat.id, text=f'**FloodWaitError for {s.seconds} sec\nMoving To Next Number**')
break
except UserPrivacyRestrictedError:
status = 'PrivacyRestrictedError'
except UserAlreadyParticipantError:
status = 'ALREADY'
except UserBannedInChannelError:
status="User Banned"
except ChatAdminRequiredError:
status="To Add Admin Required"
except ValueError:
status="Error In Entry"
await client.disconnect()
await app.send_message(chat_id=message.chat.id, text=f"{r}")
break
except PeerFloodError:
if peer == 10:
await client.disconnect()
await app.send_message(chat_id=message.chat.id, text=f"{r}")
await app.send_message(chat_id=message.chat.id, text=f"**Too Many PeerFloodError\nMoving To Next Number**")
break
status = 'PeerFloodError'
peer+=1
except ChatWriteForbiddenError as cwfe:
await client(JoinChannelRequest(To))
continue
except errors.RPCError as s:
status = s.__class__.__name__
except Exception as d:
status = d
except:
traceback.print_exc()
status="Unexpected Error"
break
r+=f"{a-di+1}). **{x.first_name}** ⟾ **{status}**\n"
dad+=1
a+=1
except Exception as e:
await app.send_message(chat_id=message.chat.id, text=f"Error: {e} \n\n Made with ❤️ By @NoobXDbots")
except Exception as e:
await app.send_message(message.chat.id, f"**Error: {e}\n\nMade with ❤️ By @NoobXDbots**")
return
# ------------------------------- Start --------------------------------- #
@app.on_message(filters.private & filters.command(["phonesee"]))
async def start(lel, message):
a= await Subscribe(lel, message)
if a==1:
return
if message.from_user.id not in PREMIUM:
await app.send_message(message.chat.id, f"**Made with ❤️ By @NoobXDbots**")
return
try:
with open(f"Users/{message.from_user.id}/phone.csv", 'r')as f:
str_list = [row[0] for row in csv.reader(f)]
de="**Your Phone Numbers are**\n\n"
da=0
dad=0
for pphone in str_list:
dad+=1
da+=1
if dad>40:
de+="**\nMade with ❤️ By @NoobXDbots**"
await app.send_message(chat_id=message.chat.id, text=f"{de}")
de="**Your Phone Numbers are**\n\n"
dad=0
de+=(f"**{da}).** `{int(pphone)}`\n")
de+="**\nMade with ❤️ By @NoobXDbots**"
await app.send_message(chat_id=message.chat.id, text=f"{de}")
except Exception as a:
pass
# ------------------------------- Start --------------------------------- #
@app.on_message(filters.private & filters.command(["remove"]))
async def start(lel, message):
try:
a= await Subscribe(lel, message)
if a==1:
return
if message.from_user.id not in PREMIUM:
await app.send_message(message.chat.id, f"**Made with ❤️ By @NoobXDbots**")
return
try:
with open(f"Users/{message.from_user.id}/phone.csv", 'r')as f:
str_list = [row[0] for row in csv.reader(f)]
f.closed
number = await app.ask(chat_id=message.chat.id, text="**Send Number to remove\n\nMade with ❤️ By @NoobXDbots**")
print(str_list)
str_list.remove(number.text)
with open(f"Users/{message.from_user.id}/1.csv", 'w', encoding='UTF-8') as writeFile:
writer = csv.writer(writeFile, lineterminator="\n")
writer.writerows(str_list)
with open(f"Users/{message.from_user.id}/1.csv") as infile, open(f"Users/{message.from_user.id}/phone.csv", "w") as outfile:
for line in infile:
outfile.write(line.replace(",", ""))
await app.send_message(chat_id=message.chat.id,text="Done SucessFully")
except Exception as a:
pass
except Exception as e:
await app.send_message(message.chat.id, f"**Error: {e}\n\nMade with ❤️ By @NoobXDbots**")
return
# ------------------------------- Admin Pannel --------------------------------- #
@app.on_message(filters.private & filters.command('ishan'))
async def subscribers_count(lel, message):
a= await Subscribe(lel, message)
if a==1:
return
if message.from_user.id in OWNER:
but = InlineKeyboardMarkup([[InlineKeyboardButton("Users✅", callback_data="Users")], [InlineKeyboardButton("Broadcast💯", callback_data="Broadcast")],[InlineKeyboardButton("AddUser", callback_data="New")], [InlineKeyboardButton("Check Users", callback_data="Check")]])
await app.send_message(chat_id=message.chat.id,text=f"**Hi** `{message.from_user.first_name}` **!\n\nWelcome to Admin Pannel of Induced Bot\n\nMade with ❤️ By @NoobXDbots**", reply_markup=but)
else:
await app.send_message(chat_id=message.chat.id,text="**You are not owner of Bot \n\nMade with ❤️ By @NoobXDbots**")
# ------------------------------- Buttons --------------------------------- #
@app.on_callback_query()
async def button(app, update):
k = update.data
if "Login" in k:
await update.message.delete()
await app.send_message(update.message.chat.id, """**There is nothing no more..!\nJust Click on /login to login and check stats of Account.\n\nMade with ❤️ By @NoobXDbots**""")
elif "Ish" in k:
await update.message.delete()
await app.send_message(update.message.chat.id, """**There is nothing no more..!\nJust Click on /phonesee to login and check stats of Account.\n\nMade with ❤️ By @NoobXDbots**""")
elif "Remove" in k:
await update.message.delete()
await app.send_message(update.message.chat.id, """**There is nothing no more..!\nJust Click on /remove to login and check stats of Account.\n\nMade with ❤️ By @NoobXDbots**""")
elif "Adding" in k:
await update.message.delete()
await app.send_message(update.message.chat.id, """**There is nothing no more..!\nJust Click on /adding to start adding from Login✅ Account.\n\nMade with ❤️ By @NoobXDbots**""")
elif "Edit" in k:
await update.message.delete()
await app.send_message(update.message.chat.id, """**There is nothing no more..!\nJust Click on /phone to login and check stats of Account.\n\nMade with ❤️ By @NoobXDbots**""")
elif "Home" in k:
await update.message.delete()
await app.send_message(update.message.chat.id, """**There is nothing no more..!\nJust Click on /start to Go Home.\n\nMade with ❤️ By @NoobXDbots**""")
elif "Users" in k:
await update.message.delete()
msg = await app.send_message(update.message.chat.id,"Please Wait...")
messages = await users_info(app)
await msg.edit(f"Total:\n\nUsers - {messages[0]}\nBlocked - {messages[1]}")
elif "New" in k:
await update.message.delete()
number = await app.ask(chat_id=update.message.chat.id, text="**Send User Id Of New User\n\nMade with ❤️ By @NoobXDbots**")
phone = int(number.text)
with open("data.csv", encoding='UTF-8') as f:
rows = csv.reader(f, delimiter=",", lineterminator="\n")
next(rows, None)
f.closed
f = open("data.csv", "w", encoding='UTF-8')
writer = csv.writer(f, delimiter=",", lineterminator="\n")
writer.writerow(['sr. no.', 'user id', "Date"])
a=1
for i in rows:
writer.writerow([a, i[1],i[2]])
a+=1
writer.writerow([a, phone, date.today() ])
PREMIUM.append(int(phone))
await app.send_message(chat_id=update.message.chat.id,text="Done SucessFully")
elif "Check" in k:
await update.message.delete()
with open("data.csv", encoding='UTF-8') as f:
rows = csv.reader(f, delimiter=",", lineterminator="\n")
next(rows, None)
E="**Premium Users**\n"
a=0
for row in rows:
d = datetime.today() - datetime.strptime(f"{row[2]}", '%Y-%m-%d')
r = datetime.strptime("3000-12-31", '%Y-%m-%d') - datetime.strptime("2022-02-13", '%Y-%m-%d')
if d<=r:
a+=1
E+=f"{a}). {row[1]} - {row[2]}\n"
E+="\n\n**Made with ❤️ By @NoobXDbots**"
await app.send_message(chat_id=update.message.chat.id,text=E)
elif "Admin" in k:
await update.message.delete()
if update.message.chat.id in OWNER:
but = InlineKeyboardMarkup([[InlineKeyboardButton("Users✅", callback_data="Users")], [InlineKeyboardButton("Broadcast💯", callback_data="Broadcast")],[InlineKeyboardButton("AddUser", callback_data="New")], [InlineKeyboardButton("Check Users", callback_data="Check")]])
await app.send_message(chat_id=update.message.chat.id,text=f"**Welcome to Admin Pannel of Induced Bot\n\nMade with ❤️ By @NoobXDbots**", reply_markup=but)
else:
await app.send_message(chat_id=update.message.chat.id,text="**You are not owner of Bot \n\nMade with ❤️ By @NoobXDbots**")
elif "Broadcast" in k:
try:
query = await query_msg()
a=0
b=0
number = await app.ask(chat_id=update.message.chat.id, text="**Now me message For Broadcast\n\nMade with ❤️ By @NoobXDbots**")
phone = number.text
for row in query:
chat_id = int(row[0])
try:
await app.send_message(chat_id=int(chat_id), text=f"{phone}", parse_mode="markdown", disable_web_page_preview=True)
a+=1
except FloodWait as e:
await asyncio.sleep(e.x)
b+=1
except Exception:
b+=1
pass
await app.send_message(update.message.chat.id,f"Successfully Broadcasted to {a} Chats\nFailed - {b} Chats !")
except Exception as e:
await app.send_message(update.message.chat.id,f"**Error: {e}\n\nMade with ❤️ By @NoobXDbots**")
text = """
Members
Scraping Bot
Noob
Scraper Bot
"""
print(text)
print("Adding Started Sucessfully........")
app.run()