mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-02 18:44:51 +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(
|
||||
title,
|
||||
html_content=content,
|
||||
author_url="https://t.me/MissKatyPyro"
|
||||
author_url="https://t.me/MissKatyPyro",
|
||||
author_name="MissKatyBot"
|
||||
)
|
||||
return response['url']
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ __MODULE__ = "Download/Upload"
|
|||
__HELP__ = """
|
||||
/download [url] - Download file from URL (Sudo Only)
|
||||
/download [reply_to_TG_File] - Download TG File
|
||||
/tgraph_up [reply_to_TG_File] - Download TG File
|
||||
/tiktokdl [link] - Download TikTok Video
|
||||
/fbdl [link] - Download Facebook Video
|
||||
/anon [link] - Upload files to Anonfiles
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ __HELP__ = """
|
|||
/paste [Text/Reply To Message] - Post text to My Pastebin.
|
||||
/sbin [Text/Reply To Message] - Post text to Spacebin.
|
||||
/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.
|
||||
/temp_paste [Text/Reply To Message] - Post text to tempaste.com using html style.
|
||||
"""
|
||||
|
|
@ -68,8 +68,25 @@ async def telegraph_paste(_, message):
|
|||
reply = message.reply_to_message
|
||||
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**")
|
||||
|
||||
|
||||
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...`")
|
||||
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 = ""
|
||||
limit = 1024 * 1024
|
||||
if reply and reply.document:
|
||||
|
|
@ -96,14 +113,6 @@ async def telegraph_paste(_, message):
|
|||
title = "MissKaty Paste"
|
||||
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:
|
||||
url = await post_to_telegraph(False, title, data)
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Reference in a new issue