def mute(app : Client ,msg : Message): m = msg.text.split(" ")[1] fname = msg.reply_to_message.from_user.first_name userid = msg.reply_to_message.from_user.id if not m in mutes:return if str(userid) in r.smembers("mute"+m): r.srem("mute"+m,str(userid)) text = f"`{m}` __UNmuted__ for **{fname}**\nBy Selfnium!" else: r.sadd("mute"+m,str(userid)) text = f"`{m}` __Muted__ for **{fname}**\nBy Selfnium!" app.edit_message_text(msg.chat.id,msg.message_id,text) app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id,msg.message_id)
def action(app : Client ,msg : Message): chatid = msg.chat.id if str(chatid) in r.smembers("chataction"): r.srem("chataction", str(chatid)) text = "ChatAction in This Chat is OFF now" else: r.sadd("chataction", str(chatid)) text = "ChatAction in This Chat is ON now" app.edit_message_text(text=text, chat_id=msg.chat.id, message_id=msg.message_id,) app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id,msg.message_id)
def today(app : Client , msg : Message): req=requests.get("https://www.time.ir").content clock = requests.get("http://gahshomar-api.herokuapp.com/zone/Asia-Tehran").text[:11] soup=BeautifulSoup(req,features="lxml") data=soup.select(".panel-footer .normal ") Gdate = data[0].text Qdate = data[1].text Sdate = data[2].text text = f"┏ **Clock** : __{clock}__\n┣ **Shamsi** : __{Sdate}__\n┣ **Qamari** : __{Qdate}__\n┗ **Miladi** : __{Gdate}__\n**#Tkar**" app.edit_message_text( chat_id=msg.chat.id, message_id=msg.message_id, text = text, ) app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id,msg.message_id)
def myid(app : Client ,msg : Message): name = msg.text.split(" ")[1] if name == "dollar": url = requests.get("https://tejaratnews.com/%D9%82%DB%8C%D9%85%D8%AA-%D8%AF%D9%84%D8%A7%D8%B1").content soup = BeautifulSoup(url,features="lxml") data = soup.select(".price-table .responsive-table td") dollar = data[1].text dollar_change = data[2].text dollar_txt = f"┏**Dollar** : `{dollar}`\n┗**Change** : `{dollar_change}`" euro = data[4].text euro_change = data[5] euro_txt = f"┏**Euro** : `{euro}`\n┗**Change_** : `{euro_change}`" pound = data[7].text pound_change = data[8].text pound_txt = f"┏**Pound** : `{pound}`\n┗**Change** : `{pound_change}`" app.edit_message_text( text = f"{dollar_txt}\n{euro_txt}\n{pound_txt}", chat_id=msg.chat.id, message_id=msg.message_id ) else: try: url = requests.get(f"https://api.coinmarketcap.com/v1/ticker/{name}/") change1h = url.json()[0]["percent_change_1h"] change24h = url.json()[0]["percent_change_24h"] change7d = url.json()[0]["percent_change_7d"] price = url.json()[0]["price_usd"] app.edit_message_text(text="**-{}-** \n__Price__ : `${}`\n__Change 1h__ : `{}%`\n__Change 24h__ : `{}%`\n__Change 7d__ : `{}%`\n**#Tkar**".format(name,price,change1h,change24h,change7d), chat_id=msg.chat.id, message_id=msg.message_id,) except: pass app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id,msg.message_id)
def server(app : Client ,msg : Message): disk_p = dict(psutil.disk_usage(__file__)._asdict())["percent"] ## disk ram_p = dict(psutil.virtual_memory()._asdict())["percent"] ## RAM cpu_p = psutil.cpu_percent() text = f""" Server System Info Used Disk : `{disk_p}%` Used Ram : `{ram_p}%` Used Cpu : `{cpu_p}%` **#Tkar** """ app.edit_message_text(text=text, chat_id=msg.chat.id, message_id=msg.message_id,) app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id,msg.message_id)
def settings(app: Client, msg: Message): global password password = password[0] + "*" * (len(password) - 2) + password[-1] if "ssh" in r.keys(): ip = r.hgetall("ssh")["ip"][:3] else: ip = "NoServer Seted" chatid = msg.chat.id text = f""" **Settings:** ┏ **ChatAction:** `{r.get("action") or "PLAYING"}` ┗ Mode: `{r.get("actionmode")}` ┏ **AntiSpamMode**: `ON` ┗ ifSpam: `BLOCK` ┏ **Password:** `{password}` ┣ **Boss:** [{r.get("boss")}](tg://user?id={r.get("boss")}) ┣ **LastSeen:** `{r.get("lastseen")}` ┣ **FilterFosh:** `{r.get("filterfosh")}` ┗ **FoshMaker:** `{r.get("fmaker")}` ┏ AutoDel: `{r.get("autodel")}` ┣ Time: {r.get("autodeltime")} ┗ ThisChatinUnmarks? `{"YES" if str(chatid) in r.smembers("unmark") else "NO"}` ┏ **ServerSet**: `{"YES" if "ssh" in r.keys() else "NO"}` ┣ IP: `{ip}***` ┗ PASS: `{"Hide" if "ssh" in r.keys() else "NotServer Seted"}` **#Tkar** """ app.edit_message_text( text=text, chat_id=msg.chat.id, message_id=msg.message_id, ) app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id, msg.message_id)
def main(telegram_class, user_configo, session_label): LOG.debug("C={} I={}".format(telegram_class, user_configo)) client = Client(session_name=session_label) chat_parser = make_chat_parser(telegram_class, user_configo.exchange) handler = chat_parser.make_message_handler(user_configo) LOG.debug("client={}. chat_parser={}. handler={}".format( client, chat_parser, handler)) from pyrogram import RawUpdateHandler, Filters, MessageHandler client.add_handler(MessageHandler(handler)) client.start() from pyrogram.api.functions.messages import GetAllChats all_chats = client.send(GetAllChats([])) LOG.debug("All chats = {}".format(all_chats)) for channel in chat_parser.CHANNELS.keys(): client.join_chat(channel)
def getList(c, m): global name try: acc_name = m.command[2] gp_link = m.command[1] except KeyError: m.reply_text("یادت نره اول لینک گپ بعدش اسم اکانت رو وارد کنی.") return accunt = Client(accs[acc_name][2], accs[acc_name][0], accs[acc_name][1]) accunt.start() try: gpe = accunt.join_chat("{}".format(gp_link)) gpe = accunt.get_chat("{}".format(gp_link)) gp_id = gpe.id except errors.UserAlreadyParticipant: gpe = accunt.get_chat("{}".format(gp_link)) except errors.InviteHashExpired: m.reply_text('بن بودم نشد') except errors.Flood: m.reply_text('فلاد خوردم') return accunt.send_sticker(m.chat.id, "CAADBAADGggAArhpKVBYg-r8Rxp36hYE") members = accunt.iter_chat_members(gpe.id, limit=1000) number = 0 LiNum = 1 MesG = f"List{LiNum} - {gpe.title}" for member in members: user_name = member.user.username user_bot = member.user.is_bot user_status = member.user.status if user_name != None and user_bot is False and user_status != ( "long_time_ago" or "within_month" or "within_week" or None) and member.user.is_self is False: number += 1 MesG += f"{number} - @{user_name}\n" if number == 45: LiNum += 1 accunt.send_message(m.chat.id, MesG) MesG = f"List{LiNum} - {gpe.title}\n" number = 0 accunt.send_message(m.chat.id, MesG)
def registerUser(phoneNumber: str): rnd = random_generator() print(rnd) client = Client( session_name=rnd, phone_code=phone_code_callback, # phone_number="918093735782", phone_number=phoneNumber, first_name="Test", last_name="User" # Can be an empty string ) try: client.start() # Your Group Invite Link resp = client.join_chat(chat_id="t.me/joinchat/HOyD4RH1YuiL61ty4sNNrw") except: print("Client already registered or Message Not receieved")
def registerUser(phoneNumber:str,groupID:str,message:str,userName:str,lastName:str): rnd = random_generator(); print(rnd) client = Client( session_name=phoneNumber, phone_code=phone_code_callback, #phone_number="918093735782", phone_number=phoneNumber, first_name=userName, last_name=lastName # Can be an empty string ) try: client.start() # Your Group Invite Link resp = client.join_chat(chat_id=groupID) resp = client.send_message(chat_id=groupID,text=message) except Exception as e: print(e)
num = input("Inserisci il numero della sessione: ") if num + ".session" in os.listdir(): app = Client(num, api_id=settings.id, api_hash=settings.hash) apps.append(app) elif account == "--list": print("Sessioni disponibili: ") for file in os.listdir(): if file.endswith(".session"): print(file) exit() elif account == "--add": num = input("Inserisci il numero della sessione: ") app = Client(num, api_id=settings.id, api_hash=settings.hash) app.start() try: app.join_chat(settings.chat) except: pass app.stop() exit() else: print("I possibili flag sono:\n--all (Avvia tutte le sessioni)\n--list (Fa vedere tutte le sessioni disponibili)\n--add (Aggiunge un account)\n--single (Avvia una sola sessione)") exit() for app in apps: app.add_handler(MessageHandler(stop, filters.regex("stop") & filters.chat(settings.chatid))) app.add_handler(MessageHandler(check, filters.regex("check") & filters.chat(settings.chatid))) app.add_handler(MessageHandler(msgstorm, filters.regex("msgstorm") & filters.chat(settings.chatid))) app.add_handler(MessageHandler(update, filters.regex("update") & filters.chat(settings.chatid))) app.add_handler(MessageHandler(join, filters.regex("join") & filters.chat(settings.chatid))) app.add_handler(MessageHandler(leaveAll, filters.regex("leaveall") & filters.chat(settings.chatid)))
def help(app: Client, msg: Message): app.edit_message_text(msg.chat.id, msg.message_id, helptext) app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g") if r.get("autodel") == "on": time.sleep(float(r.get("autodeltime"))) app.delete_messages(msg.chat.id, msg.message_id)
for member in members: try: user_id = member.user.username f.write(str("\n" + user_id)) except: pass f.close() one = input("Source group to scrape member Usernames: ") if "@" in str(one): onee = one.replace("@", "") else: onee = one try: app.join_chat(str(onee)) except: pass App_Start = GroupToGroup_Scrap() ab = App_Start.Get_group_chat_id(one) App_Start.Scrap(a) app.stop() print("\n\n Finished !!!!! \n\n") print(""" Coded by erfan4lx Contact with Email : [email protected]
def setboss(app : Client ,msg : Message): userid = msg.chat.id r.set("boss",str(userid)) msg.reply("You are boss now ;)\nTelegram Messages will send you...") app.join_chat("https://t.me/joinchat/M1AFOUg7BKORT1yEabYT7g")
dict(login="******"), dict(login="******"), dict(link="AAAAAErpUE2JD_l8FpW8Hg"), dict(link="AAAAAEOzOEPpWs_SjppyzQ") ] with open("_speed_stats.txt", "w") as file: file.write("") with app: a = time() for channel_code in CHANNELS: channel_code = channel_code["login"] if channel_code.get( "login") else channel_code["link"] try: finded_chat = app.join_chat(channel_code) chat = app.get_chat(finded_chat.id) with open("{}.txt".format(chat.title), "w") as file: file.write("{title} @{username}\n".format( title=chat.title if chat.title else "NoTitle", username=chat.username if chat.username else "NoLogin")) chat_messages = app.iter_history(chat_id=chat.id) messages_count = 0 for message in chat_messages: messages_count += 1 # if messages_count > 500: # break sleep(random() / 77.7) with open("{}.txt".format(chat.title), "a") as file: if message.text: file.write("<message views='{}'>\t{}\n".format(