GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", None) TEMP_DOWNLOAD_DIRECTORY = os.environ.get("TEMP_DOWNLOAD_DIRECTORY", "./downloads") else: # Put your ppe vars here if you are using local hosting PLACEHOLDER = None # Global Variables COUNT_MSG = 0 USERS = {} COUNT_PM = {} LASTMSG = {} SUDO_LIST = {} CMD_HELP = {} CUSTOM_PMPERMIT_MSG = {} CUSTOM_BOTSTART = {} ISAFK = False AFKREASON = None # End of PaperPlaneExtended Support Vars link = "https://people.eecs.berkeley.edu/~rich.zhang/projects/2016_colorization/files/demo_v2/colorization_release_v2.caffemodel" km = "./resources/imgcolour/colorization_release_v2.caffemodel" if os.path.exists(km): pass else: pathz = "./resources/imgcolour/" sedlyf = wget.download(link, out=pathz) telegraph = Telegraph() r = telegraph.create_account(short_name="Lightning The UserBot Inc.") auth_url = r["auth_url"]
"""@telegraph Utilities updated for Lazy people by @WhySooSerious Available Commands: .tgm reply to a media .tgt as reply to a large text""" from telethon import events import os from PIL import Image from datetime import datetime from telegraph import Telegraph, upload_file, exceptions from userbot.utils import admin_cmd telegraph = Telegraph() r = telegraph.create_account(short_name=Config.TELEGRAPH_SHORT_NAME) auth_url = r["auth_url"] @borg.on(admin_cmd("t(m|t) ?(.*)")) async def _(event): if event.fwd_from: return if Config.PLUGIN_CHANNEL is None: await event.edit( "Please set the required environment variable `PLUGIN_CHANNEL` for this plugin to work" ) return if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) await borg.send_message( Config.PLUGIN_CHANNEL, "Created New Telegraph account {} for the current session. \n**Do not give this url to anyone, even if they say they are from Telegram!**" .format(auth_url))
def drive_list(self, fileName): msg = "" fileName = self.escapes(str(fileName)) # Create Search Query for API request. query = f"'{parent_id}' in parents and (name contains '{fileName}')" response = self.__service.files().list(supportsTeamDrives=True, includeTeamDriveItems=True, q=query, spaces='drive', pageSize=200, fields='files(id, name, mimeType, size)', orderBy='modifiedTime desc').execute() content_count = 0 if response["files"]: msg += f'<h4>Results : {fileName}</h4><br><br>' for file in response.get('files', []): if file.get('mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File. furl = f"https://drive.google.com/drive/folders/{file.get('id')}" msg += f"⁍<code>{file.get('name')}<br>(folder📁)</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text msg += f"<b><a href={sfurl}>Drive Link</a></b>" else: msg += f"<b><a href={furl}>Drive Link</a></b>" if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text msg += f' <b>| <a href="{siurl}">Index Link</a></b>' else: msg += f' <b>| <a href="{url}">Index Link</a></b>' else: furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download" msg += f"⁍<code>{file.get('name')}<br>({get_readable_file_size(int(file.get('size')))})📄</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text msg += f"<b><a href={sfurl}>Drive Link</a></b>" else: msg += f"<b><a href={furl}>Drive Link</a></b>" if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text msg += f' <b>| <a href="{siurl}">Index Link</a></b>' else: msg += f' <b>| <a href="{url}">Index Link</a></b>' msg += '<br><br>' content_count += 1 if content_count == TELEGRAPHLIMIT : self.telegraph_content.append(msg) msg = "" content_count = 0 if msg != '': self.telegraph_content.append(msg) if len(self.telegraph_content) == 0: return "No Result Found :(", None for content in self.telegraph_content : self.path.append(Telegraph(access_token=telegraph_token).create_page( title = 'MirrorX Search', author_name='MirrorX', author_url='https://github.com/iamLiquidX', html_content=content )['path']) self.num_of_path = len(self.path) if self.num_of_path > 1: self.edit_telegraph() msg = f"<b>Search Results For {fileName} 👇</b>" buttons = button_build.ButtonMaker() buttons.buildbutton("HERE", f"https://telegra.ph/{self.path[0]}") return msg, InlineKeyboardMarkup(buttons.build_menu(1)) else : return '', ''
# PLease read the GNU Affero General Public License in # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>. import re import urllib from glob import glob from os import remove from random import choices from telegraph import Telegraph from telegraph import upload_file as upl from . import * # --------------------------------------------------------------------# telegraph = Telegraph() r = telegraph.create_account(short_name="Ultroid") auth_url = r["auth_url"] # --------------------------------------------------------------------# TOKEN_FILE = "resources/auths/auth_token.txt" @callback( re.compile("ebk_(.*)", ), ) async def eupload(event): match = event.pattern_match.group(1).decode("utf-8") await event.answer("Uploading..") try: await event.edit( file=f"https://www.gutenberg.org/files/{match}/{match}-pdf.pdf")
exit(1) DRIVE_ID = [] INDEX_URL = {} if os.path.exists('drive_index.txt'): count = 0 with open('drive_index.txt', 'r+') as f: lines = f.readlines() for line in lines: temp = line.strip().split() DRIVE_ID.append(temp[0]) try: INDEX_URL[count] = temp[1] except IndexError as e: INDEX_URL[count] = None count += 1 if DRIVE_ID: pass else: LOGGER.error("Fill up drive id's in drive_index.txt") exit(1) telegra_ph = Telegraph() telegra_ph.create_account(short_name='Asta') updater = tg.Updater(token=BOT_TOKEN, use_context=True) bot = updater.bot dispatcher = updater.dispatcher
def drive_list(self, fileName): msg = "" fileName = self.escapes(str(fileName)) # Create Search Query for API request. query = f"'{parent_id}' in parents and (name contains '{fileName}')" response = self.__service.files().list( supportsTeamDrives=True, includeTeamDriveItems=True, q=query, spaces='drive', pageSize=200, fields='files(id, name, mimeType, size)', orderBy='name asc').execute() content_count = 0 if response["files"]: msg += f'<img src="{IMAGE_URL}" /><h4>{len(response["files"])} Results: {fileName}</h4><br><br>' for file in response.get('files', []): if file.get( 'mimeType' ) == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File. furl = f"https://drive.google.com/drive/folders/{file.get('id')}" msg += f"📁 <code>{file.get('name')}<br>(folder)</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text' ).text msg += f"<b><a href={sfurl}>Drive Link</a></b>" else: msg += f"<b><a href={furl}>Drive Link</a></b>" if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text' ).text msg += f' <b>| <a href="{siurl}">Index Link</a></b>' else: msg += f' <b>| <a href="{url}">Index Link</a></b>' elif file.get( 'mimeType') == 'application/vnd.google-apps.shortcut': msg += f"⁍<a href='https://drive.google.com/drive/folders/{file.get('id')}'>{file.get('name')}" \ f"</a> (shortcut)" # Excluded index link as indexes cant download or open these shortcuts else: furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download" msg += f"📄 <code>{file.get('name')}<br>({get_readable_file_size(int(file.get('size')))})</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text' ).text msg += f"<b><a href={sfurl}>Drive Link</a></b>" else: msg += f"<b><a href={furl}>Drive Link</a></b>" if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}' urls = f'{INDEX_URL}/{url_path}?a=view' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text' ).text siurls = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={urls}&format=text' ).text msg += f' <b>| <a href="{siurl}">Index Link</a></b>' if VIEW_LINK: msg += f' <b>| <a href="{siurls}">View Link</a></b>' else: msg += f' <b>| <a href="{url}">Index Link</a></b>' if VIEW_LINK: msg += f' <b>| <a href="{urls}">View Link</a></b>' msg += '<br><br>' content_count += 1 if content_count == TELEGRAPHLIMIT: self.telegraph_content.append(msg) msg = "" content_count = 0 if msg != '': self.telegraph_content.append(msg) if len(self.telegraph_content) == 0: return "No Result Found ❌", None for content in self.telegraph_content: self.path.append( Telegraph(access_token=telegraph_token).create_page( title='Slam Mirror Bot Search', author_name='Slam Mirror Bot', author_url= 'https://github.com/breakdowns/slam-mirrorbot', html_content=content)['path']) self.num_of_path = len(self.path) if self.num_of_path > 1: self.edit_telegraph() msg = f"<b>Found {len(response['files'])} results for <i>{fileName}</i></b>" buttons = button_build.ButtonMaker() buttons.buildbutton("🔎 VIEW", f"https://telegra.ph/{self.path[0]}") return msg, InlineKeyboardMarkup(buttons.build_menu(1)) else: return '', ''
# 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 <https://www.gnu.org/licenses/>. from telegraph import Telegraph from telethon import events from telethon.errors.rpcerrorlist import YouBlockedUserError from heroku_config import Var from WhiteEyeUserBot.utils import WhiteEye_on_cmd, sudo_cmd from WhiteEyeUserBot import CMD_HELP telegraph = Telegraph() mee = telegraph.create_account(short_name="WhiteEye") @WhiteEye.on(WhiteEye_on_cmd(pattern="purl ?(.*)")) @WhiteEye.on(sudo_cmd(pattern="purl ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.reply("**Reply to any document.**") return reply_message = await event.get_reply_message() chat = "@FiletolinkTGbot" reply_message.sender (event, "**Making public url...**")
""" (C) @DeletedUser420 All rights Reserved. """ from main_startup.config_var import Config from main_startup.core.decorators import friday_on_cmd, listen from main_startup.core.startup_helpers import run_cmd from main_startup.helper_func.basic_helpers import edit_or_reply, get_text from main_startup.helper_func.logger_s import LogIt import os from telegraph import Telegraph telegraph = Telegraph() page_ = telegraph.create_account(short_name="Enjoyer") @friday_on_cmd( ['mediainfo', 'mediadata'], cmd_help={ "help": "Get Full Info Of A Media.", "example": "{ch}mediainfo (replying to file)" }) async def get_mediainfo(client, message): m_ = await edit_or_reply(message, "`Gᴇɴᴇʀᴀᴛɪɴɢ ...`") if not message.reply_to_message: return await m_.edit("`Reply To Media!`") if not message.reply_to_message.media: return await m_.edit("`Reply To Media!`") file_path = await message.reply_to_message.download() out, err, ret, pid = await run_cmd(f"mediainfo '{file_path}'")
async def _(event): if not event.is_private: return tata = event.pattern_match.group(1) data = tata.decode() meta = data.split("-", 1)[1] # print(meta) if "|" in meta: sender, chatid, msgid = meta.split("|") sender = int(sender.strip()) if not event.sender_id == sender: await event.answer("You haven't send that command !") return num = 0 chatid = int(chatid.strip()) msgid = int(msgid.strip()) to_check = get_email(event.sender_id) email = to_check["email"] hash = to_check["hash"] mails = tm.get_mailbox(email=email, email_hash=hash) if type(mails) is dict: for key, value in mails.items(): if value == "There are no emails yet": await tbot.edit_message(chatid, msgid, "There are no emails yet.") return vector = len(mails) if num > vector - 1: num = 0 # print(vector) # print(num) header = f"**#{num} **" from_mail = mails[int(num)]["mail_from"] subject = mails[int(num)]["mail_subject"] msg = mails[int(num)]["mail_text"] ttime = mails[int(num)]["mail_timestamp"] mail_id = mails[int(num)]["mail_id"] attch = int(mails[int(num)]["mail_attachments_count"]) timestamp = ttime dt_object = datetime.fromtimestamp(timestamp) ttime = str(dt_object) header = f"**#{num} **" telegraph = Telegraph() telegraph.create_account(short_name="MissJuliaRobot") if subject == "": subject = "No Subject" headers = f"**FROM**: {from_mail}\n**TO**: {email}\n**DATE**: {ttime}\n**MAIL BODY**:\n\n{msg}" nheaders = headers.replace("\n", "<br />") final = markdown.markdown(nheaders) response = telegraph.create_page(subject, html_content=final) tlink = "https://telegra.ph/{}".format(response["path"]) if not attch > 0: lastisthis = (f"{header}MAIL FROM: {from_mail}" + "\n" + f"TO: {email}" + "\n" + f"DATE: `{ttime}`") else: lastisthis = (f"{header}MAIL FROM: {from_mail}" + "\n" + f"TO: {email}" + "\n" + f"DATE: `{ttime}`" + "\n\n" + "**The attachments will be send to you shortly !**") await tbot.edit_message( chatid, msgid, lastisthis, link_preview=False, buttons=[ [ Button.url( "Click here to read this mail", url=f"{tlink}", ), ], [ Button.inline( "◀️", data=f"checkinboxprev-{sender}|{num}|{chatid}|{msgid}", ), Button.inline( "❌", data=f"stopcheckinbox-{sender}|{chatid}|{msgid}"), Button.inline( "▶️", data=f"checkinboxnext-{sender}|{num}|{chatid}|{msgid}", ), ], [ Button.inline( "Refresh 🔁", data=f"refreshinbox-{sender}|{chatid}|{msgid}", ) ], ], ) if attch > 0: gg = get_attachments(mail_id) for i in gg: fname = i["name"] with open(fname, "w+b") as f: f.write(base64.b64decode((i["content"]).encode())) await tbot.send_file(chatid, file=fname) os.remove(fname)
input('Folder: ').replace("\\", "\\").replace('"', '').replace("'", "\'")) elif system() == 'Linux': chdir(input('Folder: ').replace("'", "")[:-1]) else: print("System not supported") # define variable nlist = [] listo = [] nfilework = 0 html = '''<p>{}</p> '''.format(input("Initial Text:")) edtext = '''<p>{}</p> '''.format(input("Ending Text:")) ordfile = [] telegraph = Telegraph() telegraph.create_account(short_name="Yotsugi") # convert png to jpg, and rename jpeg to jpg print("Converting file") if system() == 'Windows': for i in glob("*.png"): print("Converting: ", i) run(str("magick.exe mogrify -format jpg -quality 89 " + i), shell=True) remove(i) elif system() == 'Linux': for i in glob("*.png"): print("Converting: ", i) run(str("mogrify -format jpg -quality 89 " + i), shell=True) remove(i)
) import asyncio, os, httplib2 from telethon import events from bs4 import BeautifulSoup from googleapiclient.discovery import build from apiclient.http import MediaFileUpload from oauth2client.client import OAuth2WebServerFlow from oauth2client.file import Storage from mimetypes import guess_type OAUTH_SCOPE = "https://www.googleapis.com/auth/drive.file" REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob" parent_id = Var.GDRIVE_FOLDER_ID G_DRIVE_DIR_MIME_TYPE = "application/vnd.google-apps.folder" telegraph = Telegraph() telegraph.create_account(short_name="Ultroid Cmds List") async def ban_time(event, time_str): if any(time_str.endswith(unit) for unit in ('m', 'h', 'd')): unit = time_str[-1] time_int = time_str[:-1] if not time_int.isdigit(): return await event.edit("Invalid time amount specified.") if unit == 'm': bantime = int(time.time() + int(time_int) * 60) elif unit == 'h': bantime = int(time.time() + int(time_int) * 60 * 60) elif unit == 'd': bantime = int(time.time() + int(time_int) * 24 * 60 * 60) else:
import logging import time import os import sys import spamwatch from redis import StrictRedis from pyrogram import Client, errors from telethon import TelegramClient import telegram.ext as tg from telegraph import Telegraph telegraph = Telegraph() telegraph.create_account(short_name='ryuzoku') StartTime = time.time() # enable logging logging.basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", handlers=[ logging.FileHandler("Elizabeth-log.txt"), logging.StreamHandler(), ], level=logging.INFO, ) LOGGER = logging.getLogger(__name__) LOGGER.info("Starting Elizabeth...") # if version < 3.8, stop bot.
if not HEROKU: app2 = Client("userbot", phone_number=PHONE_NUMBER, api_id=API_ID, api_hash=API_HASH) else: app2 = Client(SESSION_STRING, api_id=API_ID, api_hash=API_HASH) # Bot client app = Client("wbb", bot_token=BOT_TOKEN, api_id=API_ID, api_hash=API_HASH) # MongoDB client mongo_client = MongoClient(MONGO_DB_URI) db = mongo_client.wbb # ARQ client arq = ARQ(ARQ_API_BASE_URL) # Telegram client telegraph = Telegraph() telegraph.create_account(short_name="wbb") session = aiohttp.ClientSession() # Spamwatch client spamwatch = spamwatch_.Client(SPAMWATCH_API_KEY) BOT_ID = 0 BOT_NAME = "" BOT_USERNAME = "" BOT_MENTION = "" BOT_DC_ID = 0 USERBOT_ID = 0 USERBOT_NAME = "" USERBOT_USERNAME = "" USERBOT_DC_ID = 0 USERBOT_MENTION = ""
"""@telegraph Utilities Available Commands: /telegraph media as reply to a media /telegraph text as reply to a large text""" import os from datetime import datetime from PIL import Image from telegraph import Telegraph, exceptions, upload_file from telethon import events from DaisyX.services.telethon import tbot as borg telegraph = Telegraph() r = telegraph.create_account(short_name="DORAEMON") auth_url = r["auth_url"] # Will change later TMP_DOWNLOAD_DIRECTORY = "./" BOTLOG = False @borg.on(events.NewMessage(pattern="/telegraph (media|text) ?(.*)")) async def _(event): if event.fwd_from: return optional_title = event.pattern_match.group(2) if event.reply_to_msg_id: start = datetime.now() r_message = await event.get_reply_message()
MEGA_PASSWORD = None try: INDEX_URL = getConfig('INDEX_URL') if len(INDEX_URL) == 0: INDEX_URL = None except KeyError: INDEX_URL = None try: IS_TEAM_DRIVE = getConfig('IS_TEAM_DRIVE') if IS_TEAM_DRIVE.lower() == 'true': IS_TEAM_DRIVE = True else: IS_TEAM_DRIVE = False except KeyError: IS_TEAM_DRIVE = False try: USE_SERVICE_ACCOUNTS = getConfig('USE_SERVICE_ACCOUNTS') if USE_SERVICE_ACCOUNTS.lower() == 'true': USE_SERVICE_ACCOUNTS = True else: USE_SERVICE_ACCOUNTS = False except KeyError: USE_SERVICE_ACCOUNTS = False telegra_ph = Telegraph(access_token=telegraph_token) updater = tg.Updater(token=BOT_TOKEN, use_context=True) bot = updater.bot dispatcher = updater.dispatcher
import datetime from telethon import events from telegraph import Telegraph from telethon.errors.rpcerrorlist import YouBlockedUserError from telethon.tl.functions.account import UpdateNotifySettingsRequest from userbot.utils import admin_cmd from heroku_config import Var import asyncio telegraph = Telegraph() mee = telegraph.create_account(short_name="sparkzzz") @borg.on(admin_cmd(pattern=("sang ?(.*)"))) async def _(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.edit("```Reply to any user message.```") return reply_message = await event.get_reply_message() if not reply_message.text: await event.edit("```reply to text message```") return chat = "@SangMataInfo_bot" sender = reply_message.sender if reply_message.sender.bot: await event.edit("```Reply to actual users message.```") return await event.edit("```Processing```") async with borg.conversation(chat) as conv: try:
Check Current Beta firmwares of Samsung Devices Syntax: .check androidVersion modelNumber By :- Jaskaran ^_^ Telegram :- @Zero_cool7870 """ import gc from asyncio import wait import requests from bs4 import BeautifulSoup as bs from telegraph import Telegraph from telethon import events telegraph = Telegraph() telegraph.create_account(short_name="zeroc") chat_ids = [596701090, 517742107] csclist = [ "ACG", "ATT", "BST", "CCT", "GCF", "LRA", "SPR", "TFN", "TMB", "USC", "VMU", "VZW",
import requests from telegraph import Telegraph telegraph = Telegraph() telegraph.create_account(short_name='Барахолка') # response = telegraph.create_page(title='Title',html_content='<p>Hello, world!</p>') # response = telegraph.create_page(title='Title', content=[{"tag": "p", "children":["Hello,+world!"]}]) with open('business.jpg', 'rb') as f: with open('surf.jpg', 'rb') as g: print(type(f)) print(type(g)) paths = [ x['src'] for x in requests.post('https://telegra.ph/upload', files={ '1': ('file', f, 'image/jpeg'), '2': ('file', g, 'image/jpeg') }).json() ] # print(paths) # with open('order_template.html', encoding='utf-8', mode='r') as template_file: # template = template_file.read() # images_content = '\n'.join(["<img src = '{}' />".format(x) for x in paths]) # # html_content=template.format(images_content, 450, 'description') print(html_content) # response = telegraph.create_page('Title', html_content=html_content) # print(response) # print('https://telegra.ph/{}'.format(response['path']))
# Originally By @DeletedUser420 # Ported - @swatv3nub import asyncio import os import shlex from typing import Tuple from telegraph import Telegraph from FreakyUserbot import CMD_HELP from FreakyUserbot.Configs import Config from FreakyUserbot.utils import Freaky_on_cmd telegraph = Telegraph() tgnoob = telegraph.create_account(short_name="Freaky 🇮🇳") async def runcmd(cmd: str) -> Tuple[str, str, int, int]: """ run command in terminal """ args = shlex.split(cmd) process = await asyncio.create_subprocess_exec( *args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stdout, stderr = await process.communicate() return ( stdout.decode("utf-8", "replace").strip(), stderr.decode("utf-8", "replace").strip(), process.returncode, process.pid, )
import re from os import remove import requests from telegraph import Telegraph from telegraph import upload_file as upl from . import * # --------------------------------------------------------------------# telegraph = Telegraph() r = telegraph.create_account(short_name="INFINATO") auth_url = r["auth_url"] # --------------------------------------------------------------------# TOKEN_FILE = "resources/auths/auth_token.txt" @callback(re.compile("sndplug_(.*)")) async def send(eve): name = (eve.data_match.group(1)).decode("UTF-8") if name.startswith("def"): plug_name = name.replace(f"def_plugin_", "") plugin = f"plugins/{plug_name}.py" buttons = [ [Button.inline( "« Pᴀsᴛᴇ »", data=f"pasta-{plugin}", )], [ Button.inline("« Bᴀᴄᴋ", data="back"),
) from telegraph import Telegraph, exceptions, upload_file import os from database.pmdb import approve_user, disapprove_user, is_user_approved from main_startup.core.decorators import friday_on_cmd, listen from main_startup.helper_func.basic_helpers import get_text, edit_or_reply from main_startup.helper_func.logger_s import LogIt from main_startup.helper_func.plugin_helpers import convert_to_image PM_WARNS = {} OLD_MSG = {} from plugins import devs_id try: telegraph = Telegraph() r = telegraph.create_account(short_name="FridayUserBot.") auth_url = r["auth_url"] except: pass @friday_on_cmd( ["setpmtext"], cmd_help={ "help": "Set Custom On Text!", "example": "{ch}setpmtext (reply to Pm Text)", }, ) async def set_custom_pm_texts(client, message): ptext = get_text(message)
def setUp(self): self.t = Telegraph( 'd676e590b0c6bac0ea58cfcdd350272691ea9fb10b2aeb33edcf68dbb20d')
from SaitamaRobot.event import register from SaitamaRobot import telethn as tbot TMP_DOWNLOAD_DIRECTORY = "./" from telethon import events import os from PIL import Image from datetime import datetime from telegraph import Telegraph, upload_file, exceptions darkprince = "CUTIEPII" telegraph = Telegraph() r = telegraph.create_account(short_name=darkprince) auth_url = r["auth_url"] @register(pattern="^/t(m|t) ?(.*)") async def _(event): if event.fwd_from: return optional_title = event.pattern_match.group(2) if event.reply_to_msg_id: start = datetime.now() r_message = await event.get_reply_message() input_str = event.pattern_match.group(1) if input_str == "m": downloaded_file_name = await tbot.download_media( r_message, TMP_DOWNLOAD_DIRECTORY) end = datetime.now() ms = (end - start).seconds h = await event.reply("Downloaded to {} in {} seconds.".format( downloaded_file_name, ms)) if downloaded_file_name.endswith((".webp")):
from SheebaQueen.events import register from SheebaQueen import telethn as tbot TMP_DOWNLOAD_DIRECTORY = "./" from telethon import events import os from PIL import Image from datetime import datetime from telegraph import Telegraph, upload_file, exceptions Dhansh = "Sheeba" telegraph = Telegraph() r = telegraph.create_account(short_name=Dhansh) auth_url = r["auth_url"] @register(pattern="^/t(xm|xt) ?(.*)") async def _(event): if event.fwd_from: return optional_title = event.pattern_match.group(2) if event.reply_to_msg_id: start = datetime.now() r_message = await event.get_reply_message() input_str = event.pattern_match.group(1) if input_str == "m": downloaded_file_name = await tbot.download_media( r_message, TMP_DOWNLOAD_DIRECTORY) end = datetime.now() ms = (end - start).seconds h = await event.reply("Downloaded to {} in {} seconds.".format(
import datetime import html import textwrap import bs4 import jikanpy import requests from telegraph import Telegraph from inspect import getfullargspec from pyrogram import Client, filters from pyrogram.types import Message, Update, InlineKeyboardMarkup, InlineKeyboardButton from hitsuki import pbot from hitsuki.modules.tr_engine.strings import tld telegraph = Telegraph() telegraph.create_account(short_name='hitsuki') info_btn = "More Information" url = 'https://graphql.anilist.co' airing_query = ''' query ($id: Int,$search: String) { Media (id: $id, type: ANIME,search: $search) { id episodes title { romaji english native }
def drive_list(self, fileName): msg = "" fileName = self.escapes(str(fileName)) # Create Search Query for API request. query = f"'{parent_id}' in parents and (name contains '{fileName}')" response = self.__service.files().list(supportsTeamDrives=True, includeTeamDriveItems=True, q=query, spaces='drive', pageSize=200, fields='files(id, name, mimeType, size)', orderBy='name asc').execute() content_count = 0 if USE_TELEGRAPH: if response["files"]: msg += f'<h4>{len(response["files"])} Results : {fileName}</h4><br><br>' for file in response.get('files', []): if file.get( 'mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File. furl = f"https://drive.google.com/drive/folders/{file.get('id')}" msg += f"⁍<code>{file.get('name')}<br>(folder📁)</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text msg += f"<b><a href={sfurl}>🌍 𝗚-𝗗𝗥𝗜𝗩𝗘 𝗟𝗜𝗡𝗞 🌍</a></b>" else: msg += f"<b><a href={furl}>🌍 𝗚-𝗗𝗥𝗜𝗩𝗘 𝗟𝗜𝗡𝗞 🌍</a></b>" if INDEX_URL is not None: url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/') if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text msg += f' <b>| <a href="{siurl}">🔒 𝗜𝗡𝗗𝗘𝗫 𝗟𝗜𝗡𝗞 🔒</a></b>' else: msg += f' <b>| <a href="{url}">🔒 𝗜𝗡𝗗𝗘𝗫 𝗟𝗜𝗡𝗞 🔒</a></b>' else: furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download" msg += f"⁍<code>{file.get('name')}<br>({get_readable_file_size(int(file.get('size')))})📄</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text msg += f"<b><a href={sfurl}>🌍 𝗚-𝗗𝗥𝗜𝗩𝗘 𝗟𝗜𝗡𝗞 🌍</a></b>" else: msg += f"<b><a href={furl}>🌍 𝗚-𝗗𝗥𝗜𝗩𝗘 𝗟𝗜𝗡𝗞 🌍</a></b>" if INDEX_URL is not None: url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}') if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text msg += f' <b>| <a href="{siurl}">🔒 𝗜𝗡𝗗𝗘𝗫 𝗟𝗜𝗡𝗞 🔒</a></b>' else: msg += f' <b>| <a href="{url}">🔒 𝗜𝗡𝗗𝗘𝗫 𝗟𝗜𝗡𝗞 🔒</a></b>' msg += '<br><br>' content_count += 1 if content_count == TELEGRAPHLIMIT: self.telegraph_content.append(msg) msg = "" content_count = 0 if msg != '': self.telegraph_content.append(msg) if len(self.telegraph_content) == 0: return "No Result Found ❌", None for content in self.telegraph_content: self.path.append(Telegraph(access_token=TELEGRAPH_TOKEN).create_page( title='Mirror Zone Search', author_name='Mirror Zone', author_url='https://t.me/MirrorZone', html_content=content )['path']) self.num_of_path = len(self.path) if self.num_of_path > 1: self.edit_telegraph() msg = f"<b>🔎 Search Results For <i>{fileName}</i></b>\n\n<b>📚 Found {len(response['files'])} results</b>" buttons = button_build.ButtonMaker() buttons.buildbutton("HERE", f"https://telegra.ph/{self.path[0]}") return msg, InlineKeyboardMarkup(buttons.build_menu(1)) else: return '', '' if not USE_TELEGRAPH: for file in response.get('files', []): if file.get( 'mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File. msg += f"⁍ <a href='https://drive.google.com/drive/folders/{file.get('id')}'>{file.get('name')}" \ f"</a> (folder)" if INDEX_URL is not None: url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/') msg += f' | <a href="{url}"> Index URL</a>' else: msg += f"⁍ <a href='https://drive.google.com/uc?id={file.get('id')}" \ f"&export=download'>{file.get('name')}</a> ({get_readable_file_size(int(file.get('size')))})" if INDEX_URL is not None: url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}') msg += f' | <a href="{url}"> Index URL</a>' msg += '\n' return msg, ''
DOWNLOAD_STATUS_UPDATE_INTERVAL = int(getConfig('DOWNLOAD_STATUS_UPDATE_INTERVAL')) OWNER_ID = int(getConfig('OWNER_ID')) AUTO_DELETE_MESSAGE_DURATION = int(getConfig('AUTO_DELETE_MESSAGE_DURATION')) TELEGRAM_API = getConfig('TELEGRAM_API') TELEGRAM_HASH = getConfig('TELEGRAM_HASH') except KeyError as e: LOGGER.error("One or more env variables missing! Exiting now") exit(1) 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_KEY = getConfig('MEGA_KEY') except KeyError: MEGA_KEY = None LOGGER.info('MEGA API KEY NOT AVAILABLE') if MEGA_KEY is not None: try: MEGA_USERNAME = getConfig('MEGA_USERNAME') MEGA_PASSWORD = getConfig('MEGA_PASSWORD') # Start megasdkrest binary
import logging from telegraph import Telegraph from thebot.config import Config from pyrogram import Client, errors logging.basicConfig(level=logging.INFO) telegraph = Telegraph() telegraph.create_account(short_name='dank') API_ID = Config.API_ID API_HASH = Config.API_HASH TOKEN = Config.TOKEN DB_URI = Config.DB_URI ALLOWED_USERS = [895373440] dankbot = Client('dank', api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN)
from SaitamaRobot.events import register from SaitamaRobot import telethn as tbot TMP_DOWNLOAD_DIRECTORY = "tg-File/" from telethon import events import os from PIL import Image from datetime import datetime from telegraph import Telegraph, upload_file, exceptions babe = "SaitamaRobot" telegraph = Telegraph() r = telegraph.create_account(short_name=babe) auth_url = r["auth_url"] @register(pattern="^/tele(media|text) ?(.*)") async def _(event): if event.fwd_from: return optional_title = event.pattern_match.group(2) if event.reply_to_msg_id: start = datetime.now() r_message = await event.get_reply_message() input_str = event.pattern_match.group(1) if input_str == "media": downloaded_file_name = await tbot.download_media( r_message, TMP_DOWNLOAD_DIRECTORY ) end = datetime.now() ms = (end - start).seconds h = await event.reply("Downloaded to {} in {} seconds.".format(downloaded_file_name, ms))
import asyncio import random, re import datetime from telethon.tl.functions.account import UpdateNotifySettingsRequest from telegraph import Telegraph from telethon import events from telethon.errors.rpcerrorlist import YouBlockedUserError from userbot import CMD_HELP from userbot.utils import admin_cmd from var import Var telegraph = Telegraph() mee = telegraph.create_account(short_name="yohohehe") @borg.on(admin_cmd(pattern="recognize ?(.*)")) async def _(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.edit("Reply to any user's media message.") return reply_message = await event.get_reply_message() if not reply_message.media: await event.edit("reply to media file") return chat = "@Rekognition_Bot" sender = reply_message.sender if reply_message.sender.bot: await event.edit("Reply to actual users message.")