mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-09 05:04:50 +00:00
add tgraph
This commit is contained in:
parent
de4438adfa
commit
7713345773
3 changed files with 22 additions and 11 deletions
|
|
@ -18,7 +18,8 @@ async def post_to_telegraph(is_media: bool, title: str, content: str, media=None
|
||||||
response = await telegraph.create_page(
|
response = await telegraph.create_page(
|
||||||
title,
|
title,
|
||||||
html_content=content,
|
html_content=content,
|
||||||
author_url="https://t.me/MissKatyPyro"
|
author_url="https://t.me/MissKatyPyro",
|
||||||
|
author_name="MissKatyBot"
|
||||||
)
|
)
|
||||||
return response['url']
|
return response['url']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ __MODULE__ = "Download/Upload"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
/download [url] - Download file from URL (Sudo Only)
|
/download [url] - Download file from URL (Sudo Only)
|
||||||
/download [reply_to_TG_File] - Download TG File
|
/download [reply_to_TG_File] - Download TG File
|
||||||
|
/tgraph_up [reply_to_TG_File] - Download TG File
|
||||||
/tiktokdl [link] - Download TikTok Video
|
/tiktokdl [link] - Download TikTok Video
|
||||||
/fbdl [link] - Download Facebook Video
|
/fbdl [link] - Download Facebook Video
|
||||||
/anon [link] - Upload files to Anonfiles
|
/anon [link] - Upload files to Anonfiles
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ __HELP__ = """
|
||||||
/paste [Text/Reply To Message] - Post text to My Pastebin.
|
/paste [Text/Reply To Message] - Post text to My Pastebin.
|
||||||
/sbin [Text/Reply To Message] - Post text to Spacebin.
|
/sbin [Text/Reply To Message] - Post text to Spacebin.
|
||||||
/neko [Text/Reply To Message] - Post text to Nekobin.
|
/neko [Text/Reply To Message] - Post text to Nekobin.
|
||||||
/tgraph [Text/Reply To Message] - Post text to Telegra.ph.
|
/tgraph [Text/Reply To Message] - Post text/media to Telegra.ph.
|
||||||
/rentry [Text/Reply To Message] - Post text to Rentry using markdown style.
|
/rentry [Text/Reply To Message] - Post text to Rentry using markdown style.
|
||||||
/temp_paste [Text/Reply To Message] - Post text to tempaste.com using html style.
|
/temp_paste [Text/Reply To Message] - Post text to tempaste.com using html style.
|
||||||
"""
|
"""
|
||||||
|
|
@ -69,7 +69,24 @@ async def telegraph_paste(_, message):
|
||||||
if not reply and len(message.command) < 2:
|
if not reply and len(message.command) < 2:
|
||||||
return await message.reply_text(f"**Reply To A Message With /{message.command[0]} or with command**")
|
return await message.reply_text(f"**Reply To A Message With /{message.command[0]} or with command**")
|
||||||
|
|
||||||
|
if message.from_user:
|
||||||
|
if message.from_user.username:
|
||||||
|
uname = f"@{message.from_user.username} [{message.from_user.id}]"
|
||||||
|
else:
|
||||||
|
uname = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id}) [{message.from_user.id}]"
|
||||||
|
else:
|
||||||
|
uname = message.sender_chat.title
|
||||||
msg = await message.reply_text("`Pasting to Telegraph...`")
|
msg = await message.reply_text("`Pasting to Telegraph...`")
|
||||||
|
if reply and (reply.photo or reply.animation):
|
||||||
|
file = await reply.download()
|
||||||
|
url = await post_to_telegraph(True, media=file)
|
||||||
|
button = [
|
||||||
|
[InlineKeyboardButton("Open Link", url=url)],
|
||||||
|
[InlineKeyboardButton("Share Link", url=f"https://telegram.me/share/url?url={url}")],
|
||||||
|
]
|
||||||
|
|
||||||
|
pasted = f"**Successfully upload your media to Telegraph<a href='{url}'>.</a>\n\nUpload by {uname}**"
|
||||||
|
await msg.edit(pasted, reply_markup=InlineKeyboardMarkup(button))
|
||||||
data = ""
|
data = ""
|
||||||
limit = 1024 * 1024
|
limit = 1024 * 1024
|
||||||
if reply and reply.document:
|
if reply and reply.document:
|
||||||
|
|
@ -96,14 +113,6 @@ async def telegraph_paste(_, message):
|
||||||
title = "MissKaty Paste"
|
title = "MissKaty Paste"
|
||||||
data = message.text.split(None, 1)[1]
|
data = message.text.split(None, 1)[1]
|
||||||
|
|
||||||
if message.from_user:
|
|
||||||
if message.from_user.username:
|
|
||||||
uname = f"@{message.from_user.username} [{message.from_user.id}]"
|
|
||||||
else:
|
|
||||||
uname = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id}) [{message.from_user.id}]"
|
|
||||||
else:
|
|
||||||
uname = message.sender_chat.title
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = await post_to_telegraph(False, title, data)
|
url = await post_to_telegraph(False, title, data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue