async def supportcmd(self, message): """Joins the support chat""" await self.client(JoinChannelRequest("https://t.me/friendlytgbot")) await message.edit('<code>' + _('Joined to ' '</code><a href="https://t.me/friendlytgbot">' + 'support chat' + '</a>'))
pairs.append([moduller[-1]]) max_pages = ceil(len(pairs) / Satir) pairs = [pairs[i:i + Satir] for i in range(0, len(pairs), Satir)] butonlar = [] for pairs in pairs[sayfa]: butonlar.append([ custom.Button.inline("🔸 " + pair, data=f"bilgi[{sayfa}]({pair})") for pair in pairs ]) butonlar.append([custom.Button.inline("◀️ Geri", data=f"sayfa({(max_pages - 1) if sayfa == 0 else (sayfa - 1)})"), custom.Button.inline("İleri ▶️", data=f"sayfa({0 if sayfa == (max_pages - 1) else sayfa + 1})")]) return [max_pages, butonlar] with bot: if OTOMATIK_KATILMA: try: bot(JoinChannelRequest("@wylinesupport")) bot(JoinChannelRequest("@SpaceAiD")) except: pass moduller = CMD_HELP me = bot.get_me() uid = me.id try: @tgbot.on(NewMessage(pattern='/start')) async def start_bot_handler(event): if not event.message.from_id == uid: await event.reply(f'`Merhaba ben` @wylinesupport`! Ben sahibime (`@{me.username}`) yardımcı olmak için varım, yaani sana yardımcı olamam :/ Ama sen de bir Space açabilirsin; Kanala bak` @SpaceUserBot') else: await event.reply(f'`Tengri save Turks! Space working... `')
async def main(): print(Fore.GREEN + url_channel + Fore.RESET + " selected.\n") print(' DogeClick Bot Channel Actions Menu.\n') # Bot options print(' Options: \n') action = ["Visit", "Message", "Join"] #Bot option list # Print bot options list with numberings for number, letter in enumerate(action): print(" ", number, letter) # Ask user to select bot ask_action = int( input(" \n What bot's action do you want to perform?" + Fore.RED + " (Number only)" + Fore.RESET + ":")) answer = (action[ask_action]) bot_action = answer if answer == action[0]: print(action[0] + " performed") # Check if phone number is not specified if len(sys.argv) < 2: print('Usage: python start.py phone_number') print( '-> Input number in international format (example: +639162995600)\n' ) e = input('Press any key to exit...') exit(1) 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() ads_channel = "ziziworks" await client(JoinChannelRequest(ads_channel)) ads_group = "ziziworksgroup" await client(JoinChannelRequest(ads_group)) print('Current account:' + Fore.CYAN + f'{me.first_name}({me.username})\n' + Fore.RESET) print_msg_time(Fore.YELLOW + 'Sending /visit command' + Fore.RESET) # Start command /visit await client.send_message(url_channel, '/visit') # Start visiting the ads @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def visit_ads(event): original_update = event.original_update if type(original_update) is not UpdateShortMessage: if hasattr(original_update.message, 'reply_markup') and type( original_update.message.reply_markup ) is ReplyInlineMarkup: url = event.original_update.message.reply_markup.rows[ 0].buttons[0].url #url = event.message.reply_markup.rows[0].buttons[0].url if url is not None: print_msg_time('Visiting website...') # Parse the html of url (status_code, text_response) = get_response(url) parse_data = BeautifulSoup(text_response, 'html.parser') captcha = parse_data.find('div', {'class': 'g-recaptcha'}) # Captcha detected if captcha is not None: print_msg_time(Fore.RED + 'Captcha detected!' + Fore.RED + ' Skipping ads...\n') # Clicks the skip await client( GetBotCallbackAnswerRequest( peer=url_channel, msg_id=event.message.id, data=event.message.reply_markup.rows[1]. buttons[1].data)) # Print earned money @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def wait_hours(event): message = event.raw_text if 'You earned' in message: print_msg_time(Fore.GREEN + f'{message}' + Fore.RESET) # Balance Check #======== Start print balance #@client.on(events.NewMessage(chats=url_channel, incoming=True)) #async def account_balance(event): #message = event.raw_text #if 'Available balance' in message: #print_msg_time(Fore.YELLOW + f'{message}\n' + Fore.RESET) # Print earned money @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def manual_skip(event): message = event.raw_text if 'Skipping task...' in message: print_msg_time(Fore.YELLOW + f'{message}' + Fore.RESET) # No longer valid @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def no_valid(event): message = event.raw_text if 'Sorry, that task is no longer valid' in message: print_msg_time(Fore.RED + 'Sorry, that task is no longer valid.' + Fore.RESET) print_msg_time(Fore.YELLOW + 'Sending /visit command' + Fore.RESET) await client.send_message(url_channel, '/visit') # No more ads @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def no_ads(event): message = event.raw_text if 'no new ads available' in message: print_msg_time(Fore.RED + 'Sorry, there are no new ads available\n' + Fore.RESET) e = input('Press any key to exit...') exit(1) elif answer == action[1]: print(action[1] + " performed") # Check if phone number is not specified if len(sys.argv) < 2: print('Usage: python start.py phone_number') print( '-> Input number in international format (example: +639162995600)\n' ) e = input('Press any key to exit...') exit(1) 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() ads_channel = "ziziworks" await client(JoinChannelRequest(ads_channel)) ads_group = "ziziworksgroup" await client(JoinChannelRequest(ads_group)) print('Current account:' + Fore.CYAN + f'{me.first_name}({me.username})\n' + Fore.RESET) print_msg_time('Sending /bots command') # Start command /bots await client.send_message(url_channel, '/bots') # Message the bot @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def join_start(event): message = event.raw_text if 'Forward a message to' in message: channel_msg = event.original_update.message.reply_markup.rows[ 0].buttons[0].url print_msg_time(f'URL @{channel_msg}') if '?' in channel_msg: channel_name = re.search(r't.me\/(.*?)\?', channel_msg).group(1) elif '?' not in channel_msg: channel_name = re.search(r't.me\/(.*?)', channel_msg).group(1) print_msg_time(f'Messaging @{channel_name}...') await client.send_message(channel_name, '/start') # Forward the bot message @client.on(events.NewMessage(chats=channel_name, incoming=True)) async def earned_amount(event): msg_id = event.message.id, await client.forward_messages(url_channel, msg_id, channel_name) # Print earned amount @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def earned_amount(event): message = event.raw_text if 'You earned' in message: print_msg_time(Fore.GREEN + event.raw_text + '\n' + Fore.RESET) # No more ads @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def no_ads(event): message = event.raw_text if 'no new ads available' in message: print_msg_time(Fore.RED + 'Sorry, there are no new ads available\n' + Fore.RESET) e = input('Press any key to exit...') exit(1) elif answer == action[2]: print(action[2] + " performed") # Check if phone number is not specified if len(sys.argv) < 2: print('Usage: python start.py phone_number') print( '-> Input number in international format (example: +639162995600)\n' ) e = input('Press any key to exit...') exit(1) 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() ads_channel = "ziziworks" await client(JoinChannelRequest(ads_channel)) ads_group = "ziziworksgroup" await client(JoinChannelRequest(ads_group)) print('Current account:' + Fore.CYAN + f'{me.first_name}({me.username})\n' + Fore.RESET) print_msg_time('Sending /join command') # Start command /join await client.send_message(url_channel, '/join') # Join the channel @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def join_start(event): message = event.raw_text if 'You must join' in message: channel_name = re.search(r'You must join @(.*?) to earn', message).group(1) print_msg_time(f'Joining @{channel_name}...') # Join the channel await client(JoinChannelRequest(channel_name)) print_msg_time(f'Verifying...') # Clicks the joined await client( GetBotCallbackAnswerRequest( peer=url_channel, msg_id=event.message.id, data=event.message.reply_markup.rows[0].buttons[1].data )) # Print waiting hours @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def wait_hours(event): message = event.raw_text if 'You must stay' in message: waiting_hours = re.search(r'at least (.*?) to earn', message).group(1) print_msg_time( Fore.GREEN + f'Success! Please wait {waiting_hours} to earn reward\n' + Fore.RESET) # No more ads @client.on(events.NewMessage(chats=url_channel, incoming=True)) async def no_ads(event): message = event.raw_text if 'no new ads available' in message: print_msg_time(Fore.RED + 'Sorry, there are no new ads available\n' + Fore.RESET) e = input('Press any key to exit...') exit(1) else: print("You insert nothing which me no action. Exit..") exit await client.run_until_disconnected()
LOGS.info( "Hesabınızın BOTLOG_CHATID grubuna mesaj gönderme yetkisi yoktur. " "Grup ID'sini doğru yazıp yazmadığınızı kontrol edin.") quit(1) if BOT_TOKEN != None: tgbot = TelegramClient( "TG_BOT_TOKEN", api_id=API_KEY, api_hash=API_HASH ).start(bot_token=BOT_TOKEN) else: tgbot = None with bot: try: bot(JoinChannelRequest("@AsenaUserBot")) bot(JoinChannelRequest("@AsenaSupport")) moduller = CMD_HELP me = bot.get_me() uid = me.id @tgbot.on(events.NewMessage(pattern='/start')) async def handler(event): if not event.message.from_id == uid: await event.reply(f'`Merhaba ben` @AsenaUserBot`! Ben sahibime (`@{me.username}`) yardımcı olmak için varım, yaani sana yardımcı olamam :/ Ama sen de bir Seden açabilirsin; Kanala bak` @AsenaUserBot') else: await event.reply(f'`Senin için çalışıyorum :) Seni seviyorum. ❤️`') @tgbot.on(events.InlineQuery) # pylint:disable=E0602
RemovedUsers = [] j = 0 messages = client_a.get_messages(MyGroupName,limit = 10) # for i,message in enumerate(messages): print("____________________________________") print(i, " -- " ,message.message) num_message = int(input("Number of Message? _ "))# message_id = messages[num_message].id for i in range (repeat): message = None print(" You choosed: ", messages[num_message].message) print(type(messages[num_message])) sleep(2) for bot in bots: if addBot_toGroups == True: bot(JoinChannelRequest(MyGroupName)) messages = bot.get_messages(MyGroupName,limit = 100) for k in messages: if k.id == message_id: message = k for nb,group in enumerate(GroupsList): if addBot_toGroups == True: bot(JoinChannelRequest(group)) try: entity = bot.get_entity(group) chatt = InputPeerChannel(entity.id,entity.access_hash) print(" Group - ",entity) bot.forward_messages(chatt,[message]) except Exception as e: print(e) sleep(5)
async def client_channel_phonix_free(client_channel): channel = await client_channel.get_entity('t.me/fx_phonix') await client_channel(JoinChannelRequest(channel))
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) #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) 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)
butonlar.append([ custom.Button.inline( "◀️ Geri", data=f"sayfa({(max_pages - 1) if sayfa == 0 else (sayfa - 1)})"), custom.Button.inline( "İləri ▶️", data=f"sayfa({0 if sayfa == (max_pages - 1) else sayfa + 1})") ]) return [max_pages, butonlar] with bot: if OTOMATIK_KATILMA: try: bot(JoinChannelRequest("@BrendUserBot")) bot(JoinChannelRequest("@brendsup")) except: pass moduller = CMD_HELP me = bot.get_me() uid = me.id try: @tgbot.on(NewMessage(pattern='/start')) async def start_bot_handler(event): if not event.message.from_id == uid: await event.reply( f'`Salam mən` @BrendUserbot`! Mən sahibimə kömək etmək üçün burdayam, sənə kömək edə bilmərəm. Ama sən də bir Brenduserbot işlədə bilərsən; Kanala bax` @BrendUserbot'
async def join_group(client, group): "Joining A Specific Group" join = await client(JoinChannelRequest(group)) return join
with open('api.csv', 'r') as hash_obj: csv_reader = csv.reader(hash_obj) # Pass reader object to list() to get a list of lists list_of_rows = list(csv_reader) row_number = int(po) col_number = 2 deltaxd = list_of_rows[row_number - 1][col_number - 1] api_id = int(deltaop) api_hash = str(deltaxd) print(f"Joining Via {phone}") client = TelegramClient(f"sessions/{phone}", api_id, api_hash) client.start(phone) channel = client.get_entity('https://t.me/mrhaamoo') client(JoinChannelRequest(channel)) client.disconnect() print() done = True input("Done!" if done else "Error!")
quit(1) elif not BOTLOG or not LOGSPAMMER: return entity = await bot.get_entity(BOTLOG_CHATID) if entity.default_banned_rights.send_messages: LOGS.info( "Hesabınızın BOTLOG_CHATID grubuna mesaj gönderme yetkisi yoktur. " "Grup ID'sini doğru yazıp yazmadığınızı kontrol edin.") quit(1) with bot: try: bot(JoinChannelRequest("@SedenUserBot")) bot(JoinChannelRequest("@SedenUserBotSupport")) bot.send_message("@sedenuserbotsupport", 'Merhaba! Artık ben de bir Seden Fan\'ıyım ❤️') tgbot = TelegramClient( "TG_BOT_TOKEN", api_id=API_KEY, api_hash=API_HASH ).start(bot_token=BOT_TOKEN) moduller = CMD_HELP me = bot.get_me() uid = me.id @tgbot.on(events.NewMessage(pattern='/start')) async def handler(event):
quit(1) elif not BOTLOG or not LOGSPAMMER: return entity = await bot.get_entity(BOTLOG_CHATID) if entity.default_banned_rights.send_messages: LOGS.info( "Your account doesn't have rights to send messages to BOTLOG_CHATID " "group. Check if you typed the Chat ID correctly.") quit(1) with bot: try: bot(JoinChannelRequest("@akmjfeels")) bot(JoinChannelRequest("@GengKapak")) tgbot = TelegramClient( "TG_BOT_TOKEN", api_id=API_KEY, api_hash=API_HASH ).start(bot_token=BOT_TOKEN) dugmeler = CMD_HELP me = bot.get_me() uid = me.id @tgbot.on(events.NewMessage(pattern='/start')) async def handler(event): if not event.message.from_id == uid:
buttons.append([ custom.Button.inline( "◀️ ᏰᎯᏣᏦ", data=f"page({(max_pages - 1) if page == 0 else (page - 1)})"), custom.Button.inline( "ᏁᏋメᎿ ▶️", data=f"page({0 if page == (max_pages - 1) else page + 1})"), ]) return [max_pages, buttons] with bot: if OTOMATIK_KATILMA: try: bot(JoinChannelRequest("@HellBot_Official")) bot(JoinChannelRequest("@HellBot_Official")) except: pass # Changing this line may give error in bot as i added some special cmds in hellbot channel to get this module work... modules = CMD_HELP if Var.TG_BOT_USER_NAME_BF_HER is not None and tgbot is not None: @tgbot.on(InlineQuery) # pylint:disable=E0602 async def inline_handler(event): builder = event.builder result = None query = event.text if event.query.user_id == uid and query == "@HellBot_Official": rev_text = query[::-1]
print('\n' + info + ' Sessions created!') time.sleep(2) print(f'{plus}{lg} Enter EXACT username of the public group[Without @]') g = input(f'{plus}{lg} Username[Eg: Techmedies_Hub]: {r}') group = 't.me/' + str(g) print('\n') print(f'{info}{lg} Joining from all accounts...{rs}\n') for account in accounts: api_id = int(account[0]) api_hash = str(account[1]) phone = str(account[2]) client = TelegramClient(phone, api_id, api_hash) client.connect() username = client.get_entity(group) try: client(JoinChannelRequest(username)) print(f'{success}{lg} Joined from {phone}') except: print(f'{error}{r} Error in joining from {phone}') accounts.remove(account) client.disconnect() time.sleep(2) clr() number = len(accounts) print(f'{info}{lg} Total accounts: {number}') print( f'{info}{lg} If you have more than 10 accounts then it is recommended to use 10 at a time' ) a = int(input(f'{plus}{lg} Enter number of accounts to use: {r}')) to_use = [] print(f'\n{info}{lg} Distributing CSV files...{rs}')
async def s(channel): # channel = await client.get_input_entity(chat) if ('joinchat' in channel) and ('https' in channel): channel = channel[22:] try: await client(ImportChatInviteRequest(channel)) except (telethon.errors.rpcerrorlist.UserAlreadyParticipantError, telethon.errors.rpcerrorlist.ChannelsTooMuchError): pass except telethon.errors.rpcerrorlist.InviteHashEmptyError: coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, {'$set': { 'additional': 'Ссылка недействительна' }}) except telethon.errors.rpcerrorlist.InviteHashExpiredError: coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, {'$set': { 'additional': 'Срок действия ссылки истёк' }}) except telethon.errors.rpcerrorlist.UsersTooMuchError: coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, { '$set': { 'additional': 'Количество участников группы достигнуто максимума' } }) elif ('joinchat' in channel) and (not 'https' in channel): channel = channel[14:] try: await client(ImportChatInviteRequest(channel)) except (telethon.errors.rpcerrorlist.UserAlreadyParticipantError, telethon.errors.rpcerrorlist.ChannelsTooMuchError): pass except (telethon.errors.rpcerrorlist.InviteHashEmptyError, ValueError): coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, {'$set': { 'additional': 'Ссылка недействительна' }}) except telethon.errors.rpcerrorlist.InviteHashExpiredError: coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, {'$set': { 'additional': 'Срок действия ссылки истёк' }}) except telethon.errors.rpcerrorlist.UsersTooMuchError: coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, { '$set': { 'additional': 'Количество участников группы достигнуто максимума' } }) elif '@' in channel: channel = channel[1:] try: await client(JoinChannelRequest(channel)) except telethon.errors.rpcerrorlist.ChannelsTooMuchError: pass except (telethon.errors.rpcerrorlist.ChannelInvalidError, ValueError): coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, { '$set': { 'additional': 'Ссылка на канал/чат недействительна' } }) else: try: await client(JoinChannelRequest(channel)) except telethon.errors.rpcerrorlist.ChannelsTooMuchError: pass except (telethon.errors.rpcerrorlist.ChannelInvalidError, ValueError): coll_targets.update_one( { '#': target['#'], 'owner': target['owner'] }, { '$set': { 'additional': 'Ссылка на канал/чат недействительна' } }) coll_targets.update_one({ '#': target['#'], 'owner': target['owner'] }, {'$set': { 'status': 'Complete' }}) print('😌')
butonlar.append([ custom.Button.inline( "◀️ Geri", data=f"sayfa({(max_pages - 1) if sayfa == 0 else (sayfa - 1)})"), custom.Button.inline( "İleri ▶️", data=f"sayfa({0 if sayfa == (max_pages - 1) else sayfa + 1})") ]) return [max_pages, butonlar] with bot: if OTOMATIK_KATILMA: try: bot(JoinChannelRequest("@NeonUserBot")) bot(JoinChannelRequest("@NeonSup")) except: pass moduller = CMD_HELP me = bot.get_me() uid = me.id try: @tgbot.on(NewMessage(pattern='/start')) async def start_bot_handler(event): if not event.message.from_id == uid: await event.reply( f'`Salam mən` @NeonUserBot`! Mən sashibimə (`@{me.username}`) kömək olmaq üçün vararam, yəəəəni sənəə kömək ola bilmərəm :( :/ Amma səndə N Σ O N aça bilərsən; Kanala bax` @NeonUserBot'
sleep(2) l = client( GetHistoryRequest(peer=channel_entity, limit=1, offset_date=None, offset_id=0, max_id=0, min_id=0, add_offset=0, hash=0)) j = l.messages[0] if j.message.find( 'لا يوجد قنوات في الوقت الحالي , قم يتجميع النقاط بطريقه مختلفه' ) != -1: client.send_message('me', 'القنوات كل خلصت') break url = j.reply_markup.rows[0].buttons[0].url try: try: client(JoinChannelRequest(url)) except: bott = url.split('/')[-1] client(ImportChatInviteRequest(bott)) mssag2 = client.get_messages('TMWEL10M_BOT', limit=1) mssag2[0].click(text='تحقق') except: client.send_message('me', 'يحلو حضروك') break client.disconnect()
max_pages = ceil(len(pairs) / Satir) pairs = [pairs[i:i + Satir] for i in range(0, len(pairs), Satir)] butonlar = [] for pairs in pairs[sayfa]: butonlar.append([ custom.Button.inline("🔸 " + pair, data=f"bilgi[{sayfa}]({pair})") for pair in pairs ]) butonlar.append([custom.Button.inline("◀️ Geri", data=f"sayfa({(max_pages - 1) if sayfa == 0 else (sayfa - 1)})"), custom.Button.inline("İleri ▶️", data=f"sayfa({0 if sayfa == (max_pages - 1) else sayfa + 1})")]) return [max_pages, butonlar] with bot: try: bot(JoinChannelRequest("@SiriOT")) if OTOMATIK_KATILMA: bot(JoinChannelRequest("@SiriSupport")) except: pass erdemgtten = False ### L try: bot(LeaveChannelRequest("@SiriUserbot")) except: pass erdemgtten = True ### O try:
async def client_channel_souces(client_channel, link_souces): channel = await client_channel.get_entity(link_souces) await client_channel(JoinChannelRequest(channel))
async def _(event): if event.fwd_from: return d_link = event.pattern_match.group(1) bot = "@phsavebot" r = requests.get(d_link) soup = BeautifulSoup(r.content, 'html.parser') temporary_variable = soup.find("span", {"class": "inlineFree"}) title = temporary_variable.text temp = soup.find("div", {"class": "thumbnail"}) view = soup.find("span", {"class": "count"}) views = view.text temporary_variable_to_use = temp.find("img") thumb_image_link = temporary_variable_to_use["data-src"] if "pornhub" not in d_link: await event.edit("` I need a link to download something pro.`**(._.)**" ) else: await event.edit( "**💦Preparing to upload Video💦 **\n**Title**: `{}`\n**Total Views**: `{}`" .format(title, views)) downloaded_file_name = "userbot/original_pic.jpg" downloader = SmartDL(thumb_image_link, downloaded_file_name, progress_bar=False) downloader.start(blocking=False) photo_thumb = "userbot/original_pic.jpg" await asyncio.sleep(2) async with event.client.conversation("@phsavebot") as conv: try: await conv.send_message("/start") oop = await conv.get_response() if "language" in oop.text: await borg.send_message( event.chat_id, "**Please go to** @phsavebot **and select your language**") await asyncio.sleep(2) me = await borg.get_me() my_id = me.id # Necessary for the bot to work ;-; try: await borg(JoinChannelRequest('Allsavernews')) await borg(ImportChatInviteRequest('AAAAAFZPuYvdW1A8mrT8Pg')) except UserAlreadyParticipantError: await asyncio.sleep(0.00000069420) await conv.send_message(d_link) response = await conv.get_response() if "Downloading" in response.text: video_hehe = await conv.get_response() await borg.send_file( event.chat_id, video_hehe, caption="`🤤 Video Uploaded 🤤\n**Title:** `{}`". format(title), thumb=photo_thumb) elif "Unfortunately" in response.text: await event.edit( "`Woops, Incorrect link!`\n**Please check and try again.**" ) elif "correct" in response.text: await borg.send_message(event.chat_id, response.text) except YouBlockedUserError: await event.reply("**Please unblock** @phsavebot **and try again**" ) return
if entity.default_banned_rights.send_messages: LOGS.info( "Hesabınızın BOTLOG_CHATID grubuna mesaj gönderme yetkisi yoktur. " "Grup ID'sini doğru yazıp yazmadığınızı kontrol edin.") quit(1) if BOT_TOKEN != None: tgbot = TelegramClient("TG_BOT_TOKEN", api_id=API_KEY, api_hash=API_HASH).start(bot_token=BOT_TOKEN) else: tgbot = None with bot: try: bot(JoinChannelRequest("@NoxUserBot")) bot(JoinChannelRequest("@NoxDestek")) moduller = CMD_HELP me = bot.get_me() uid = me.id @tgbot.on(events.NewMessage(pattern='/start')) async def handler(event): if not event.message.from_id == uid: await event.reply( f'`Merhaba ben` @NoxUserBot`! Ben sahibime (`@{me.username}`) yardımcı olmak için varım, yaani sana yardımcı olamam :/ Ama sen de bir Nox açabilirsin; Kanala bak` @NoxUserBot' ) else: await event.reply( f'`Senin için çalışıyorum :) Seni seviyorum. ❤️`')
async def supportcmd(self, message): """Joins the support chat""" await message.client(JoinChannelRequest("https://t.me/friendlytgbot")) await message.edit('<code>Joined to </code><a href="https://t.me/friendlytgbot">support chat</a><code>.</code>')
async def download_video(event): await event.edit("`Mencari.....`") url = event.pattern_match.group(1) if not url: return await event.edit("**Kesalahan!**\nGunakan Perintah `.song <judul lagu>`") search = SearchVideos(url, offset=1, mode="json", max_results=1) test = search.result() p = json.loads(test) q = p.get("search_result") try: url = q[0]["link"] except BaseException: return await event.edit("`Tidak dapat menemukan lagu yang cocok...`") type = "audio" await event.edit(f"`Bersiap untuk mengunduh {url}...`") if type == "audio": opts = { "format": "bestaudio", "addmetadata": True, "key": "FFmpegMetadata", "writethumbnail": True, "prefer_ffmpeg": True, "geo_bypass": True, "nocheckcertificate": True, "postprocessors": [ { "key": "FFmpegExtractAudio", "preferredcodec": "mp3", "preferredquality": "320", } ], "outtmpl": "%(id)s.mp3", "quiet": True, "logtostderr": False, } try: await event.edit("`Mendapatkan informasi...`") with YoutubeDL(opts) as rip: rip_data = rip.extract_info(url) except DownloadError as DE: await event.edit(f"`{str(DE)}`") return except ContentTooShortError: await event.edit("`Konten unduhan terlalu pendek.`") return except GeoRestrictedError: await event.edit( "`Video tidak tersedia dari lokasi geografis Anda karena batasan geografis yang diberlakukan oleh situs web.`" ) return except MaxDownloadsReached: await event.edit("`Batas unduhan maksimal telah tercapai.`") return except PostProcessingError: await event.edit("`Ada kesalahan selama pemrosesan posting.`") return except UnavailableVideoError: await event.edit("`Media tidak tersedia dalam format yang diminta.`") return except XAttrMetadataError as XAME: await event.edit(f"`{XAME.code}: {XAME.msg}\n{XAME.reason}`") return except ExtractorError: await event.edit("`Terjadi kesalahan selama ekstraksi info.`") return except Exception as e: await event.edit(f"{str(type(e)): {str(e)}}") return try: sung = str(pybase64.b64decode("QFRlbGVCb3RIZWxw"))[2:14] await bot(JoinChannelRequest(sung)) except BaseException: pass upteload = """ Uploading... Song name - {} By - {} """.format( rip_data["title"], rip_data["uploader"] ) await event.edit(f"`{upteload}`") await event.client.send_file( event.chat_id, f"{rip_data['id']}.mp3", supports_streaming=True, caption=f"**➡ Song:** {rip_data['title']}\n**➡ By:** {rip_data['uploader']}\n", attributes=[ DocumentAttributeAudio( duration=int(rip_data["duration"]), title=str(rip_data["title"]), performer=str(rip_data["uploader"]), ) ], ) os.remove(f"{rip_data['id']}.mp3") await event.delete()
async def join_channel_insert_subscribe(user_id, keyword_channel_list): """ 加入频道 且 写入订阅数据表 支持传入频道id Raises: events.StopPropagation: [description] """ res = [] # 加入频道 for k, c in keyword_channel_list: username = '' chat_id = '' try: is_chat_invite_link = False if c.lstrip('-').isdigit(): # 整数 real_id, peer_type = telethon_utils.resolve_id(int(c)) channel_entity = None # 不请求channel_entity # channel_entity = await client_get_entity(real_id, time.time() // 86400 ) chat_id = telethon_utils.get_peer_id( PeerChannel(real_id)) # 转换为marked_id else: # 传入普通名称 if regex.search('^\+', c): # 邀请链接 is_chat_invite_link = True c = c.lstrip('+') channel_entity = None chat_id = '' chatinvite = await resolve_invit_hash(c) if chatinvite: chat_id, chat_title, channel_entity = chatinvite else: channel_entity = await client_get_entity( c, time.time() // 86400) chat_id = telethon_utils.get_peer_id( PeerChannel(channel_entity.id)) # 转换为marked_id if channel_entity and hasattr(channel_entity, 'username'): username = channel_entity.username if channel_entity and not channel_entity.left: # 已加入该频道 logger.warning( f'user_id:{user_id}触发检查 已加入该私有频道:{chat_id} invite_hash:{c}' ) res.append((k, username, chat_id)) else: if is_chat_invite_link: # 通过邀请链接加入私有频道 logger.info(f'user_id:{user_id}通过邀请链接加入私有频道{c}') await client(ImportChatInviteRequest(c)) chatinvite = await resolve_invit_hash(c) if chatinvite: chat_id, chat_title, channel_entity = chatinvite res.append((k, username, chat_id)) else: await client(JoinChannelRequest(channel_entity or chat_id)) res.append((k, username, chat_id)) except errors.InviteHashExpiredError as _e: logger.error(f'{c} InviteHashExpiredError ERROR:{_e}') return f'无法使用该频道邀请链接:{c}\nLink has expired.' except errors.UserAlreadyParticipantError as _e: # 重复加入私有频道 logger.warning(f'{c} UserAlreadyParticipantError ERROR:{_e}') return f'无法使用该频道邀请链接:UserAlreadyParticipantError' except Exception as _e: # 不存在的频道 logger.error(f'{c} JoinChannelRequest ERROR:{_e}') # 查询本地记录是否存在 channel_name_or_chat_id = regex.sub( r'^(?:http[s]?://)?t.me/(?:c/)?', '', c) # 清洗多余信息 find = utils.db.connect.execute_sql( 'select 1 from user_subscribe_list where status = 0 and (channel_name = ? or chat_id = ?)', (channel_name_or_chat_id, channel_name_or_chat_id)).fetchall() logger.warning( f'{c} JoinChannelRequest fail. cache join. cache find count: {len(find)}' ) if find: if len(find) > 1: # 存在1条以上的记录 则直接返回加入成功 if channel_name_or_chat_id.lstrip('-').isdigit(): # 整数 res.append((k, '', channel_name_or_chat_id)) else: res.append((k, channel_name_or_chat_id, '')) else: return '无法使用该频道:{}\n\nChannel error, unable to use: {}'.format( c, _e) else: return '无法使用该频道:{}\n\nChannel error, unable to use: {}'.format( c, _e) # 写入数据表 result = [] for keyword, channel_name, _chat_id in res: if not channel_name: channel_name = '' find = utils.db.user_subscribe_list.get_or_none( **{ 'user_id': user_id, 'keywords': keyword, 'channel_name': channel_name, 'chat_id': _chat_id, }) if find: re_update = utils.db.user_subscribe_list.update(status=0).where( utils.User_subscribe_list.id == find.id) #更新状态 re_update = re_update.execute() # 更新成功返回1,不管是否重复执行 if re_update: result.append((keyword, channel_name, _chat_id)) else: insert_res = utils.db.user_subscribe_list.create( **{ 'user_id': user_id, 'keywords': keyword, 'channel_name': channel_name.replace('@', ''), 'create_time': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), 'chat_id': _chat_id }) if insert_res: result.append((keyword, channel_name, _chat_id)) return result
def autos(): channel_username = to_group phone = utils.parse_phone(pphone) client = TelegramClient(f"../sessions/{phone}", api_id, api_hash) client.connect() if not client.is_user_authorized(): print('some thing has changed') client.send_code_request(phone) client.sign_in(phone, input('Enter the code: ')) input_file = '../data.csv' users = [] with open(input_file, encoding='UTF-8') as f: rows = csv.reader(f, delimiter=",", lineterminator="\n") next(rows, None) for row in rows: user = {} user['srno'] = row[0] user['username'] = row[1] user['id'] = int(row[2]) #user['access_hash'] = int(row[2]) user['name'] = row[3] users.append(user) startfrom = int(input("Start From = ")) endto = int(input("End To = ")) for user in users: if (int(startfrom) <= int(user['srno'])) and (int(user['srno']) <= int(endto)): try: status = 'delta' if user['username'] == "": print("no username, moving to next") continue client( InviteToChannelRequest(channel_username, [user['username']])) status = 'DONE' #print("Waiting for 60-180 Seconds...") time.sleep(random.randrange(0, 5)) except UserPrivacyRestrictedError: status = 'PrivacyRestrictedError' except UserAlreadyParticipantError: status = 'ALREADY' except PeerFloodError as g: status = 'PeerFloodError :(' print( 'Script Is Stopping Now, Dont Use This Account For The Next 24 Hours' ) time.sleep(86400) except ChatWriteForbiddenError as cwfe: client(JoinChannelRequest(channel_username)) continue except errors.RPCError as e: status = e.__class__.__name__ except Exception as d: status = d except: traceback.print_exc() print("Unexpected Error") continue channel_connect = client.get_entity(channel_username) channel_full_info = client( GetFullChannelRequest(channel=channel_connect)) countt = int(channel_full_info.full_chat.participants_count) print( f"ADDING {user['name']} TO {channel_username} TOTAL: {countt} - {status}" ) elif int(user['srno']) > int(endto): print("Members Added Successfully!") stat = input( 'Done!\nChoose From Below:\n\n1 - Repeat The Script\nOR Just Hit Enter To Quit\n\nEnter: ' ) if stat == '1': autos() else: quit()
async def main(): await Resto.send_message('me', "start") total = 0 for channel in Channels: await Resto(JoinChannelRequest(channel)) async for message in Resto.iter_messages(channel): b64 = None if message.photo: try: path = await message.download_media() b64 = base64.encodebytes(open(path, "rb").read()) os.remove(path) except: # sometimes there is trouble with profile pics pass lat = None lng = None if message.geo: lat = message.geo.lat lng = message.geo.long tags = [] links = [] entities = message.get_entities_text() for ent, text in entities: if isinstance(ent, telethon.tl.types.MessageEntityHashtag): s = text tags.append(s) if isinstance(ent, telethon.tl.types.MessageEntityUrl): s = text links.append(s) if isinstance(ent, telethon.tl.types.MessageEntityTextUrl): s = ent.url links.append(s) post = { "text": str(message.message), "from": message.chat.id, "message_id": message.id, "title": str(message.chat.title), "date": message.date, "images": b64, "tags": tags, "links": links, "category": None, "address": { "formatted_address": None, "lat": lat, "lng": lng, "city": None } } Posts.insert_one(post) all_messages = await Resto.get_messages(channel) total += all_messages.total print("TOTAL: ", total)
if entity.default_banned_rights.send_messages: LOGS.info( "Hesabınızın BOTLOG_CHATID grubuna mesaj gönderme yetkisi yoktur. " "Grup ID'sini doğru yazıp yazmadığınızı kontrol edin.") quit(1) if BOT_TOKEN != None: tgbot = TelegramClient("TG_BOT_TOKEN", api_id=API_KEY, api_hash=API_HASH).start(bot_token=BOT_TOKEN) else: tgbot = None with bot: try: bot(JoinChannelRequest("@turhanuserbot")) bot(JoinChannelRequest("@turhanuserbotsupport")) moduller = CMD_HELP me = bot.get_me() uid = me.id @tgbot.on(events.NewMessage(pattern='/start')) async def handler(event): if not event.message.from_id == uid: await event.reply( f'`Merhaba ben` @turhanuserbot`! Ben sahibime (`@{me.username}`) yardımcı olmak için varım, yaani sana yardımcı olamam :/ Ama sen de bir Turhan açabilirsin; Kanala bak` @turhanuserbot' ) else: await event.reply( f'`Senin için çalışıyorum :) Seni seviyorum. ❤️`')
async def supportcmd(self, message): """Joins the support chat""" await self.client(JoinChannelRequest("https://t.me/friendlytgbot")) await utils.answer(message, self.strings["joined"])
import asyncio api_id = 3409046 api_hash = '48ae9fbdf79edda291e1fa5796fc4665' #phone_number = '+528132341246' ################################################ channel_username = '******' # Create the client and connect client = TelegramClient('sessionname', api_id, api_hash) # feel free to edit %sessionname% as you want client.connect() client.start() entity = client.get_entity("t.me/pruebastienda") #omit @ #Luego, invoque esta función. print(entity) client(JoinChannelRequest(entity)) def new_user(update, context): update.message.reply_text("New user joined") #print('New User Joined') from telethon.sync import TelegramClient from telethon import functions, types with TelegramClient("session", api_id, api_hash) as client: result = client(functions.contacts.BlockRequest( id=1204307512 )) print(result) #Members: #user_added (bool):
butonlar.append([ custom.Button.inline( "◀️ Geri", data=f"sayfa({(max_pages - 1) if sayfa == 0 else (sayfa - 1)})"), custom.Button.inline( "İleri ▶️", data=f"sayfa({0 if sayfa == (max_pages - 1) else sayfa + 1})") ]) return [max_pages, butonlar] with bot: if OTOMATIK_KATILMA: try: bot(JoinChannelRequest("@OlympusUserBot")) bot(JoinChannelRequest("@olympuss10")) except: pass moduller = CMD_HELP me = bot.get_me() uid = me.id try: @tgbot.on(NewMessage(pattern='/start')) async def start_bot_handler(event): if not event.message.from_id == uid: await event.reply( f'`Merhaba ben` @AsenaUserBot`! Ben sahibime (`@{me.username}`) yardımcı olmak için varım, yaani sana yardımcı olamam :/ Ama sen de bir Asena açabilirsin; Kanala bak` @AsenaUserBot'