mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-04 19:24:51 +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 import filters
|
||||||
from pyrogram.errors import MessageNotModified
|
from pyrogram.errors import MessageNotModified, MessageTooLong
|
||||||
|
|
||||||
from misskaty import app
|
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.message_utils import *
|
||||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||||
from misskaty.vars import COMMAND_HANDLER, OPENAI_API
|
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..")
|
msg = await kirimPesan(m, "Wait a moment looking for your answer..")
|
||||||
try:
|
try:
|
||||||
response = (await http.post("https://api.openai.com/v1/chat/completions", headers=headers, json=json_data)).json()
|
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"])
|
if err := response["error"]:
|
||||||
except MessageNotModified:
|
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
|
pass
|
||||||
except Exception as err:
|
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 import app, user, botStartTime, BOT_NAME
|
||||||
from misskaty.helper import http
|
from misskaty.helper import http
|
||||||
from misskaty.helper.human_read import get_readable_file_size, get_readable_time
|
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 misskaty.vars import COMMAND_HANDLER, SUDO
|
||||||
from utils import LOGGER
|
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)
|
@app.on_message(filters.command(["balas"], COMMAND_HANDLER) & filters.user(SUDO) & filters.reply)
|
||||||
async def balas(c, m):
|
async def balas(c, m):
|
||||||
pesan = m.text.split(" ", 1)
|
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)
|
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",
|
document="MissKatyEval.txt",
|
||||||
caption=f"<code>{cmd[1][: 4096 // 4 - 1]}</code>",
|
caption=f"<code>{cmd[1][: 4096 // 4 - 1]}</code>",
|
||||||
disable_notification=True,
|
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}")]]),
|
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]),
|
||||||
)
|
)
|
||||||
os.remove("MissKatyEval.txt")
|
os.remove("MissKatyEval.txt")
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ async def fbdl(client, message):
|
||||||
await message.reply_video(
|
await message.reply_video(
|
||||||
path,
|
path,
|
||||||
caption=f"<code>{os.path.basename(path)}</code>\n\nUploaded for {message.from_user.mention} [<code>{message.from_user.id}</code>]",
|
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()
|
await msg.delete()
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,19 @@ def draw_multiple_line_text(image, text, font, text_start_height):
|
||||||
|
|
||||||
@asyncify
|
@asyncify
|
||||||
def welcomepic(pic, user, chat, id):
|
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)
|
background = background.resize((1024, 500), Image.ANTIALIAS)
|
||||||
pfp = Image.open(pic).convert("RGBA")
|
pfp = Image.open(pic).convert("RGBA")
|
||||||
pfp = circle(pfp)
|
pfp = circle(pfp)
|
||||||
pfp = pfp.resize((265, 265)) # Resizes the Profilepicture so it fits perfectly in the circle
|
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
|
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, member_text, font, 395)
|
||||||
draw_multiple_line_text(background, chat, font, 47)
|
draw_multiple_line_text(background, chat, font, 47)
|
||||||
ImageDraw.Draw(background).text(
|
ImageDraw.Draw(background).text(
|
||||||
(530, 460),
|
(530, 460),
|
||||||
f"Generated by @{BOT_USERNAME}",
|
f"Generated by @{BOT_USERNAME}",
|
||||||
font=ImageFont.truetype("Calistoga-Regular.ttf", 28),
|
font=ImageFont.truetype("assets/Calistoga-Regular.ttf", 28),
|
||||||
size=20,
|
size=20,
|
||||||
align="right",
|
align="right",
|
||||||
)
|
)
|
||||||
|
|
@ -96,7 +96,7 @@ async def member_has_joined(c: app, member: ChatMemberUpdated):
|
||||||
try:
|
try:
|
||||||
pic = await app.download_media(user.photo.big_file_id, file_name=f"pp{user.id}.png")
|
pic = await app.download_media(user.photo.big_file_id, file_name=f"pp{user.id}.png")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pic = "img/profilepic.png"
|
pic = "assets/profilepic.png"
|
||||||
try:
|
try:
|
||||||
welcomeimg = await welcomepic(pic, user.first_name, member.chat.title, user.id)
|
welcomeimg = await welcomepic(pic, user.first_name, member.chat.title, user.id)
|
||||||
temp.MELCOW[f"welcome-{member.chat.id}"] = await c.send_photo(
|
temp.MELCOW[f"welcome-{member.chat.id}"] = await c.send_photo(
|
||||||
|
|
@ -177,7 +177,7 @@ async def save_group(bot, message):
|
||||||
try:
|
try:
|
||||||
pic = await app.download_media(u.photo.big_file_id, file_name=f"pp{u.id}.png")
|
pic = await app.download_media(u.photo.big_file_id, file_name=f"pp{u.id}.png")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pic = "img/profilepic.png"
|
pic = "assets/profilepic.png"
|
||||||
if (temp.MELCOW).get(f"welcome-{message.chat.id}") is not None:
|
if (temp.MELCOW).get(f"welcome-{message.chat.id}") is not None:
|
||||||
try:
|
try:
|
||||||
await temp.MELCOW[f"welcome-{message.chat.id}"].delete()
|
await temp.MELCOW[f"welcome-{message.chat.id}"].delete()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
import traceback
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from urllib.parse import quote_plus
|
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.message_utils import *
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||||
from misskaty.helper import http, get_random_string, search_jw, GENRES_EMOJI
|
from misskaty.helper import http, get_random_string, search_jw, GENRES_EMOJI, post_to_telegraph
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
LIST_CARI = {}
|
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)
|
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||||
else:
|
else:
|
||||||
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||||
except MessageNotModified:
|
except (MessageNotModified, MessageIdInvalid):
|
||||||
pass
|
pass
|
||||||
except Exception as exc:
|
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"))
|
@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)
|
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||||
else:
|
else:
|
||||||
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
await query.message.edit_caption(res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
||||||
|
except (MessageNotModified, MessageIdInvalid):
|
||||||
|
pass
|
||||||
except Exception as exc:
|
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>",
|
caption=f"<code>{str(e)}</code>",
|
||||||
disable_notification=True,
|
disable_notification=True,
|
||||||
reply_to_message_id=reply_to_id,
|
reply_to_message_id=reply_to_id,
|
||||||
thumb="img/thumb.jpg",
|
thumb="assets/thumb.jpg",
|
||||||
)
|
)
|
||||||
os.remove("json.text")
|
os.remove("json.text")
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ DETAILS
|
||||||
await message.reply_document(
|
await message.reply_document(
|
||||||
out_file,
|
out_file,
|
||||||
caption=f"ℹ️ <b>MEDIA INFO</b>\n\n**Request by:** {message.from_user.mention}",
|
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,
|
reply_markup=markup,
|
||||||
)
|
)
|
||||||
await process.delete()
|
await process.delete()
|
||||||
|
|
@ -101,7 +101,7 @@ DETAILS
|
||||||
await message.reply_document(
|
await message.reply_document(
|
||||||
out_file,
|
out_file,
|
||||||
caption=f"Hasil mediainfo anda..\n\n**Request by:** {message.from_user.mention}",
|
caption=f"Hasil mediainfo anda..\n\n**Request by:** {message.from_user.mention}",
|
||||||
thumb="img/thumb.jpg",
|
thumb="assets/thumb.jpg",
|
||||||
reply_markup=markup,
|
reply_markup=markup,
|
||||||
)
|
)
|
||||||
await process.delete()
|
await process.delete()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import textwrap
|
import textwrap
|
||||||
|
from asyncio import gather
|
||||||
from os import remove as hapus
|
from os import remove as hapus
|
||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
@ -14,7 +15,7 @@ async def draw_meme_text(image_path, text):
|
||||||
img = Image.open(image_path)
|
img = Image.open(image_path)
|
||||||
hapus(image_path)
|
hapus(image_path)
|
||||||
i_width, i_height = img.size
|
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:
|
if ";" in text:
|
||||||
upper_text, lower_text = text.split(";")
|
upper_text, lower_text = text.split(";")
|
||||||
else:
|
else:
|
||||||
|
|
@ -146,8 +147,7 @@ async def memify(client, message):
|
||||||
try:
|
try:
|
||||||
file = await message.reply_to_message.download()
|
file = await message.reply_to_message.download()
|
||||||
webp, png = await draw_meme_text(file, message.text.split(None, 1)[1].strip())
|
webp, png = await draw_meme_text(file, message.text.split(None, 1)[1].strip())
|
||||||
await message.reply_sticker(webp)
|
await gather(*[message.reply_document(png), message.reply_sticker(webp)])
|
||||||
await message.reply_document(png)
|
|
||||||
try:
|
try:
|
||||||
hapus(webp)
|
hapus(webp)
|
||||||
hapus(png)
|
hapus(png)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ This feature inspired from SangMata Bot. I'm created simple detection to check u
|
||||||
group=3,
|
group=3,
|
||||||
)
|
)
|
||||||
async def cek_mataa(_, m):
|
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
|
return
|
||||||
if not await cek_userdata(m.from_user.id):
|
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)
|
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(
|
await m.reply_document(
|
||||||
f"{filename}.srt",
|
f"{filename}.srt",
|
||||||
caption=f"<code>{filename}.srt</code>\n\nConverted by @{c.me.username}",
|
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=progress_for_pyrogram,
|
||||||
progress_args=("Uploading files..", msg, c_time),
|
progress_args=("Uploading files..", msg, c_time),
|
||||||
)
|
)
|
||||||
|
|
@ -168,7 +168,7 @@ async def stream_extract(bot, update):
|
||||||
namafile,
|
namafile,
|
||||||
caption=f"<b>Filename:</b> <code>{namafile}</code>\n\nExtracted by @{bot.me.username} in {timelog}",
|
caption=f"<b>Filename:</b> <code>{namafile}</code>\n\nExtracted by @{bot.me.username} in {timelog}",
|
||||||
reply_to_message_id=usr.id,
|
reply_to_message_id=usr.id,
|
||||||
thumb="img/thumb.jpg",
|
thumb="assets/thumb.jpg",
|
||||||
progress=progress_for_pyrogram,
|
progress=progress_for_pyrogram,
|
||||||
progress_args=("Uploading files..", update.message, c_time),
|
progress_args=("Uploading files..", update.message, c_time),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue