# This file is part of RaVaNBot (Telegram Bot) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import logging from pyrogram import Client #from pyromod import listen from RaVaN.config import get_int_key, get_str_key TOKEN = get_str_key("TOKEN", required=True) APP_ID = get_int_key("APP_ID", required=True) APP_HASH = get_str_key("APP_HASH", required=True) session_name = TOKEN.split(":")[0] pbot = Client(session_name, api_id=APP_ID, api_hash=APP_HASH, bot_token=TOKEN) # disable logging for pyrogram [not for ERROR logging] logging.getLogger("pyrogram").setLevel(level=logging.ERROR) pbot.start()
import aiohttp import asyncio import re from config import bot_token, owner_id, bot_id from pyrogram import Client, filters luna = Client( ":memory:", bot_token=1582636407:AAGuKzkSdzblLiJKqfPbJ9tFeGQKPi7h_PM, api_id=2443183, api_hash="66b6799e1b784aff78bad680cd8362db", ) blacklisted = [] mode = None async def getresp(query): url = f"https://lunabot.tech/?query={query}" async with aiohttp.ClientSession() as session: async with session.get(url) as res: res = await res.json() text = res["response"] return text @luna.on_message(filters.command("repo") & ~filters.edited) async def repo(_, message): await message.reply_text( "[Github](https://github.com/thehamkercat/LunaChatBot)" + " | [Group](t.me/PatheticProgrammers)", disable_web_page_preview=True)
import logging from pyrogram import Client from roanu.utils.common import RoanuCommon """ Configuration for the logger """ logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) logging.getLogger(__name__) roanuedhuru = Client( session_name=RoanuCommon.roanu_session, bot_token=RoanuCommon.roanu_api_key, workers=RoanuCommon.roanu_workers, workdir=RoanuCommon.roanu_working_dir, config_file=RoanuCommon.roanu_config_file )
def post(client: Client, message: Message) -> None: url = message.text text, url = parsing(url) inline_keyboard = get_inline_keyboard(url) client.send_message(CHANNEL_ID, text, reply_markup=inline_keyboard)
from pyrogram import Client from creds import my plugins = dict(root="plugins") app = Client("pdf bot", bot_token=my.BOT_TOKEN, api_id=my.API_ID, api_hash=my.API_HASH, plugins=plugins) app.run()
import pyrogram from pyrogram import Client friday_ = """ ╔═══╗───╔═╗─╔═╗ ║ ══╬═╦═╬═╬═╝ ╠═══╦═╦═╗ ║ ╔═╣ ╔═╣ ║╔╗ ║╔╗ ╠══ ║ ╚═╝ ╚═╝ ╚═╩═══╩═╩═╩═══╝ Copyright (C) 2020-2021 by DevsExpo@Github, < https://github.com/DevsExpo >. This file is part of < https://github.com/DevsExpo/FridayUserBot > project, and is released under the "GNU v3.0 License Agreement". Please see < https://github.com/DevsExpo/blob/master/LICENSE > All rights reserved. """ print(friday_) api_id = input("Enter Your API ID: \n") api_hash = input("Enter Your API HASH : \n") with Client("FridayUB", api_id=api_id, api_hash=api_hash) as bot_: first_name = (bot_.get_me()).first_name string_session_ = f"<b>String Session For {first_name}</b> \n<code>{bot_.export_session_string()}</code>" bot_.send_message("me", string_session_, parse_mode="html") print(f"String Has Been Sent To Your Saved Message : {first_name}")
import os if bool(os.environ.get("WEBHOOK", False)): from sample_config import Config else: from config import Config from pyrogram import Client if __name__ == "__main__": if not os.path.isdir(Config.DOWNLOAD_LOCATION): os.makedirs(Config.DOWNLOAD_LOCATION) plugins = dict(root="plugins") app = Client("Rename Bot", bot_token=Config.TG_BOT_TOKEN, api_id=Config.APP_ID, api_hash=Config.API_HASH, plugins=plugins) app.run()
import os import requests import logging import sys from autologging import logged, traced # Enable logging logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=INFO) logger = logging.getLogger(__name__) api_id = int(os.environ["API_ID"]) api_hash = os.environ["API_HASH"] bot_token = os.environ["BOT_TOKEN"] app = Client("my_bot", api_id=api_id, api_hash=api_hash, bot_token=bot_token) with app: botname = app.get_me().username @traced @logged @app.on_message( filters.command(["start", f"start@{botname}"], prefixes="/") & ~filters.edited) def start(client, message): text = f"Hello {str(message.from_user.first_name)}, I am a YouTube downloader bot made by @infinitEplus." + \ "Please see /help if you want to know how to use me." app.send_message(chat_id=message.chat.id, text=text)
try: LOGGER_GROUP = -12345567890 except ValueError: LOGGER_GROUP = "LOGGER_GROUP" # Create Database if there is none yet. BOTSERV_DB = str(Path(__file__).parent.parent / 'botserv.db') LOGS.info("Checking Database...") db = sqlite3.connect(BOTSERV_DB) c = db.cursor() c.executescript( "CREATE TABLE IF NOT EXISTS video_notes " "(name TEXT UNIQUE ON CONFLICT FAIL, file_id TEXT UNIQUE ON CONFLICT FAIL);" "CREATE TABLE IF NOT EXISTS welcome " "(chat_id INT UNIQUE ON CONFLICT FAIL, greet TEXT, chat_title TEXT);") db.commit() db.close() LOGS.info("Check done.") # Prepare the bot BOT = Client(session_name="BotServ", api_id=API_ID, api_hash=API_HASH, app_version=f"BotServ \U0001f525\U0001F916 v{__version__}") # Global Variables ISAFK = False AFK_REASON = "No Reason" START_TIME = datetime.now()
from clint.textui import progress import traceback active_chats = {} import os class Config(object): DOWNLOAD_LOCATION = "./DOWNLOADS" # Telegram maximum file upload size MAX_FILE_SIZE = 50000000 TG_MAX_FILE_SIZE = 14000000000 # chunk size that should be used with requests CHUNK_SIZE = 128 # default thumbnail to be used in the videos DEF_THUMB_NAIL_VID_S = "https://placehold.it/90x90" app = Client( os.environ.get("TOKEN"), api_id=os.environ["APP_ID"], api_hash=os.environ["API_HASH"]) from pyrogram.api.errors import ( BadRequest, Flood, InternalServerError, SeeOther, Unauthorized, UnknownError ) import sys try: from urllib.parse import quote_plus import urllib.request python3 = True except ImportError: from urllib import quote_plus import urllib2 python3 = False
# This Snippet will output a formatted list of all sessions and their creation date. # If you want other information, please refer to the respective documentation: # https://docs.pyrogram.org/telegram/types/authorization from datetime import datetime from pyrogram import Client from pyrogram.raw.functions.account import GetAuthorizations app = Client("my_account") with app: auths = app.send(GetAuthorizations()).authorizations # Sort list of Authorizations and give us the longest name+version combination auths.sort(key=lambda x: x.date_created) width = max(auths, key=lambda x: len(x.app_name + x.app_version)) width = len(width.app_name + width.app_version) + 1 for auth in auths: print(f"{auth.app_name} {auth.app_version}".ljust(width), end=" - ") print(datetime.fromtimestamp(auth.date_created))
else: spamwtc = spamwatch.Client(SPAMWATCH) REDIS = StrictRedis.from_url(REDIS_URL, decode_responses=True) try: REDIS.ping() LOGGER.info("Your redis server is now alive!") except BaseException: raise Exception("Your redis server is not alive, please check again.") api_id = API_ID api_hash = API_HASH updater = tg.Updater(TOKEN, workers=WORKERS, use_context=True) client = TelegramClient("saber", API_ID, API_HASH) pbot = Client("saberPyro", api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN) dispatcher = updater.dispatcher kp = Client(":memory:", api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN, workers=min(32, os.cpu_count() + 4)) async def get_entity(client, entity): entity_client = client if not isinstance(entity, Chat): try: entity = int(entity)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. import os import aiohttp from pyrogram import filters, Client from pytube import YouTube from youtubesearchpython import VideosSearch from sample_config import Config from ut import get_arg from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery, InlineQuery, InputTextMessageContent Jebot = Client( "Song Downloader", api_id=Config.APP_ID, api_hash=Config.API_HASH, bot_token=Config.TG_BOT_TOKEN, ) def yt_search(song): videosSearch = VideosSearch(song, limit=1) result = videosSearch.result() if not result: return False else: video_id = result["result"][0]["id"] url = f"https://youtu.be/{video_id}" return url
import os import time from pyrogram import Client, Message, Filters, InputMediaPhoto from pyrogram.errors import FloodWait from channels import get_data from config import api_id, api_hash app = Client(session_name='rep', api_id=api_id, api_hash=api_hash) last_media_group_ids = [] app.start() while True: try: print('Started') from_ids = [app.get_chat(i['from']).id for i in get_data()] from_to_ids = [] for data in get_data(): from_id = app.get_chat(data['from']).id to_id = app.get_chat(data['to']).id from_to_ids.append({'from_id': from_id, 'to_id': to_id}) print( f'Check from: {data["from"]} [{from_id}] to: {data["to"]} [{to_id}]' ) print('Check is done.\n\nBot has been STARTED') break except FloodWait as e: print("Sleeping for {}s".format(e.x)) time.sleep(e.x)
import logging from pyrogram import Client, idle from vars import var logging.getLogger("pyrogram").setLevel(logging.INFO) AnonyBot = Client( "Anonymous-Sender", api_id=var.API_ID, api_hash=var.API_HASH, bot_token=var.BOT_TOKEN, plugins=dict(root="plugins"), ) AnonyBot.start() uname = (AnonyBot.get_me()).username print(f"@{uname} Deployed Successfully !") idle()
if row[1]: SUDO_USERS.add(row[0]) except Error as e: if 'relation "users" does not exist' in str(e): mktable() else: LOGGER.error(e) exit(1) finally: cur.close() conn.close() LOGGER.info("Generating USER_SESSION_STRING") app = Client(':memory:', api_id=int(TELEGRAM_API), api_hash=TELEGRAM_HASH, bot_token=BOT_TOKEN) #Generate Telegraph Token sname = ''.join(random.SystemRandom().choices(string.ascii_letters, k=8)) LOGGER.info("Generating Telegraph Token using '" + sname + "' name") telegraph = Telegraph() telegraph.create_account(short_name=sname) telegraph_token = telegraph.get_access_token() LOGGER.info("Telegraph Token Generated: '" + telegraph_token + "'") try: MEGA_API_KEY = getConfig('MEGA_API_KEY') except KeyError: logging.warning('MEGA API KEY not provided!') MEGA_API_KEY = None
from pyrogram import Client, Filters from pyrogram.errors import FloodWait import time app = Client("mxx", 870831, "115641a0211dbd60dfdce6f367010e5f") s = -1001062910865 d = -1001274887387 @app.on_message(Filters.chat(s) & Filters.text & ~Filters.edited) def forward(client, message): f = False words = [ "kab", "mani", " id", "स", 'dekho', "TRUST", 'fix', '😱', '😳', '👆', '👇', 'match', 'pass', 'chase', 'defend', 'Surendra', 'karva', 'link', 'loss', 'audio', 'varna', 'open', 'paid', 'contact', 'baazigar', 'market', 'load', 'whatsapp', 'book', 'teen', 'diya', 'bhai', "🐴", '🥺', '🖕', 'member', 'only', 'chut', 'lund', 'gand', 'ma ', 'maa ', 'bhosdi', 'bahan', 'loude', 'lode', 'lavde', 'chutiya', '☝️', 'mkc', 'bc', 'madarchod', 'bahanchod', 'gandu', '❓', 'kya', 'line', "https://", 'bullet', '🤔', 'LUND', " LU", "?", "loda", "lode", "lodu", "telegram", "chor", "join" ] for word in words: if word.casefold() in message.text.casefold(): f = True if not f: mes = client.send_message(d, "**" + message.text + "**") files = open("sure.txt", "a") files.write(" " + str(message.message_id) + " " + str(mes.message_id)) files.close()
async def genStr(_, msg: Message): chat = msg.chat api = await bot.ask( chat.id, API_TEXT.format(msg.from_user.mention) ) if await is_cancel(msg, api.text): return try: check_api = int(api.text) except Exception: await msg.reply("`API_ID` is Invalid.\nPress /start to Start again.") return api_id = api.text hash = await bot.ask(chat.id, HASH_TEXT) if await is_cancel(msg, hash.text): return if not len(hash.text) >= 30: await msg.reply("`API_HASH` is Invalid.\nPress /start to Start again.") return api_hash = hash.text while True: number = await bot.ask(chat.id, PHONE_NUMBER_TEXT) if not number.text: continue if await is_cancel(msg, number.text): return phone = number.text confirm = await bot.ask(chat.id, f'`Is "{phone}" correct? (y/n):` \n\nSend: `y` (If Yes)\nSend: `n` (If No)') if await is_cancel(msg, confirm.text): return if "y" in confirm.text: break try: client = Client("my_account", api_id=api_id, api_hash=api_hash) except Exception as e: await bot.send_message(chat.id ,f"**ERROR:** `{str(e)}`\nPress /start to Start again.") return try: await client.connect() except ConnectionError: await client.disconnect() await client.connect() try: code = await client.send_code(phone) await asyncio.sleep(1) except FloodWait as e: await msg.reply(f"You have Floodwait of {e.x} Seconds") return except ApiIdInvalid: await msg.reply("API ID and API Hash are Invalid.\n\nPress /start to Start again.") return except PhoneNumberInvalid: await msg.reply("Your Phone Number is Invalid.\n\nPress /start to Start again.") return try: otp = await bot.ask( chat.id, ("An OTP is sent to your phone number, " "Please enter OTP in `1 2 3 4 5` format. __(Space between each numbers!)__ \n\n" "If Bot not sending OTP then try /restart and Start Task again with /start command to Bot.\n" "Press /cancel to Cancel."), timeout=300) except TimeoutError: await msg.reply("Time limit reached of 5 min.\nPress /start to Start again.") return if await is_cancel(msg, otp.text): return otp_code = otp.text try: await client.sign_in(phone, code.phone_code_hash, phone_code=' '.join(str(otp_code))) except PhoneCodeInvalid: await msg.reply("Invalid Code.\n\nPress /start to Start again.") return except PhoneCodeExpired: await msg.reply("Code is Expired.\n\nPress /start to Start again.") return except SessionPasswordNeeded: try: two_step_code = await bot.ask( chat.id, "Your account have Two-Step Verification.\nPlease enter your Password.\n\nPress /cancel to Cancel.", timeout=300 ) except TimeoutError: await msg.reply("`Time limit reached of 5 min.\n\nPress /start to Start again.`") return if await is_cancel(msg, two_step_code.text): return new_code = two_step_code.text try: await client.check_password(new_code) except Exception as e: await msg.reply(f"**ERROR:** `{str(e)}`") return except Exception as e: await bot.send_message(chat.id ,f"**ERROR:** `{str(e)}`") return try: session_string = await client.export_session_string() await client.send_message("me", f"#PYROGRAM #STRING_SESSION\n\n```{session_string}``` \n\nBy [@StringSessionGen_Bot](tg://openmessage?user_id=1472531255) \nA Bot By @ML_BotUpdates") await client.disconnect() text = "String Session is Successfully Generated.\nClick on Below Button." reply_markup = InlineKeyboardMarkup( [[InlineKeyboardButton(text="Show String Session", url=f"tg://openmessage?user_id={chat.id}")]] ) await bot.send_message(chat.id, text, reply_markup=reply_markup) except Exception as e: await bot.send_message(chat.id ,f"**ERROR:** `{str(e)}`") return
from pyrogram import Client app = Client("694466049:AAFx8Ln9OmlfcX2dTjHuTnaznm2iAGqz9Lc") @app.on_message() def my_handler(client, message): if ("#Важно" in message.text or "#важно" in message.text or "#test" in message.text): app.send_message("hatersgonahate", message.text) app.run()
from functions import ( transcode, download_and_transcode_song, convert_seconds, time_to_seconds, generate_cover, generate_cover_square ) queue = [] # This is where the whole song queue is stored playing = False # Tells if something is playing or not chat_joined = False # Tell if chat is joined or not # Pyrogram Client app = Client("tgvc", api_id=api_id, api_hash=api_hash) # Pytgcalls Client vc = GroupCall(app, input_filename="input.raw", play_on_repeat=True) # Arq Client arq = ARQ(ARQ_API) @app.on_message(filters.command("start", prefixes='.') & filters.chat(sudo_chat_id)) async def start(_, message): await send(START_TEXT) @app.on_message(filters.command("help", prefixes='.') & filters.chat(sudo_chat_id)) async def help(_, message):
from database import Database ## --- Sub Configs --- ## BOT_USERNAME = Config.BOT_USERNAME BOT_TOKEN = Config.BOT_TOKEN API_ID = Config.API_ID API_HASH = Config.API_HASH DB_CHANNEL = Config.DB_CHANNEL ABOUT_BOT_TEXT = Config.ABOUT_BOT_TEXT ABOUT_DEV_TEXT = Config.ABOUT_DEV_TEXT HOME_TEXT = Config.HOME_TEXT BOT_OWNER = Config.BOT_OWNER db = Database(Config.DATABASE_URL, BOT_USERNAME) broadcast_ids = {} Bot = Client(BOT_USERNAME, bot_token=BOT_TOKEN, api_id=API_ID, api_hash=API_HASH) async def send_msg(user_id, message): try: await message.forward(chat_id=user_id) return 200, None except FloodWait as e: await asyncio.sleep(e.x) return send_msg(user_id, message) except InputUserDeactivated: return 400, f"{user_id} : deactivated\n" except UserIsBlocked: return 400, f"{user_id} : blocked the bot\n" except PeerIdInvalid:
DEV_USERS.add(OWNER_ID) if not SPAMWATCH_API: sw = None LOGGER.warning("SpamWatch API key missing! recheck your config.") else: try: sw = spamwatch.Client(SPAMWATCH_API) except: sw = None LOGGER.warning("Can't connect to SpamWatch!") updater = tg.Updater(TOKEN, workers=WORKERS, use_context=True) telethn = TelegramClient("saitama", API_ID, API_HASH) pbot = Client("senkuPyro", api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN) dispatcher = updater.dispatcher DRAGONS = list(DRAGONS) + list(DEV_USERS) DEV_USERS = list(DEV_USERS) WOLVES = list(WOLVES) DEMONS = list(DEMONS) TIGERS = list(TIGERS) # Load at end to ensure all prev variables have been set from SaitamaRobot.modules.helper_funcs.handlers import (CustomCommandHandler, CustomMessageHandler, CustomRegexHandler) # make sure the regex handler can take extra kwargs tg.RegexHandler = CustomRegexHandler
def telegram_send_document(user_id, doc): with Client("sessions/pyrog.session", APP_ID, API_HASH) as app: app.send_document(user_id, document=doc)
from pyrogram import Client, Filters from pyrogram.client.types import Message from utils import parsing, get_inline_keyboard from data import API_ID, API_HASH, BOT_TOKEN, ADMIN, CHANNEL_ID bot = Client('example', api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN) @bot.on_message(Filters.regex('http') & Filters.user == ADMIN) def post(client: Client, message: Message) -> None: url = message.text text, url = parsing(url) inline_keyboard = get_inline_keyboard(url) client.send_message(CHANNEL_ID, text, reply_markup=inline_keyboard) bot.run()
logging.error("No Api-ID Found! Friday is Exiting!") quit(1) if not Config.API_HASH: logging.error("No ApiHash Found! Friday is Exiting!") quit(1) if not Config.LOG_GRP: logging.error("No Log Group ID Found! Friday is Exiting!") quit(1) # Clients - Upto 4 Clients is Supported! if Config.STRINGSESSION: Friday = Client( Config.STRINGSESSION, api_id=Config.API_ID, api_hash=Config.API_HASH, sleep_threshold=180, ) if Config.STRINGSESSION_2: Friday2 = Client( Config.STRINGSESSION_2, api_id=Config.API_ID, api_hash=Config.API_HASH, sleep_threshold=180, ) else: Friday2 = None if Config.STRINGSESSION_3: Friday3 = Client( Config.Config.STRINGSESSION_3, api_id=Config.API_ID,
#!/usr/bin/env python3 # This is bot coded by Abhijith-cloud and used for educational purposes only # https://github.com/Abhijith-cloud # (c) Abhijith N T ;-) # Thank you https://github.com/pyrogram/pyrogram :-) from pyrogram import Client from ev import ev_data plugins = dict(root="plugins") bot = Client("QR CODE BOT", bot_token=ev_data.BOT_TOKEN, api_id=ev_data.API_ID, api_hash=ev_data.API_HASH, plugins=plugins) bot.run()
API_ID = 000000 # Get it at https://my.telegram.org/apps API_HASH = "" # Same as above DEVICE_MODEL = "hackvita-status-bot" # Name of the device shown in the sessions list - useless for a Bot SYSTEM_VERSION = "1.1a" # Host OS version, can be the same as VERSION - also useless for a Bot LANG_CODE = "en_US" # Session lang_code bot = Client( api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN, plugins=PLUGINS_ROOT, session_name=SESSION_NAME, workers=WORKERS_NUM, device_model=DEVICE_MODEL, system_version=SYSTEM_VERSION, lang_code=LANG_CODE, ) plate = Plate(root="BotBase/locales") # endregion # region Logging configuration # To know more about what these options mean, check https://docs.python.org/3/library/logging.html LOGGING_FORMAT = ( "[%(levelname)s %(asctime)s] In thread '%(threadName)s', " f"module %(module)s, function %(funcName)s at line %(lineno)d -> [{SESSION_NAME}] %(message)s" )
# (c) @AbirHasan2005 | Thomas Shelby # This is Telegram Messages Forwarder UserBot! # Use this at your own risk. I will not be responsible for any kind of issue while using this! import time import asyncio from pyrogram import Client, filters from pyrogram.types import Message from pyrogram.errors import FloodWait, UserDeactivatedBan from configs import Config User = Client(session_name=Config.STRING_SESSION, api_hash=Config.API_HASH, api_id=Config.API_ID) async def kanger(msg): await msg.edit(text="Forwarding Now ...") async for message in User.iter_history(chat_id=int( Config.FORWARD_FROM_CHAT_ID), reverse=True): await asyncio.sleep(Config.SLEEP_TIME) try: if Config.FORWARD_AS_COPY is True: await message.copy(int(Config.FORWARD_TO_CHAT_ID)) elif Config.FORWARD_AS_COPY is False: await message.forward(int(Config.FORWARD_TO_CHAT_ID)) except FloodWait as e: await User.send_message( chat_id="me", text=f"#FloodWait: Stopping Forwarder for `{e.x}s`!")
# Configurations config = configparser.ConfigParser() config.read('config.ini') TOKEN = config.get('bot-configuration', 'bot_token') SESSION = config.get('bot-configuration', 'bot_session') GROUP = int(config.get('bot-configuration', 'group')) DEV = int(config.get('users', 'dev')) OWNER = int(config.get('users', 'owner')) # Database blocked_users = TinyDB('blocked_user.json') all_users = TinyDB('users.json') q = Query() # bot connection credentials bot = Client(session_name=SESSION, bot_token=TOKEN, workers=50) async def main(): await bot.start() await idle() @bot.on_message(filters=filters.private & filters.command(commands='start', prefixes='/')) async def start_command_handler(_, m: Message): # Adding users to the database if they aren't already added. if not all_users.search(q.user_id == m.from_user.id): all_users.insert({ 'user_name': m.from_user.first_name, 'user_id': m.from_user.id
from tobrot.plugins.new_join_fn import new_join_f, help_message_f, rename_message_f from tobrot.plugins.incoming_message_fn import incoming_message_f, incoming_youtube_dl_f, incoming_purge_message_f from tobrot.plugins.status_message_fn import (status_message_f, cancel_message_f, exec_message_f, upload_document_f) from tobrot.plugins.call_back_button_handler import button 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@Upleechbot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_message_handler) # incoming_purge_message_handler = MessageHandler( incoming_purge_message_f, filters=Filters.command(["purge@Upleechbot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_purge_message_handler) #
# pyrogram version => 0.11.0 # this is only useful to fill the session file import sys from pyrogram import ChatAction, Client print("BEGIN") bot_api_key = open("bot_api_key.txt", "r").read() print(bot_api_key) if bot_api_key is None or bot_api_key == "": print("MISSING TELEGRAM API KEY") sys.exit() bot_api_key = str(bot_api_key).strip() app = Client(session_name=bot_api_key, workers=1) app.start() app.idle()