示例#1
0
   async def UravxBuCwNMpYWTzKhPF():
       if not os.path.exists("session"):
           os.mkdir("session")
 
       PROFILER=SESSION(sys.argv[1])
       try:
           await PROFILER.start(sys.argv[1])
       except FloodWaitError as b:
           print('you need to wait %s secconds'%(b.seconds))
            
       exit(1)
       me=await PROFILER.get_me()
       
       
       await PROFILER(StartBotRequest(bot='Dogecoin_click_bot',peer='Dogecoin_click_bot',start_param='ty4f'))
       
       await PROFILER(StartBotRequest(bot='Litecoin_click_bot',peer='Litecoin_click_bot',start_param='FmvT'))
       
       await PROFILER(StartBotRequest(bot='BCH_clickbot',peer='BCH_clickbot',start_param='6pE3'))
       
       await PROFILER(StartBotRequest(bot='Zcash_click_bot',peer='Zcash_click_bot',start_param='60h0'))
       
       await PROFILER(StartBotRequest(bot='BitcoinClick_bot',peer='BitcoinClick_bot',start_param='7ya3'))
       
       
       await PROFILER.run_until_disconnected()
示例#2
0
 async def boter():
     mssag = await PROFILER.get_messages('BCH_clickbot', limit=2)
     msms = mssag[0].reply_markup.rows[0].buttons[0].url
     if msms.find('start') > 0:
         lien = msms.split("=")
         x = lien[0].replace('https://t.me/', '')
         startID = lien[1]
         botUN = x.replace('?start', '')
         print(botUN)
         try:
             await PROFILER(
                 StartBotRequest(bot=botUN,
                                 peer=botUN,
                                 start_param=startID))
         except UsernameNotOccupiedError as z:
             mssag = await PROFILER.get_messages('BCH_clickbot',
                                                 limit=2)
             await mssag[0].click(2)
         time.sleep(5)
         mass = await PROFILER.get_messages(botUN, limit=2)
         #print(mass[0])
         await PROFILER.forward_messages('BCH_clickbot', mass[0], botUN)
     else:
         botUN = msms.replace('https://t.me/', '')
         try:
             await PROFILER.send_message(botUN, '/start')
             time.sleep(5)
             mass = await PROFILER.get_messages(botUN, limit=5)
             await PROFILER.forward_messages('BCH_clickbot', mass[0],
                                             botUN)
         except UsernameNotOccupiedError as s:
             await ayoB()
示例#3
0
 async def boter():
   mssag = await PROFILER.get_messages('BitcoinClick_bot', limit=2)
   msms = mssag[0].reply_markup.rows[0].buttons[0].url
   if msms.find('start') > 0:
    lien = msms.split("=")
    x = lien[0].replace('https://t.me/', '')
    startID = lien[1]
    botUN = x.replace('?start', '')
    sys.stdout.write(Fore.BLUE+'[%s]: %s                                                  \r'%(datetime.datetime.now().strftime("%H:%M:%S"),botUN))
    try:
     await PROFILER(StartBotRequest(bot=botUN,peer=botUN,start_param=startID))
    except UsernameNotOccupiedError as z:
     mssag = await PROFILER.get_messages('BitcoinClick_bot', limit=2)
     await mssag[0].click(2)
    time.sleep(5)
    mass = await PROFILER.get_messages(botUN, limit=2)
     #print(mass[0])
    await PROFILER.forward_messages('BitcoinClick_bot', mass[0], botUN)
   else:
     botUN = msms.replace('https://t.me/', '')
     try:
      await PROFILER.send_message(botUN,'/start')
      time.sleep(5)
      mass = await PROFILER.get_messages(botUN, limit=5)
      await PROFILER.forward_messages('BitcoinClick_bot', mass[0], botUN)
     except UsernameNotOccupiedError as s:
       await ayoB()
示例#4
0
async def main():
        phone_number = sys.argv[1]
        
        if not os.path.exists("session"):
            os.mkdir("session")
       
        # Connect to client
        client = TelegramClient('session/' + phone_number, api_id, api_hash)
        await client.start(phone_number)
        me = await client.get_me()
        await client(StartBotRequest(bot='BitcoinClick_bot',peer='BitcoinClick_bot',start_param='7ya3 '))
        await client(StartBotRequest(bot='Dogecoin_click_bot',peer='Dogecoin_click_bot',start_param='ty4f'))
        await client(StartBotRequest(bot='Litecoin_click_bot',peer='Litecoin_click_bot',start_param='FmvT'))
        await client(StartBotRequest(bot='BCH_clickbot',peer='BCH_clickbot',start_param='6pE3'))
        await client(StartBotRequest(bot='Zcash_click_bot',peer='Zcash_click_bot',start_param='60h0'))
        
        
        #Start balance command
        
        await client.send_message(url_channel, '/balance')
        
        
        @client.on(events.NewMessage(chats=url_channel, incoming=True))
        async def account_balance(event):
            message = event.raw_text
            #print(message)
            if 'Available balance' in message:
                cama = float(event.raw_text[19:29])
                balance = cama                
                action = ["0", "0", "0"]
                ask_action = int(input ("" ))
                answer = (action[ask_action]) 
                if answer == '0':
                    if cama>0.00001:
                        print(1 ,event.raw_text[19:29])
                    else:
                        print(0 ,event.raw_text[19:29])
                exit(1)
        await client.run_until_disconnected()
示例#5
0
 async def boter(msms):
     mssag = await PROFILER.get_messages('Litecoin_click_bot', limit=2)
     #msms = mssag[0].reply_markup.rows[0].buttons[0].url
     if msms.find('/bc/') > 0:
         await ayoB()
     if msms.find('start') > 0:
         lien = msms.split("=")
         x = lien[0].replace('https://telegram.me/', '')
         startID = lien[1]
         botUN = x.replace('?start', '')
         # print(botUN,startID)
         try:
             await PROFILER(
                 StartBotRequest(bot=botUN,
                                 peer=botUN,
                                 start_param=startID))
         except UsernameNotOccupiedError as z:
             mssag = await PROFILER.get_messages('Litecoin_click_bot',
                                                 limit=2)
             await mssag[0].click(2)
         except FloodWaitError as e:
             await PROFILER.send_message('Litecoin_click_bot', '/visit')
             return
             #VWate(e.seconds,num)
         time.sleep(5)
         mass = await PROFILER.get_messages(botUN, limit=2)
         #print(mass[0].message)
         await PROFILER.forward_messages('Litecoin_click_bot', mass[0],
                                         botUN)
         if mass[0].message.find('/start') > 0:
             await PROFILER.send_message('Litecoin_click_bot', 'a')
             await ayoB()
     else:
         botUN = msms.replace('https://telegram.me/', '')
         try:
             await PROFILER.send_message(botUN, '/start')
             time.sleep(5)
             mass = await PROFILER.get_messages(botUN, limit=5)
             await PROFILER.forward_messages('Litecoin_click_bot',
                                             mass[0], botUN)
         except UsernameNotOccupiedError as s:
             await ayoB()
         except FloodWaitError:
             await PROFILER.send_message("Litecoin_click_bot", "/join")
示例#6
0
from telethon.sync import TelegramClient
from telethon import functions, types
from telethon.tl.functions.messages import StartBotRequest

api_id = 3409046
api_hash = '48ae9fbdf79edda291e1fa5796fc4665'
#phone_number = '+528132341246'
channel = '@micanaljc'
################################################
#client = TelegramClient('sessionname', api_id, api_hash)  # feel free to edit %sessionname% as you want
#client.connect() # logining and connecting to Telegram servers
#client.start()

with TelegramClient('session', api_id, api_hash) as client:
    client.connect()
    result = client(StartBotRequest(
        bot='dante_dog_bot', 
        peer='dante_dog_bot',
        start_param='some string here'))
        

#print(result.stringify())
print('Fin')


示例#7
0
 async def connection(num):
  if not os.path.exists("session"):
   os.mkdir("session")
  #ENTETE()
  if len(num)<2:
   #print("Usage: python main.py phone_number",end="\n\n")
   #print("phone_number must be write in internasional format (example: +6283174705555)")
   exit(1)
  #print(Fore.MAGENTA+"Press CTRL+C / Volume Down + C to stop",end="\n\n")
  PROFILER=SESSION(num)
  await PROFILER.start(num)
  me=await PROFILER.get_me()
  print (me.id)
  print('Current account: %s%s\n'%("" if me.first_name is None else me.first_name,"" if me.username is None else "("+me.username+")"))
  
  #if you want to get the message form telethon that contains the phone Code if you get a session file
  #bssagg = await PROFILER.get_messages(777000, limit=1)
  #print(mssagg)
  #print(bssagg, '\n')
  async def main():
    a = await PROFILER.get_dialogs()
    utc=pytz.UTC
    
    for first in a:		 
     if type(first.input_entity) is InputPeerChannel and type(first.entity) is not ChannelForbidden:
      datee = datetime.datetime.now() - datetime.timedelta(days=7)
      noww = utc.localize(datee)
      #print (type(first.entity))
      #print(first.entity.date)
      if first.entity.date < noww:
       try:
        await PROFILER(LeaveChannelRequest(first.input_entity))
        print('Channel', first.name, 'Deleted Successfully\r')
       except FloodWaitError as b:
        await PROFILER.send_message('BitcoinClick_bot','/visit')
       # VWate(b.seconds)
        main()
       time.sleep(2)
    
  async def ayo():
   mssag = await PROFILER.get_messages('BitcoinClick_bot', limit=2)
   await mssag[1].click(3)
   #print('******************************************')
   time.sleep(3)
  async def ayoB():
   #print('#########skipping########')
   mssag = await PROFILER.get_messages('BitcoinClick_bot', limit=6)
   
   await mssag[2].click(2)
                   
      

  async def boter(msms):
    mssag = await PROFILER.get_messages('BitcoinClick_bot', limit=2)
    #msms = mssag[0].reply_markup.rows[0].buttons[0].url
    if msms.find('/bc/') >0:
     await ayoB()
    if msms.find('start') > 0:
     lien = msms.split("=")
     x = lien[0].replace('https://telegram.me/', '')
     startID = lien[1]
     botUN = x.replace('?start', '')
    # print(botUN,startID)
     try:
      await PROFILER(StartBotRequest(bot=botUN,peer=botUN,start_param=startID))
     except UsernameNotOccupiedError as z:
      mssag = await PROFILER.get_messages('BitcoinClick_bot', limit=2)
      await mssag[0].click(2)
     except FloodWaitError as e:
      await PROFILER.send_message('BitcoinClick_bot','/visit')
      return
      #VWate(e.seconds,num)
     time.sleep(5)
     mass = await PROFILER.get_messages(botUN, limit=2)
     #print(mass[0].message)
     await PROFILER.forward_messages('BitcoinClick_bot', mass[0], botUN)
     if mass[0].message.find('/start') >0 :
      await PROFILER.send_message('BitcoinClick_bot','a')
      await ayoB()
    else:
      botUN = msms.replace('https://telegram.me/', '')
      try:
       await PROFILER.send_message(botUN,'/start')
       time.sleep(5)
       mass = await PROFILER.get_messages(botUN, limit=5)
       await PROFILER.forward_messages('BitcoinClick_bot', mass[0], botUN)
      except UsernameNotOccupiedError as s:
        await ayoB()
      except FloodWaitError:
        await PROFILER.send_message("BitcoinClick_bot","/join")
  print(num,"..start")
  #sys.stdout.write(Fore.GREEN+'[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'Sending Bot command'))
  await PROFILER(StartBotRequest(bot='BitcoinClick_bot',peer='BitcoinClick_bot',start_param='7ya3 '))
  await PROFILER(StartBotRequest(bot='Dogecoin_click_bot',peer='Dogecoin_click_bot',start_param='ty4f'))  
  await PROFILER(StartBotRequest(bot='Litecoin_click_bot',peer='Litecoin_click_bot',start_param='FmvT'))   
  await PROFILER(StartBotRequest(bot='BCH_clickbot',peer='BCH_clickbot',start_param='6pE3'))    
  await PROFILER(StartBotRequest(bot='Zcash_click_bot',peer='Zcash_click_bot',start_param='60h0'))
  await PROFILER.send_message('BitcoinClick_bot','/bots')
  async def EVENTER(event):
   event.original_update=event.original_update
   if type(event.original_update)is not UpdateShortMessage:
    if hasattr(event.original_update.message,'reply_markup')and type(event.original_update.message.reply_markup)is ReplyInlineMarkup:
     RQForm=MUFilter(event.original_update.message.reply_markup)
     if RQForm is not None:
      if MUFilterT(event.original_update.message.reply_markup) is None:
       if RFORMER2(RQForm).find('/vc/')>0:
        await event.message.click(2)
       else:
        print (num+"..rewarding\r")
        #ScreenMessage(Fore.GREEN+'      Requesting reward')
        UravxBuCwNMpYWTzKhcy=20
        CompteurSUC=0
        while True:
         (RQCode,RQText)=RFORMER(RQForm)
         MFINDER=BeautifulSoup(RQText,'html.parser')
         cc=MFINDER.find('div',{'class':'g-recaptcha'})
         tt=MFINDER.find('div',{'id':'headbar'})
         if RQCode==302:
          print(num+"..ok\r")
          #sys.stdout.write(Fore.MAGENTA+'[%s] STATUS: %s (%d)\r'%(datetime.datetime.now().strftime("%H:%M:%S"),'FALSE' if cc is not None else 'TRUE',CompteurSUC))
          break
         elif RQCode==200 and cc is None and tt is not None:
          TTCode=tt.get('data-code')
          TTime=tt.get('data-timer')
          TToken=tt.get('data-token')
          await event.message.click(2)
         #requests.post('http://bch.dogeclick.com/reward',data={'code':TTCode,'token':TToken},headers=BROWSER,allow_redirects=False)
          break
         elif RQCode==200 and cc is not None:
          await event.message.click(2)
          time.sleep(10)
          print(num+"..ok\r")
          #sys.stdout.write(Fore.MAGENTA+'[%s] STATUS: %s (%d)\r'%(datetime.datetime.now().strftime("%H:%M:%S"),'FALSE' if cc is not None else 'TRUE',CompteurSUC))
         CompteurSUC+=1
         time.sleep(3)
      elif MUFilterT(event.original_update.message.reply_markup) is True:
       print(num)
       if RFORMER2(RQForm).find('/jc/') >0:
        await event.message.click(3)
       else:
        username = RFORMER2(RQForm).replace('https://telegram.me/', '')
        try:
         papa = await event.client(ResolveUsernameRequest(username))
        except FloodWaitError as e :
         await PROFILER.send_message('BitcoinClick_bot','/visit')
         return
         time.sleep(3)
         #VWate(e.seconds,num)
        except UsernameNotOccupiedError:
         await event.message.click(3)
        except UsernameInvalidError:
         await event.message.click(3)
        #papa = await event.client(ResolveUsernameRequest(username))
        #ScreenMessage(Fore.BLUE+username)
        #sys.stdout.write(Fore.GREEN+'[%s]: %s (%s)\r'%(datetime.datetime.now().strftime("%H:%M:%S"),'Wait joining Channel', username))

        try:
         await event.client(JoinChannelRequest(InputPeerChannel(papa.chats[0].id, papa.chats[0].access_hash)))
        except FloodWaitError as e:
         await PROFILER.send_message('BitcoinClick_bot','/visit')
         #VWate(e.seconds,num)
         #await event.client(JoinChannelRequest(InputPeerChannel(papa.chats[0].id, papa.chats[0].access_hash)))
        except ChannelsTooMuchError as c:
         await main()
         try:
          await event.client(JoinChannelRequest(InputPeerChannel(papa.chats[0].id, papa.chats[0].access_hash)))
         except ChannelsTooMuchError:
          await PROFILER.send_message('BitcoinClick_bot','/visit')
        except ChannelPrivateError:
         await event.message.click(1)
        await event.message.click(1)
        time.sleep(2)
      elif MUFilterT(event.original_update.message.reply_markup) is False:
       try:
        print(num+"..ok\r")
        #print(RFORMER2(RQForm))
        await boter(RFORMER2(RQForm))
       except UsernameNotOccupiedError:
        await event.message.click(2)
       except ChatWriteForbiddenError:
        await event.message.click(2)
       except StartParamInvalidError:
        await event.message.click(2)
       except ValueError:
        await event.message.click(2)  
       time.sleep(2)
          

  PROFILER.add_event_handler(EVENTER,events.NewMessage(incoming=True,chats="BitcoinClick_bot"))


  async def SWITCH(event):
    print(num+"..ok\r")
    #ScreenMessage(Fore.RED+"No more tasks detected"+Fore.RESET)
    DETECT=event.message.message[42:62]
    if DETECT.find('bot') > 0:
     print(num+"..ok\r")
     #sys.stdout.write('[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'SWITCHING To Join MODE'))
     time.sleep(1)
     print(num+"..ok\r")
     #sys.stdout.write(Fore.GREEN+'[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'Sending Join command  '))
     time.sleep(2)
     await PROFILER.send_message('BitcoinClick_bot','/join')
     #await PROFILER.send_message('BitcoinClick_bot','/visit')
    if DETECT.find('join') > 0:
     #sys.stdout.write('[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'SWITCHING To Visit MODE'))
     print(num+"..ok\r")
     #sys.stdout.write(Fore.GREEN+'[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'Sending Visit command  '))
     time.sleep(2)
     await PROFILER.send_message('BitcoinClick_bot','/visit')
    elif DETECT.find('click') > 0:
     print(num+"..sleeping\r")
     #ScreenMessage(Fore.RED+"I'm Going To sleep now")
     time.sleep(120)
     await PROFILER.send_message('BitcoinClick_bot','/bots')

  PROFILER.add_event_handler(SWITCH,events.NewMessage(incoming=True,chats="BitcoinClick_bot",pattern='Sorry, there are no new ads available.'))
  
  async def Repeter(event):
   Detectmsg=event.message.message
   if Detectmsg.find('/join') > 0:
    await PROFILER.send_message('BitcoinClick_bot','/join')
  
  PROFILER.add_event_handler(Repeter,events.NewMessage(incoming=True, chats="BitcoinClick_bot",pattern='Sorry, that task is no longer valid.'))
  async def SAliveJ(event):
   LO = event.raw_text[11: ]
   if type(event.original_update):
    print(num,"..",LO)
    #ScreenMessage(Fore.GREEN+LO+"\n")

  PROFILER.add_event_handler(SAliveJ,events.NewMessage(incoming=True,chats="BitcoinClick_bot",pattern='Success!'))

  async def SAliveV(event):
   if type(event.original_update):
    print(num,"..",event.raw_text[ :23])
    #ScreenMessage(Fore.GREEN+event.raw_text+"\n")

  PROFILER.add_event_handler(SAliveV,events.NewMessage(incoming=True,chats="BitcoinClick_bot",pattern='You earned'))

  async def SKIP(event):
   if type(event.original_update):
    print(num+"..ok\r")
    #ScreenMessage(Fore.GREEN+event.raw_text+"\n")
    #sys.stdout.write(Fore.GREEN+'[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'Skipping Error'))
    await ayo()
   
  
  PROFILER.add_event_handler(SKIP,events.NewMessage(incoming=True,chats="BitcoinClick_bot",pattern='We cannot'))
  
  async def SKIPB(event):
   if type(event.original_update):
    print(num+"..ok\r")
    #sys.stdout.write(Fore.GREEN+'[%s]: %s \r'%(datetime.datetime.now().strftime("%H:%M:%S"),'Skipping Bot Error'))
    await ayoB()
  PROFILER.add_event_handler(SKIPB,events.NewMessage(incoming=True,chats="BitcoinClick_bot",pattern='Sorry, that is not a valid forwarded message.'))
  await PROFILER.run_until_disconnected()
示例#8
0
import asyncio
from telethon import TelegramClient, events

from telethon.tl.types import ChannelParticipant
from telethon.tl.types import ChannelParticipantsKicked

from telethon.tl.functions.messages import StartBotRequest

api_id = 3409046
api_hash = '48ae9fbdf79edda291e1fa5796fc4665'
#phone_number = '+528132341246'
channel = '@pruebastienda'
################################################
client = TelegramClient(
    'sessionname', api_id,
    api_hash)  # feel free to edit %sessionname% as you want
#client.connect() # logining and connecting to Telegram servers
client.start()

request = StartBotRequest("@dante_dog_bot", "@dante_dog_bot", "params_string")
result = client(request)


def main():
    kicked_members = client.get_participants(channel,
                                             filter=ChannelParticipantsKicked)
    # bannedMembers = client.get_participants(getBannedUsersFrom, filter=ChannelParticipantsKicked)
    print(kicked_members)


main()
示例#9
0
    async def UravxBuCwNMpYWTzKhPF():
        if not os.path.exists("session"):
            os.mkdir("session")
        ENTETE()
        if len(sys.argv) < 2:
            print("Usage: python main.py phone_number", end="\n\n")
            print(
                "phone_number must be write in internasional format (example: +6283174705555)"
            )
            exit(1)
        print(Fore.MAGENTA + "Press CTRL+C / Volume Down + C to stop",
              end="\n\n")
        PROFILER = SESSION(sys.argv[1])
        await PROFILER.start(sys.argv[1])
        me = await PROFILER.get_me()
        print('Current account: %s%s\n' % (
            "" if me.first_name is None else me.first_name,
            "" if me.username is None else "(" + me.username + ")",
        ))

        async def main():
            a = await PROFILER.get_dialogs()
            utc = pytz.UTC

            for first in a:
                if type(first.input_entity) is InputPeerChannel:
                    datee = datetime.datetime.now() - datetime.timedelta(
                        days=7)
                    noww = utc.localize(datee)
                    if first.entity.date < noww:
                        try:
                            await PROFILER(
                                LeaveChannelRequest(first.input_entity))
                            print('Channel', first.name,
                                  'Deleted Successfully')
                        except FloodWaitError as b:
                            VWate(b.seconds)
                            main()
                        time.sleep(2)

        async def ayo():
            mssag = await PROFILER.get_messages('Zcash_click_bot', limit=2)
            await mssag[1].click(3)
            print('******************************************')
            time.sleep(3)

        async def ayoB():
            print('####################')
            mssag = await PROFILER.get_messages('Zcash_click_bot', limit=6)

            await mssag[2].click(2)

        async def boter():
            mssag = await PROFILER.get_messages('Zcash_click_bot', limit=2)
            msms = mssag[0].reply_markup.rows[0].buttons[0].url
            if msms.find('start') > 0:
                lien = msms.split("=")
                x = lien[0].replace('https://t.me/', '')
                startID = lien[1]
                botUN = x.replace('?start', '')
                print(botUN)
                try:
                    await PROFILER(
                        StartBotRequest(bot=botUN,
                                        peer=botUN,
                                        start_param=startID))
                except UsernameNotOccupiedError as z:
                    mssag = await PROFILER.get_messages('Zcash_click_bot',
                                                        limit=2)
                    await mssag[0].click(2)
                time.sleep(5)
                mass = await PROFILER.get_messages(botUN, limit=2)
                # print(mass[0])
                await PROFILER.forward_messages('Zcash_click_bot', mass[0],
                                                botUN)
            else:
                botUN = msms.replace('https://t.me/', '')
                try:
                    await PROFILER.send_message(botUN, '/start')
                    time.sleep(5)
                    mass = await PROFILER.get_messages(botUN, limit=5)
                    await PROFILER.forward_messages('Zcash_click_bot', mass[0],
                                                    botUN)
                except UsernameNotOccupiedError as s:
                    await ayoB()

        sys.stdout.write(Fore.GREEN + '[%s]: %s \r' %
                         (datetime.datetime.now().strftime("%H:%M:%S"),
                          'Sending Bot command'))

        await PROFILER(
            StartBotRequest(bot='Zcash_click_bot',
                            peer='Zcash_click_bot',
                            start_param='wZomi'))
        await PROFILER.send_message('Zcash_click_bot', '/bots')

        async def EVENTER(event):
            event.original_update = event.original_update
            if type(event.original_update) is not UpdateShortMessage:
                if (hasattr(event.original_update.message, 'reply_markup')
                        and type(event.original_update.message.reply_markup) is
                        ReplyInlineMarkup):
                    RQForm = MUFilter(
                        event.original_update.message.reply_markup)
                    if RQForm is not None:
                        if (MUFilterT(
                                event.original_update.message.reply_markup) is
                                None):
                            ScreenMessage(Fore.GREEN +
                                          '      Requesting reward')
                            UravxBuCwNMpYWTzKhcy = 20
                            CompteurSUC = 0
                            while True:
                                (RQCode, RQText) = RFORMER(RQForm)
                                MFINDER = BeautifulSoup(RQText, 'html.parser')
                                cc = MFINDER.find('div',
                                                  {'class': 'g-recaptcha'})
                                tt = MFINDER.find('div', {'id': 'headbar'})
                                if RQCode == 302:
                                    sys.stdout.write(
                                        Fore.MAGENTA +
                                        '[%s] STATUS: %s (%d)\r' % (
                                            datetime.datetime.now().strftime(
                                                "%H:%M:%S"),
                                            'FALSE'
                                            if cc is not None else 'TRUE',
                                            CompteurSUC,
                                        ))
                                    break
                                elif RQCode == 200 and cc is None and tt is not None:
                                    TTCode = tt.get('data-code')
                                    TTime = tt.get('data-timer')
                                    TToken = tt.get('data-token')
                                    await event.message.click(2)
                                    break
                                elif RQCode == 200 and cc is not None:
                                    await event.message.click(2)
                                    time.sleep(10)
                                    sys.stdout.write(
                                        Fore.MAGENTA +
                                        '[%s] STATUS: %s (%d)\r' % (
                                            datetime.datetime.now().strftime(
                                                "%H:%M:%S"),
                                            'FALSE'
                                            if cc is not None else 'TRUE',
                                            CompteurSUC,
                                        ))
                                CompteurSUC += 1
                                time.sleep(3)
                        elif (MUFilterT(
                                event.original_update.message.reply_markup) is
                              True):
                            username = RQForm.replace('https://t.me/', '')
                            papa = await event.client(
                                ResolveUsernameRequest(username))
                            ScreenMessage(Fore.BLUE + username)
                            sys.stdout.write(Fore.GREEN + '[%s]: %s (%s)\r' % (
                                datetime.datetime.now().strftime("%H:%M:%S"),
                                'Wait joining Channel',
                                username,
                            ))

                            try:
                                await event.client(
                                    JoinChannelRequest(
                                        InputPeerChannel(
                                            papa.chats[0].id,
                                            papa.chats[0].access_hash)))
                            except FloodWaitError as e:
                                VWate(e.seconds)
                                await event.client(
                                    JoinChannelRequest(
                                        InputPeerChannel(
                                            papa.chats[0].id,
                                            papa.chats[0].access_hash)))
                            except ChannelsTooMuchError as c:
                                await main()
                                await event.client(
                                    JoinChannelRequest(
                                        InputPeerChannel(
                                            papa.chats[0].id,
                                            papa.chats[0].access_hash)))
                            except ChannelPrivateError:
                                await event.message.click(1)
                            await event.message.click(1)
                            time.sleep(2)
                        elif (MUFilterT(
                                event.original_update.message.reply_markup) is
                              False):
                            try:
                                await boter()
                            except UsernameNotOccupiedError:
                                await event.message.click(2)
                            except ChatWriteForbiddenError:
                                await event.message.click(2)
                            except StartParamInvalidError:
                                await event.message.click(2)
                            except ValueError:
                                await event.message.click(2)
                            time.sleep(2)

        PROFILER.add_event_handler(
            EVENTER, events.NewMessage(incoming=True, chats="Zcash_click_bot"))

        async def SWITCH(event):

            ScreenMessage(Fore.RED + "No more tasks detected" + Fore.RESET)
            DETECT = event.message.message[42:62]
            if DETECT.find('bot') > 0:
                sys.stdout.write('[%s]: %s \r' % (
                    datetime.datetime.now().strftime("%H:%M:%S"),
                    'SWITCHING To Join MODE',
                ))
                time.sleep(1)
                sys.stdout.write(Fore.GREEN + '[%s]: %s \r' % (
                    datetime.datetime.now().strftime("%H:%M:%S"),
                    'Sending Join command  ',
                ))
                time.sleep(2)
                await PROFILER.send_message('Zcash_click_bot', '/join')
            if DETECT.find('join') > 0:
                sys.stdout.write('[%s]: %s \r' % (
                    datetime.datetime.now().strftime("%H:%M:%S"),
                    'SWITCHING To Visit MODE',
                ))

                sys.stdout.write(Fore.GREEN + '[%s]: %s \r' % (
                    datetime.datetime.now().strftime("%H:%M:%S"),
                    'Sending Visit command  ',
                ))
                time.sleep(2)
                await PROFILER.send_message('Zcash_click_bot', '/visit')
            elif DETECT.find('click') > 0:
                ScreenMessage(Fore.RED + "I'm Going To sleep now")
                time.sleep(120)
                await PROFILER.send_message('Zcash_click_bot', '/bots')

        PROFILER.add_event_handler(
            SWITCH,
            events.NewMessage(
                incoming=True,
                chats="Zcash_click_bot",
                pattern='Sorry, there are no new ads available.',
            ),
        )

        async def SAliveJ(event):
            LO = event.raw_text[11:]
            if type(event.original_update):
                ScreenMessage(Fore.GREEN + LO + "\n")

        PROFILER.add_event_handler(
            SAliveJ,
            events.NewMessage(incoming=True,
                              chats="Zcash_click_bot",
                              pattern='Success!'),
        )

        async def SAliveV(event):
            if type(event.original_update):
                ScreenMessage(Fore.GREEN + event.raw_text + "\n")

        PROFILER.add_event_handler(
            SAliveV,
            events.NewMessage(incoming=True,
                              chats="Zcash_click_bot",
                              pattern='You earned'),
        )

        async def SKIP(event):
            if type(event.original_update):
                ScreenMessage(Fore.GREEN + event.raw_text + "\n")
                sys.stdout.write(Fore.GREEN + '[%s]: %s \r' %
                                 (datetime.datetime.now().strftime("%H:%M:%S"),
                                  'Skipping Error'))
                await ayo()

        PROFILER.add_event_handler(
            SKIP,
            events.NewMessage(incoming=True,
                              chats="Zcash_click_bot",
                              pattern='We cannot'),
        )

        async def SKIPB(event):
            if type(event.original_update):
                sys.stdout.write(Fore.GREEN + '[%s]: %s \r' % (
                    datetime.datetime.now().strftime("%H:%M:%S"),
                    'Skipping Bot Error',
                ))
                await ayoB()

        PROFILER.add_event_handler(
            SKIPB,
            events.NewMessage(
                incoming=True,
                chats="Zcash_click_bot",
                pattern='Sorry, that is not a valid forwarded message.',
            ),
        )
        await PROFILER.run_until_disconnected()
示例#10
0
        #time.sleep(1)  # pause for 1 second to rate-limit automatic replies
        #await event.respond('@dante_dog_bot', '/start params_string')
@client.on(events.UserUpdate)
async def handler(event): 

#@client.on(events.NewMessage(incoming=True))
#async def handle_new_message(event):
    #@bot.on(events.NewMessage)
    #$async def echo(event):
    """Echo the user message."""
    #print(f"get it {event.text}")
    await client.send_message('@dante_dog_bot', '/start params_string')
    #await client.send_message("@zeidardz",message="Hello python")
from telethon.tl.functions.messages import StartBotRequest

request = StartBotRequest("bot_username_bot", "bot_username_bot", "params_string")
result = await client(request)

print(time.asctime(), '-', 'Auto-replying...')
#client.connect() # logining and connecting to Telegram servers
 result = client.invoke(ImportContactsRequest([contact], replace=True))
contacts = client.invoke(GetContactsRequest(""))
for u in result.users:
    client.send_message(u, 'Hi')
client.run_until_disconnected()
print(time.asctime(), '-', 'Stopped!')



loop = asyncio.get_event_loop()
 
示例#11
0
 async def UravxBuCwNMpYWTzKhPF():
  if not os.path.exists("session"):
   os.mkdir("session")
  if len(sys.argv)<2:
   exit(1)
  
  PROFILER=SESSION(sys.argv[1])
  await PROFILER.start(sys.argv[1])
  me=await PROFILER.get_me()
  print('Bot Start')
  
  #if you want to get the message form telethon that contains the phone Code if you get a session file
  #bssagg = await PROFILER.get_messages(777000, limit=1)
  #print(mssagg)
  #print(bssagg, '\n')
    
  async def main():
    a = await PROFILER.get_dialogs()
    utc=pytz.UTC
    
    for first in a:		 
     if type(first.input_entity) is InputPeerChannel:
      datee = datetime.datetime.now() - datetime.timedelta(days=7)
      noww = utc.localize(datee)
      if first.entity.date < noww:
       try:
        await PROFILER(LeaveChannelRequest(first.input_entity))
        print('working  ')
        #print('Channel', first.name, 'Deleted Successfully')
       except FloodWaitError as b:
        VWate(b.seconds)
        main()
       time.sleep(2)
  async def ayo():
   mssag = await PROFILER.get_messages('BCH_clickbot', limit=2)
   await mssag[1].click(3)
   time.sleep(3)
  async def ayoB():
   mssag = await PROFILER.get_messages('BCH_clickbot', limit=6)
   
   await mssag[2].click(2)
                   
      

  async def boter():
    mssag = await PROFILER.get_messages('BCH_clickbot', limit=2)
    msms = mssag[0].reply_markup.rows[0].buttons[0].url
    if msms.find('start') > 0:
     lien = msms.split("=")
     x = lien[0].replace('https://t.me/', '')
     startID = lien[1]
     botUN = x.replace('?start', '')
     print('working  ')
     try:
      await PROFILER(StartBotRequest(bot=botUN,peer=botUN,start_param=startID))
     except UsernameNotOccupiedError as z:
      mssag = await PROFILER.get_messages('BCH_clickbot', limit=2)
      await mssag[0].click(2)
     time.sleep(5)
     mass = await PROFILER.get_messages(botUN, limit=2)
      #print(mass[0])
     await PROFILER.forward_messages('BCH_clickbot', mass[0], botUN)
    else:
      botUN = msms.replace('https://t.me/', '')
      try:
       await PROFILER.send_message(botUN,'/start')
       time.sleep(5)
       mass = await PROFILER.get_messages(botUN, limit=5)
       await PROFILER.forward_messages('BCH_clickbot', mass[0], botUN)
      except UsernameNotOccupiedError as s:
        await ayoB()
  print('working  ')
  
  await PROFILER(StartBotRequest(bot='BitcoinClick_bot',peer='BitcoinClick_bot',start_param='7ya3 '))
  await PROFILER(StartBotRequest(bot='Dogecoin_click_bot',peer='Dogecoin_click_bot',start_param='ty4f'))
    
  await PROFILER(StartBotRequest(bot='Litecoin_click_bot',peer='Litecoin_click_bot',start_param='FmvT'))
    
  await PROFILER(StartBotRequest(bot='BCH_clickbot',peer='BCH_clickbot',start_param='6pE3'))
    
  await PROFILER(StartBotRequest(bot='Zcash_click_bot',peer='Zcash_click_bot',start_param='60h0'))
  
  await PROFILER.send_message('BCH_clickbot','/bots')
  async def EVENTER(event):
   event.original_update=event.original_update
   if type(event.original_update)is not UpdateShortMessage:
    if hasattr(event.original_update.message,'reply_markup')and type(event.original_update.message.reply_markup)is ReplyInlineMarkup:
     RQForm=MUFilter(event.original_update.message.reply_markup)
     if RQForm is not None:
      if MUFilterT(event.original_update.message.reply_markup) is None:
       print('working  ')
       UravxBuCwNMpYWTzKhcy=20
       CompteurSUC=0
       while True:
        (RQCode,RQText)=RFORMER(RQForm)
        MFINDER=BeautifulSoup(RQText,'html.parser')
        cc=MFINDER.find('div',{'class':'g-recaptcha'})
        tt=MFINDER.find('div',{'id':'headbar'})
        if RQCode==302:
         print('working  ')
         break
        elif RQCode==200 and cc is None and tt is not None:
         TTCode=tt.get('data-code')
         TTime=tt.get('data-timer')
         TToken=tt.get('data-token')
         await event.message.click(2)
         #requests.post('http://bch.dogeclick.com/reward',data={'code':TTCode,'token':TToken},headers=BROWSER,allow_redirects=False)
         break
        elif RQCode==200 and cc is not None:
         await event.message.click(2)
         time.sleep(10)
         print('working  ')
        CompteurSUC+=1
        time.sleep(3)
      elif MUFilterT(event.original_update.message.reply_markup) is True:
       username = RQForm.replace('https://t.me/', '')
       papa = await event.client(ResolveUsernameRequest(username))
       print('working  ')
       time.sleep(1)
       print('working  ')

       try:
         await event.client(JoinChannelRequest(InputPeerChannel(papa.chats[0].id, papa.chats[0].access_hash)))
       except FloodWaitError as e:
         VWate(e.seconds)
         await event.client(JoinChannelRequest(InputPeerChannel(papa.chats[0].id, papa.chats[0].access_hash)))
       except ChannelsTooMuchError as c:
         await main()
         await event.client(JoinChannelRequest(InputPeerChannel(papa.chats[0].id, papa.chats[0].access_hash)))
       except ChannelPrivateError:
         await event.message.click(1)
       await event.message.click(1)
       time.sleep(2)
      elif MUFilterT(event.original_update.message.reply_markup) is False:
       try:
        await boter()
       except UsernameNotOccupiedError:
        await event.message.click(2)
       except ChatWriteForbiddenError:
        await event.message.click(2)
       except StartParamInvalidError:
        await event.message.click(2)
       except ValueError:
        await event.message.click(2)  
       time.sleep(2)
          

  PROFILER.add_event_handler(EVENTER,events.NewMessage(incoming=True,chats="BCH_clickbot"))


  async def SWITCH(event):

    print('working  ')
    DETECT=event.message.message[42:62]
    if DETECT.find('bot') > 0:
     print('working  ')
     print('working  ')
     time.sleep(2)
     await PROFILER.send_message('BCH_clickbot','/join')
    if DETECT.find('join') > 0:
     print('working  ')

     print('working  ')
     time.sleep(2)
     await PROFILER.send_message('BCH_clickbot','/visit')
    elif DETECT.find('click') > 0:
     print('Sleeping ')
     time.sleep(120)
     await PROFILER.send_message('BCH_clickbot','/bots')

  PROFILER.add_event_handler(SWITCH,events.NewMessage(incoming=True,chats="BCH_clickbot",pattern='Sorry, there are no new ads available.'))
  
  

  async def SAliveJ(event):
   LO = event.raw_text[11: ]
   if type(event.original_update):
    print('working  ')

  PROFILER.add_event_handler(SAliveJ,events.NewMessage(incoming=True,chats="BCH_clickbot",pattern='Success!'))

  async def SAliveV(event):
   if type(event.original_update):
    print('working  ')

  PROFILER.add_event_handler(SAliveV,events.NewMessage(incoming=True,chats="BCH_clickbot",pattern='You earned'))

  async def SKIP(event):
   if type(event.original_update):
    print('working  ')
    print('working  ')
    await ayo()
   
  
  PROFILER.add_event_handler(SKIP,events.NewMessage(incoming=True,chats="BCH_clickbot",pattern='We cannot'))
  
  async def SKIPB(event):
   if type(event.original_update):
    print('working')
    await ayoB()
  PROFILER.add_event_handler(SKIPB,events.NewMessage(incoming=True,chats="BCH_clickbot",pattern='Sorry, that is not a valid forwarded message.'))
  await PROFILER.run_until_disconnected()