import asyncio
import time
from datetime import datetime
from telethon.tl.functions.channels import JoinChannelRequest, LeaveChannelRequest
from telethon.tl import functions
from PIL import Image
from random_username.generate import generate_username
import random
import os
from telethon import TelegramClient, events, sync
import threading
from config import api_id,api_hash
thread_list = []
for x in range(0,3):
thread_list.append(str("thread_captcha"+str(x)))
entity="@Zone9SurvivaNewAirdropBot"
ref = "1631352967"
vi=open("Info/vi.txt","r").read().split("\n")
UT = open("Fetch_Twit/zone9_rt.txt","r").read().split("\n")
tele_username = open("Info/tele_username.txt","r").read().split("\n")
# quote = open("Info/link_quote.txt","r").read().split("\n")
def generate_random_string(len_sep, no_of_blocks):
random_string = ''
random_str_seq = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(0, len_sep * no_of_blocks):
if i % len_sep == 0 and i != 0:
random_string += '-'
random_string += str(random_str_seq[random.randint(0, len(random_str_seq) - 1)])
return random_string
async def cheat(phone=None, indexx = None,num_thread = None):
client = await TelegramClient("session/%s" % (phone), api_id[num_thread], api_hash[num_thread]).start()
await asyncio.sleep(1)
msg_cac = await client.get_messages(entity, 1)
try:
if (msg_cac[0].message.find("referral link") != -1):
print("Telegram", str(phone), ":Done cac", datetime.now())
await client.disconnect()
return
except IndexError:
pass
await client(JoinChannelRequest("https://t.me/Zone9SurvivalOfficial"))
await client(JoinChannelRequest("https://t.me/Zone9SurvivalAnnouncement"))
# await client(JoinChannelRequest("https://t.me/SPAC3SHIPGlobalChat"))
#https://t.me/Artube_Token_Official
#
await client(functions.messages.StartBotRequest(entity, entity, start_param=ref))
# await client(JoinChannelRequest("https://t.me/airdrop6officialchannel"))
@client.on(events.NewMessage(from_users=entity))
async def handler(event):
sender = await event.get_input_sender()
msg = await client.get_messages(sender, 2)
if (msg[0].message.find("Before we start the airdrop, please prove") != -1):
await msg[0].click(0,0)
# math = await client.get_messages(sender,1)
if (msg[0].message.find("👍Great, please enter the code") != -1):
# if (msg[0].message.find("Great Send Answer") != -1):
math = msg[1].message
math_solve = str(eval(math[math.index(":")+1:math.index("=")]))
await client.send_message(sender,math_solve)
if (msg[0].message.find("eferral link:") != -1):
print("Telegram", str(phone), ":Done cac", datetime.now())
await client.disconnect()
@client.on(events.MessageEdited(from_users=entity))
async def handler(event):
sender = await event.get_input_sender()
msg_1 = await client.get_messages(sender, 2)
if (msg_1[0].message.find("eferral link:") != -1):
print("Telegram", str(phone), ":Done2", datetime.now())
await client.disconnect()
if (msg_1[0].message.find("Before we start the airdrop, please prove") != -1):
await msg_1[0].click(0, 0)
# math = await client.get_messages(sender,1)
if (msg_1[0].message.find("please enter the code") != -1):
math = msg_1[1].message
math_solve = str(eval(math[math.index(":") + 1:math.index("=")]))
await client.send_message(sender, math_solve)
await asyncio.sleep(2)
if (msg_1[0].message.find('Please join our channel') != -1):
await msg_1[0].click(0, 0)
if (msg_1[0].message.find("then enter your twitter username with '@'") != -1):
await client.send_message(sender, UT[indexx+300])
if (msg_1[0].message.find("Submit your Medium username") != -1):
await client.send_message(sender, UT[indexx+300])
# if (msg_1[0].message.find("Submit your Facebook profile ") != -1):
# await client.send_message(sender,"https://www.facebook.com/profile.php?id=1000"+str(random.randint(11111111111,99999999999)))
if (msg_1[0].message.find("submit your Youtube channel link below") != -1):
await client.send_message(sender,"https://www.youtube.com/channel/%s" %(generate_random_string(24,1)))
if (msg_1[0].message.find('Press "Done"') != -1) or (msg_1[0].message.find('click the "Done') != -1):
await msg_1[0].click(0, 0)
if (msg_1[0].message.find('Please submit your Binance Smart Chain-BEP20 wallet') != -1):
# if (msg_1[0].message.find('Please submit your Polygon-Matic wallet address') != -1):
# if (msg_1[0].message.find("Then please submit your TRC20-TRX") != -1):
# if (msg_1[0].message.find('Please submit your Ethereum-ETH wallet address below') != -1):
# await asyncio.sleep(2)
await client.send_message(sender, vi[indexx])
await client.run_until_disconnected()
async def check_timeout(phone_timeout=None, indexx_timeout=None, num_thread_timeout=None):
# Wait for at most 1 second
try:
await asyncio.wait_for(cheat(phone=phone_timeout, indexx=indexx_timeout, num_thread=num_thread_timeout),
timeout=40)
except asyncio.TimeoutError:
print("Telegram",phone_timeout,"time out")
await check_timeout(phone_timeout=phone_timeout, indexx_timeout=indexx_timeout,
num_thread_timeout=num_thread_timeout)
def go(a=None, num_thread=None):
for incac in a:
asyncio.run(check_timeout(phone_timeout=str(incac), indexx_timeout=incac, num_thread_timeout=num_thread))
# asyncio.run(cheat(phone=str(incac), indexx=incac, num_thread=num_thread))
# go(a = [1], num_thread=0)
if __name__ == '__main__':
numberOfThread = 30
# amountEachThread = int (total / numberOfThread)
threadAppend = []
thread_acc=[]
for a in range(numberOfThread):
thread_acc.append([])
for a in range(2,552):
temp = int((a-1) % numberOfThread)
for k in range(numberOfThread):
if (temp==k):
# print("acc",a,"thread",k)
thread_acc[k].append(a)
# thread_acc.append((a-1)*numberOfThread)
for x in range(numberOfThread):
threadAppend.append(threading.Thread(target=go, args=(thread_acc[x], x,)))
# process_rr = arr.array(multiprocessing(), [multiprocessing.Process(target=check, args=(range(1,50),)),multiprocessing.Process(target=check, args=(range(50,100),))])
for x in range(numberOfThread):
threadAppend[x].start()
for x in range(numberOfThread):
threadAppend[x].join()