mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Lazy to make commit
This commit is contained in:
parent
2c1c7d0f15
commit
8390bcdd42
15 changed files with 41 additions and 28 deletions
BIN
assets/MutantAcademyStyle.ttf
Normal file
BIN
assets/MutantAcademyStyle.ttf
Normal file
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
|
@ -1,8 +1,8 @@
|
|||
from pyrogram import filters
|
||||
from pyrogram.errors import MessageNotModified
|
||||
from pyrogram.errors import MessageNotModified, MessageTooLong
|
||||
|
||||
from misskaty import app
|
||||
from misskaty.helper.http import http
|
||||
from misskaty.helper import http, post_to_telegraph
|
||||
from misskaty.core.message_utils import *
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
from misskaty.vars import COMMAND_HANDLER, OPENAI_API
|
||||
|
|
@ -31,8 +31,14 @@ async def chatbot(c, m):
|
|||
msg = await kirimPesan(m, "Wait a moment looking for your answer..")
|
||||
try:
|
||||
response = (await http.post("https://api.openai.com/v1/chat/completions", headers=headers, json=json_data)).json()
|
||||
await editPesan(msg, response["choices"][0]["message"]["content"])
|
||||
except MessageNotModified:
|
||||
if err := response["error"]:
|
||||
return await editPesan(msg, err["message"])
|
||||
answer = response["choices"][0]["message"]["content"]
|
||||
await editPesan(msg, answer)
|
||||
except MessageTooLong:
|
||||
answerlink = await post_to_telegraph(False, "MissKaty ChatBot ", answer)
|
||||
await editPesan(msg, f"Question for your answer has exceeded TG text limit, check this link to view.\n\n{answerlink}", disable_web_page_preview=True)
|
||||
except (MessageNotModified, MessageIdInvalid):
|
||||
pass
|
||||
except Exception as err:
|
||||
await editPesan(msg, f"Oppss. ERROR: {err}")
|
||||
await editPesan(msg, f"Oppss. ERROR: {str(err)}")
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
|||
from misskaty import app, user, botStartTime, BOT_NAME
|
||||
from misskaty.helper import http
|
||||
from misskaty.helper.human_read import get_readable_file_size, get_readable_time
|
||||
from misskaty.core.message_utils import editPesan, kirimPesan
|
||||
from misskaty.core.message_utils import editPesan, hapusPesan, kirimPesan
|
||||
from misskaty.vars import COMMAND_HANDLER, SUDO
|
||||
from utils import LOGGER
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ async def donate(_, message):
|
|||
@app.on_message(filters.command(["balas"], COMMAND_HANDLER) & filters.user(SUDO) & filters.reply)
|
||||
async def balas(c, m):
|
||||
pesan = m.text.split(" ", 1)
|
||||
await m.delete()
|
||||
await hapusPesan(m)
|
||||
await m.reply(pesan[1], reply_to_message_id=m.reply_to_message.id)
|
||||
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ async def evaluation_cmd_t(_, m):
|
|||
document="MissKatyEval.txt",
|
||||
caption=f"<code>{cmd[1][: 4096 // 4 - 1]}</code>",
|
||||
disable_notification=True,
|
||||
thumb="img/thumb.jpg",
|
||||
thumb="assets/thumb.jpg",
|
||||
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]),
|
||||
)
|
||||
os.remove("MissKatyEval.txt")
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ async def fbdl(client, message):
|
|||
await message.reply_video(
|
||||
path,
|
||||
caption=f"<code>{os.path.basename(path)}</code>\n\nUploaded for {message.from_user.mention} [<code>{message.from_user.id}</code>]",
|
||||
thumb="img/thumb.jpg"
|
||||
thumb="assets/thumb.jpg"
|
||||
)
|
||||
await msg.delete()
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -48,19 +48,19 @@ def draw_multiple_line_text(image, text, font, text_start_height):
|
|||
|
||||
@asyncify
|
||||
def welcomepic(pic, user, chat, id):
|
||||
background = Image.open("img/bg.png") # <- Background Image (Should be PNG)
|
||||
background = Image.open("assets/bg.png") # <- Background Image (Should be PNG)
|
||||
background = background.resize((1024, 500), Image.ANTIALIAS)
|
||||
pfp = Image.open(pic).convert("RGBA")
|
||||
pfp = circle(pfp)
|
||||
pfp = pfp.resize((265, 265)) # Resizes the Profilepicture so it fits perfectly in the circle
|
||||
font = ImageFont.truetype("Calistoga-Regular.ttf", 37) # <- Text Font of the Member Count. Change the text size for your preference
|
||||
font = ImageFont.truetype("assets/Calistoga-Regular.ttf", 37) # <- Text Font of the Member Count. Change the text size for your preference
|
||||
member_text = f"Selamat Datang {user} [{id}]" # <- Text under the Profilepicture with the Membercount
|
||||
draw_multiple_line_text(background, member_text, font, 395)
|
||||
draw_multiple_line_text(background, chat, font, 47)
|
||||
ImageDraw.Draw(background).text(
|
||||
(530, 460),
|
||||
f"Generated by @{BOT_USERNAME}",
|
||||
font=ImageFont.truetype("Calistoga-Regular.ttf", 28),
|
||||
font=ImageFont.truetype("assets/Calistoga-Regular.ttf", 28),
|
||||
size=20,
|
||||
align="right",
|
||||
)
|
||||
|
|
@ -96,7 +96,7 @@ async def member_has_joined(c: app, member: ChatMemberUpdated):
|
|||
try:
|
||||
pic = await app.download_media(user.photo.big_file_id, file_name=f"pp{user.id}.png")
|
||||
except AttributeError:
|
||||
pic = "img/profilepic.png"
|
||||
pic = "assets/profilepic.png"
|
||||
try:
|
||||
welcomeimg = await welcomepic(pic, user.first_name, member.chat.title, user.id)
|
||||
temp.MELCOW[f"welcome-{member.chat.id}"] = await c.send_photo(
|
||||
|
|
@ -177,7 +177,7 @@ async def save_group(bot, message):
|
|||
try:
|
||||
pic = await app.download_media(u.photo.big_file_id, file_name=f"pp{u.id}.png")
|
||||
except AttributeError:
|
||||
pic = "img/profilepic.png"
|
||||
pic = "assets/profilepic.png"
|
||||
if (temp.MELCOW).get(f"welcome-{message.chat.id}") is not None:
|
||||
try:
|
||||
await temp.MELCOW[f"welcome-{message.chat.id}"].delete()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
import logging
|
||||
import re
|
||||
import traceback
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from urllib.parse import quote_plus
|
||||
|
|
@ -22,8 +23,8 @@ from misskaty import BOT_USERNAME, app
|
|||
from misskaty.core.message_utils import *
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
from misskaty.helper import http, get_random_string, search_jw, GENRES_EMOJI
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
from misskaty.helper import http, get_random_string, search_jw, GENRES_EMOJI, post_to_telegraph
|
||||
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
LIST_CARI = {}
|
||||
|
|
@ -394,10 +395,12 @@ async def imdb_id_callback(_, query):
|
|||
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||
else:
|
||||
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||
except MessageNotModified:
|
||||
except (MessageNotModified, MessageIdInvalid):
|
||||
pass
|
||||
except Exception as exc:
|
||||
await query.message.edit_caption(f"<b>ERROR:</b>\n<code>{exc}</code>")
|
||||
err = traceback.format_exc(limit=20)
|
||||
await query.message.edit_caption(f"<b>ERROR:</b>\n<code>{exc}</code>\n<b>Full Error:</b> <code>{err}</code>\n\nSilahkan lapor ke owner detail errornya dengan lengkap, atau laporan error akan diabaikan.")
|
||||
await app.send_message(LOG_CHANNEL, f"ERROR getting IMDb Detail in Indonesia:\n<code>{str(err)}</code>")
|
||||
|
||||
|
||||
@app.on_callback_query(filters.regex("^imdbres_en"))
|
||||
|
|
@ -510,5 +513,9 @@ async def imdb_en_callback(bot, query):
|
|||
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||
else:
|
||||
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||
except (MessageNotModified, MessageIdInvalid):
|
||||
pass
|
||||
except Exception as exc:
|
||||
await query.message.edit_caption(f"<b>ERROR:</b>\n<code>{exc}</code>")
|
||||
err = traceback.format_exc(limit=20)
|
||||
await query.message.edit_caption(f"<b>ERROR:</b>\n<code>{exc}</code>\n<b>Full Error:</b> <code>{err}</code>\n\nPlease report to owner with detail of error, or your report will be ignored.")
|
||||
await app.send_message(LOG_CHANNEL, f"ERROR getting IMDb Detail in Eng:\n<code>{str(err)}</code>")
|
||||
|
|
|
|||
|
|
@ -46,6 +46,6 @@ async def jsonify(_, message):
|
|||
caption=f"<code>{str(e)}</code>",
|
||||
disable_notification=True,
|
||||
reply_to_message_id=reply_to_id,
|
||||
thumb="img/thumb.jpg",
|
||||
thumb="assets/thumb.jpg",
|
||||
)
|
||||
os.remove("json.text")
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ DETAILS
|
|||
await message.reply_document(
|
||||
out_file,
|
||||
caption=f"ℹ️ <b>MEDIA INFO</b>\n\n**Request by:** {message.from_user.mention}",
|
||||
thumb="img/thumb.jpg",
|
||||
thumb="assets/thumb.jpg",
|
||||
reply_markup=markup,
|
||||
)
|
||||
await process.delete()
|
||||
|
|
@ -101,7 +101,7 @@ DETAILS
|
|||
await message.reply_document(
|
||||
out_file,
|
||||
caption=f"Hasil mediainfo anda..\n\n**Request by:** {message.from_user.mention}",
|
||||
thumb="img/thumb.jpg",
|
||||
thumb="assets/thumb.jpg",
|
||||
reply_markup=markup,
|
||||
)
|
||||
await process.delete()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import textwrap
|
||||
from asyncio import gather
|
||||
from os import remove as hapus
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
|
@ -14,7 +15,7 @@ async def draw_meme_text(image_path, text):
|
|||
img = Image.open(image_path)
|
||||
hapus(image_path)
|
||||
i_width, i_height = img.size
|
||||
m_font = ImageFont.truetype("Calistoga-Regular.ttf", int((70 / 640) * i_width))
|
||||
m_font = ImageFont.truetype("assets/MutantAcademyStyle.ttf", int((70 / 640) * i_width))
|
||||
if ";" in text:
|
||||
upper_text, lower_text = text.split(";")
|
||||
else:
|
||||
|
|
@ -146,8 +147,7 @@ async def memify(client, message):
|
|||
try:
|
||||
file = await message.reply_to_message.download()
|
||||
webp, png = await draw_meme_text(file, message.text.split(None, 1)[1].strip())
|
||||
await message.reply_sticker(webp)
|
||||
await message.reply_document(png)
|
||||
await gather(*[message.reply_document(png), message.reply_sticker(webp)])
|
||||
try:
|
||||
hapus(webp)
|
||||
hapus(png)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ This feature inspired from SangMata Bot. I'm created simple detection to check u
|
|||
group=3,
|
||||
)
|
||||
async def cek_mataa(_, m):
|
||||
if not await is_sangmata_on(m.chat.id):
|
||||
if m.sender_chat or not await is_sangmata_on(m.chat.id):
|
||||
return
|
||||
if not await cek_userdata(m.from_user.id):
|
||||
return await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ async def convertsrt(c, m):
|
|||
await m.reply_document(
|
||||
f"{filename}.srt",
|
||||
caption=f"<code>{filename}.srt</code>\n\nConverted by @{c.me.username}",
|
||||
thumb="img/thumb.jpg",
|
||||
thumb="assets/thumb.jpg",
|
||||
progress=progress_for_pyrogram,
|
||||
progress_args=("Uploading files..", msg, c_time),
|
||||
)
|
||||
|
|
@ -168,7 +168,7 @@ async def stream_extract(bot, update):
|
|||
namafile,
|
||||
caption=f"<b>Filename:</b> <code>{namafile}</code>\n\nExtracted by @{bot.me.username} in {timelog}",
|
||||
reply_to_message_id=usr.id,
|
||||
thumb="img/thumb.jpg",
|
||||
thumb="assets/thumb.jpg",
|
||||
progress=progress_for_pyrogram,
|
||||
progress_args=("Uploading files..", update.message, c_time),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue