mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Fix
This commit is contained in:
parent
8fb2588d0c
commit
7c7c259d60
3 changed files with 18 additions and 11 deletions
|
|
@ -3,7 +3,7 @@ import subprocess
|
|||
import sys
|
||||
|
||||
import chevron
|
||||
from .media_helper import post_to_telegraph
|
||||
import telegraph
|
||||
import logging
|
||||
from aiohttp import ClientSession
|
||||
from misskaty import BOT_USERNAME
|
||||
|
|
@ -11,6 +11,11 @@ from bs4 import BeautifulSoup as bs4
|
|||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
telegraph = telegraph.Telegraph()
|
||||
if telegraph.get_access_token() == None:
|
||||
token_ph = telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info(f"kuso_utils: Create TGH Account ..")
|
||||
|
||||
headers = {"Accept": "*/*", "User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"}
|
||||
|
||||
|
||||
|
|
@ -79,7 +84,7 @@ async def byPassPh(url: str, msg_id: int):
|
|||
""".strip()
|
||||
if not kusonime["error"]:
|
||||
html = chevron.render(template, kusonime)
|
||||
page = await post_to_telegraph(False, f"{kusonime.get('title')}-{msg_id}", html)
|
||||
page = telegraph.create_page(f"{kusonime.get('title')}-{msg_id}", html_content=html)
|
||||
results.update({"error": False, "url": "https://telegra.ph/{}".format(page["path"])})
|
||||
del results["error_message"]
|
||||
return results
|
||||
|
|
|
|||
|
|
@ -102,12 +102,15 @@ async def member_has_joined(c: app, member: ChatMemberUpdated):
|
|||
pic = await app.download_media(user.photo.big_file_id, file_name=f"pp{user.id}.png")
|
||||
except AttributeError:
|
||||
pic = "img/profilepic.png"
|
||||
welcomeimg = await welcomepic(pic, user.first_name, member.chat.title, count, user.id)
|
||||
temp.MELCOW[f"welcome-{member.chat.id}"] = await c.send_photo(
|
||||
member.chat.id,
|
||||
photo=welcomeimg,
|
||||
caption=f"Hai {mention}, Selamat datang digrup {member.chat.title} harap baca rules di pinned message terlebih dahulu.\n\n<b>Nama :<b> <code>{first_name}</code>\n<b>ID :<b> <code>{id}</code>\n<b>DC ID :<b> <code>{dc}</code>\n<b>Tanggal Join :<b> <code>{joined_date}</code>",
|
||||
)
|
||||
try:
|
||||
welcomeimg = await welcomepic(pic, user.first_name, member.chat.title, count, user.id)
|
||||
temp.MELCOW[f"welcome-{member.chat.id}"] = await c.send_photo(
|
||||
member.chat.id,
|
||||
photo=welcomeimg,
|
||||
caption=f"Hai {mention}, Selamat datang digrup {member.chat.title} harap baca rules di pinned message terlebih dahulu.\n\n<b>Nama :<b> <code>{first_name}</code>\n<b>ID :<b> <code>{id}</code>\n<b>DC ID :<b> <code>{dc}</code>\n<b>Tanggal Join :<b> <code>{joined_date}</code>",
|
||||
)
|
||||
except:
|
||||
pass
|
||||
userspammer = ""
|
||||
# Spamwatch Detection
|
||||
try:
|
||||
|
|
@ -181,13 +184,13 @@ async def save_group(bot, message):
|
|||
pic = await app.download_media(u.photo.big_file_id, file_name=f"pp{u.id}.png")
|
||||
except AttributeError:
|
||||
pic = "img/profilepic.png"
|
||||
welcomeimg = await welcomepic(pic, u.first_name, message.chat.title, count, u.id)
|
||||
if (temp.MELCOW).get(f"welcome-{message.chat.id}") is not None:
|
||||
try:
|
||||
await (temp.MELCOW[f"welcome-{message.chat.id}"]).delete()
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
welcomeimg = await welcomepic(pic, u.first_name, message.chat.title, count, u.id)
|
||||
temp.MELCOW[f"welcome-{message.chat.id}"] = await app.send_photo(
|
||||
message.chat.id,
|
||||
photo=welcomeimg,
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ async def telegraph_paste(_, message):
|
|||
|
||||
pasted = f"**Successfully upload your media to Telegraph<a href='{url}'>.</a>\n\nUpload by {uname}**"
|
||||
remove(file)
|
||||
return await editPesan(msg, pasted, reply_markup=InlineKeyboardMarkup(button))
|
||||
return await editPesan(msg, pasted, disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup(button))
|
||||
data = ""
|
||||
limit = 1024 * 1024
|
||||
if reply and reply.document:
|
||||
|
|
@ -181,7 +181,6 @@ async def wastepaste(_, message):
|
|||
"ephemeral": False,
|
||||
"expire_at": 0,
|
||||
"expire_in": 0,
|
||||
"date_created": 0,
|
||||
}
|
||||
response = await http.post('https://yasirbin.deta.dev/api/new', json=json_data)
|
||||
url = f"https://yasirbin.deta.dev/{response.json()['id']}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue