mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Changed base docker to alphine and add again pillow v10 (#179)
* Update chatbot_ai.py
* tes pake alpine
* add again pillow v10
* tes nulis in pil 10
* hmm
* style: format code with black and isort (#180)
Format code with black and isort
This commit fixes the style issues introduced in 41d4f24 according to the output
from Black and isort.
Details: https://app.deepsource.com/gh/yasirarism/MissKatyPyro/transform/ba70f1a7-7e6f-4f79-8251-c9db81fe86c5/
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
---------
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
parent
9cb6a7d77d
commit
f6f9b6c007
22 changed files with 64 additions and 52 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -3,17 +3,17 @@
|
|||
# * @projectName MissKatyPyro
|
||||
# * Copyright ©YasirPedia All rights reserved
|
||||
|
||||
# Base Docker Using Ubuntu 23.04, Python 3.11 and Built In Pip
|
||||
# Base Docker Using Alpine 3.18, Python 3.11.4 and Built In Pip
|
||||
## With Built in Pip Package
|
||||
# FROM yasirarism/misskaty-docker:latest
|
||||
FROM yasirarism/misskaty-docker:alpine
|
||||
## Without Built in Pip Package
|
||||
FROM yasirarism/misskaty-docker:free
|
||||
# FROM yasirarism/misskaty-docker:free
|
||||
|
||||
# Set Hostname
|
||||
ENV HOSTNAME misskaty
|
||||
ENV HOSTNAME yasir-server
|
||||
# Copy Files
|
||||
COPY . .
|
||||
# Instal pip package
|
||||
RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages
|
||||
# RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages
|
||||
# Set CMD Bot
|
||||
CMD ["bash", "start.sh"]
|
||||
|
|
|
|||
|
|
@ -94,14 +94,15 @@ python3 --version
|
|||
```
|
||||
apt update -y & apt install libjpeg-dev zlib1g-dev libwebp-dev python3-pip python3-lxml git wget curl lokal ffmpeg tzdata neofetch mediainfo speedtest-cli -y
|
||||
```
|
||||
- Instal requirements.txt, jika menggunakan python 3.11, Anda harus menambahkan parameter `--break-system-packages` atau gunakan venv saat menginstal.<br/>
|
||||
- Instal requirements.txt, jika menggunakan python 3.11, Anda harus menggunakan opsi venv saat menginstal.<br/>
|
||||
*Python < 3.10*
|
||||
```
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
*Python 3.11*
|
||||
```
|
||||
pip3 install -r requirements.txt --break-system-packages
|
||||
Install venv dari terminal server kamu
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
- Atur config environment saat menjalankan bot dan jangan lupa isi semua value yang wajib di isi.
|
||||
- Jalankan Bot
|
||||
|
|
|
|||
|
|
@ -94,14 +94,15 @@ python3 --version
|
|||
```
|
||||
apt update -y & apt install libjpeg-dev zlib1g-dev libwebp-dev python3-pip python3-lxml git wget curl ffmpeg locales tzdata neofetch mediainfo speedtest-cli -y
|
||||
```
|
||||
- Install requirements.txt, if using python 3.11, you need pass `--break-system-packages` parameter or use venv when install.<br/>
|
||||
- Install requirements.txt, if using python 3.11, you need use venv when install pip package.<br/>
|
||||
*Python < 3.10*
|
||||
```
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
*Python 3.11*
|
||||
```
|
||||
pip3 install -r requirements.txt --break-system-packages
|
||||
Install venv from your terminal and activate it
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
- Setting your config.env or via environment and dont forget fill all required value.
|
||||
- Run Bot
|
||||
|
|
|
|||
BIN
assets/DejaVuSans-Bold.ttf
Normal file
BIN
assets/DejaVuSans-Bold.ttf
Normal file
Binary file not shown.
BIN
assets/DejaVuSans.ttf
Normal file
BIN
assets/DejaVuSans.ttf
Normal file
Binary file not shown.
|
|
@ -1,11 +1,15 @@
|
|||
SUDO=617426792
|
||||
# Required Vars
|
||||
API_HASH=
|
||||
API_ID=
|
||||
BOT_TOKEN=
|
||||
DATABASE_NAME=MissKatyDB
|
||||
DATABASE_URI=mongodb+srv://
|
||||
LOG_CHANNEL=
|
||||
|
||||
# Optional Vars
|
||||
SUDO=617426792
|
||||
DATABASE_NAME=MissKatyDB
|
||||
SUPPORT_CHAT=YasirPediaChannel
|
||||
COMMAND_HANDLER=
|
||||
USER_SESSION=
|
||||
OPENAI_API=
|
||||
CURRENCY_API=
|
||||
|
|
@ -40,7 +40,7 @@ MOD_NOLOAD = ["subscene_dl"]
|
|||
HELPABLE = {}
|
||||
cleanmode = {}
|
||||
botStartTime = time.time()
|
||||
misskaty_version = "v2.10.1 - Stable"
|
||||
misskaty_version = "v2.10.2 - Stable"
|
||||
|
||||
# Pyrogram Bot Client
|
||||
app = Client(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"""
|
||||
* @author yasir <yasiramunandar@gmail.com>
|
||||
* @date 2022-12-01 09:12:27
|
||||
* @lastModified 2022-12-01 09:33:16
|
||||
* @projectName MissKatyPyro
|
||||
* Copyright @YasirPedia All rights reserved
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ def hhmmss(seconds):
|
|||
|
||||
async def take_ss(video_file):
|
||||
out_put_file_name = f"genss{str(time.time())}.png"
|
||||
cmd = f"vcsi '{video_file}' -t -w 1340 -g 4x4 --template misskaty/helper/ssgen_template.html --quality 100 --end-delay-percent 20 --metadata-font-size 30 --timestamp-font-size 20 -o {out_put_file_name}"
|
||||
cmd = f"vcsi '{video_file}' -t -w 1340 -g 4x4 --timestamp-font assets/DejaVuSans.ttf --metadata-font assets/DejaVuSans-Bold.ttf --template misskaty/helper/ssgen_template.html --quality 100 --end-delay-percent 20 --metadata-font-size 30 --timestamp-font-size 20 -o {out_put_file_name}"
|
||||
await shell_exec(cmd)
|
||||
return out_put_file_name if os.path.lexists(out_put_file_name) else None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
File name: {{filename}}
|
||||
Filename: {{filename}}
|
||||
File size: {{size}}
|
||||
Duration: {{duration}}
|
||||
Frame Rate: {{frame_rate}} fps
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"""
|
||||
* @author yasir <yasiramunandar@gmail.com>
|
||||
* @date 2022-12-01 09:12:27
|
||||
* @lastModified 2022-12-01 09:27:31
|
||||
* @projectName MissKatyPyro
|
||||
* Copyright ©YasirPedia All rights reserved
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ async def openai_chatbot(_, ctx: Message, strings):
|
|||
answer = ""
|
||||
try:
|
||||
response = await openai.ChatCompletion.acreate(
|
||||
model="gpt-3.5-turbo",
|
||||
model="gpt-3.5-turbo-0613",
|
||||
messages=[{"role": "user", "content": pertanyaan}],
|
||||
temperature=0.7,
|
||||
stream=True,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ from pyrogram.types import (
|
|||
from database.gban_db import add_gban_user, is_gbanned_user, remove_gban_user
|
||||
from database.users_chats_db import db
|
||||
from misskaty import BOT_NAME, app, botStartTime, misskaty_version, user
|
||||
from misskaty.core.decorator import new_task
|
||||
from misskaty.helper.eval_helper import format_exception, meval
|
||||
from misskaty.helper.functions import extract_user, extract_user_and_reason
|
||||
from misskaty.helper.http import http
|
||||
|
|
@ -119,6 +120,7 @@ async def balas(self: Client, ctx: Message) -> "str":
|
|||
|
||||
|
||||
@app.on_message(filters.command(["stats"], COMMAND_HANDLER))
|
||||
@new_task
|
||||
async def server_stats(self: Client, ctx: Message) -> "Message":
|
||||
"""
|
||||
Give system stats of the server.
|
||||
|
|
@ -158,7 +160,9 @@ async def server_stats(self: Client, ctx: Message) -> "Message":
|
|||
disk_used = get_readable_file_size(used)
|
||||
disk_free = get_readable_file_size(free)
|
||||
|
||||
caption = f"<b>{BOT_NAME} {misskaty_version} is Up and Running successfully.</b>\n\n**OS Uptime:** <code>{osuptime}</code>\n<b>Bot Uptime:</b> <code>{currentTime}</code>\n**Bot Usage:** <code>{botusage}</code>\n\n**Total Space:** <code>{disk_total}</code>\n**Free Space:** <code>{disk_free}</code>\n\n**Download:** <code>{download}</code>\n**Upload:** <code>{upload}</code>\n\n<b>Pyrogram Version</b>: <code>{pyrover}</code>\n<b>Python Version</b>: <code>{sys.version_info[0]}.{sys.version_info[1]}.{sys.version_info[2]} {sys.version_info[3].title()}</code>"
|
||||
neofetch = (await shell_exec("neofetch --stdout"))[0]
|
||||
|
||||
caption = f"<b>{BOT_NAME} {misskaty_version} is Up and Running successfully.</b>\n\n<code>{neofetch}</code>\n\n**OS Uptime:** <code>{osuptime}</code>\n<b>Bot Uptime:</b> <code>{currentTime}</code>\n**Bot Usage:** <code>{botusage}</code>\n\n**Total Space:** <code>{disk_total}</code>\n**Free Space:** <code>{disk_free}</code>\n\n**Download:** <code>{download}</code>\n**Upload:** <code>{upload}</code>\n\n<b>Pyrogram Version</b>: <code>{pyrover}</code>\n<b>Python Version</b>: <code>{sys.version_info[0]}.{sys.version_info[1]}.{sys.version_info[2]} {sys.version_info[3].title()}</code>"
|
||||
|
||||
start = datetime.now()
|
||||
msg = await ctx.reply_photo(
|
||||
|
|
@ -364,6 +368,7 @@ async def shell(self: Client, ctx: Message, strings) -> "Message":
|
|||
)
|
||||
@user.on_message(filters.command(["ev", "run", "myeval"], ".") & filters.me)
|
||||
@use_chat_lang()
|
||||
@new_task
|
||||
async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||
if (ctx.command and len(ctx.command) == 1) or ctx.text == "app.run()":
|
||||
return await edit_or_reply(ctx, text=strings("no_eval"))
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@ async def draw_meme_text(image_path, text):
|
|||
current_h, pad = 10, 5
|
||||
if upper_text:
|
||||
for u_text in textwrap.wrap(upper_text, width=15):
|
||||
u_width, u_height = draw.textsize(u_text, font=m_font)
|
||||
text_bbox = m_font.getbbox(u_text)
|
||||
(left, top, right, bottom) = text_bbox
|
||||
u_width = abs(right - left)
|
||||
u_height = abs(top - bottom)
|
||||
|
||||
draw.text(
|
||||
xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)),
|
||||
|
|
@ -72,7 +75,10 @@ async def draw_meme_text(image_path, text):
|
|||
current_h += u_height + pad
|
||||
if lower_text:
|
||||
for l_text in textwrap.wrap(lower_text, width=15):
|
||||
u_width, u_height = draw.textsize(l_text, font=m_font)
|
||||
text_bbox = m_font.getbbox(u_text)
|
||||
(left, top, right, bottom) = text_bbox
|
||||
u_width = abs(right - left)
|
||||
u_height = abs(top - bottom)
|
||||
|
||||
draw.text(
|
||||
xy=(
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ __HELP__ = """"
|
|||
"""
|
||||
|
||||
|
||||
@app.on_message(filters.command(["genss"], COMMAND_HANDLER))
|
||||
@app.on_cmd("genss")
|
||||
@ratelimiter
|
||||
@new_task
|
||||
@use_chat_lang()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
import os
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||
|
||||
from misskaty import app
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
|
|
@ -16,9 +16,9 @@ from misskaty.vars import COMMAND_HANDLER
|
|||
|
||||
|
||||
# View Structure Telegram Message As JSON
|
||||
@app.on_message(filters.command(["json"], COMMAND_HANDLER))
|
||||
@app.on_cmd("json")
|
||||
@ratelimiter
|
||||
async def jsonify(_, message):
|
||||
async def jsonify(_, message: Message):
|
||||
the_real_message = None
|
||||
reply_to_id = None
|
||||
|
||||
|
|
@ -38,13 +38,13 @@ async def jsonify(_, message):
|
|||
),
|
||||
)
|
||||
except Exception as e:
|
||||
with open("json.text", "w+", encoding="utf8") as out_file:
|
||||
with open("json.txt", "w+", encoding="utf8") as out_file:
|
||||
out_file.write(str(the_real_message))
|
||||
await message.reply_document(
|
||||
document="json.text",
|
||||
document="json.txt",
|
||||
caption=f"<code>{str(e)}</code>",
|
||||
disable_notification=True,
|
||||
reply_to_message_id=reply_to_id,
|
||||
thumb="assets/thumb.jpg",
|
||||
)
|
||||
os.remove("json.text")
|
||||
os.remove("json.txt")
|
||||
|
|
|
|||
|
|
@ -94,20 +94,16 @@ async def kbbi_search(_, ctx: Client):
|
|||
|
||||
@app.on_cmd("carbon")
|
||||
async def carbon_make(self: Client, ctx: Message):
|
||||
if len(ctx.command) == 1 and not ctx.reply_to_message:
|
||||
return await ctx.reply(
|
||||
"Please reply text to make carbon or add text after command."
|
||||
)
|
||||
if not ctx.reply_to_message:
|
||||
return await ctx.reply(
|
||||
"Please reply text to make carbon or add text after command."
|
||||
)
|
||||
if ctx.reply_to_message.text:
|
||||
if ctx.reply_to_message and ctx.reply_to_message.text:
|
||||
text = ctx.reply_to_message.text
|
||||
elif ctx.reply_to_message.caption:
|
||||
elif ctx.reply_to_message and ctx.reply_to_message.caption:
|
||||
text = ctx.reply_to_message.caption
|
||||
else:
|
||||
elif len(ctx.command) > 1:
|
||||
text = ctx.input
|
||||
else:
|
||||
return await ctx.reply(
|
||||
"Please reply text to make carbon or add text after command."
|
||||
)
|
||||
json_data = {
|
||||
"code": text,
|
||||
"backgroundColor": "#1F816D",
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ async def handwrite(client, message):
|
|||
font = ImageFont.truetype("assets/assfont.ttf", 30)
|
||||
x, y = 150, 140
|
||||
lines = text_set(txt)
|
||||
line_height = font.getsize("hg")[1]
|
||||
line_height = font.getbbox("hg")[3]
|
||||
for line in lines:
|
||||
draw.text((x, y), line, fill=(1, 22, 55), font=font)
|
||||
y = y + line_height - 5
|
||||
|
|
|
|||
|
|
@ -254,4 +254,7 @@ async def help_button(self: Client, query: CallbackQuery, strings):
|
|||
disable_web_page_preview=True,
|
||||
)
|
||||
|
||||
await self.answer_callback_query(query.id)
|
||||
try:
|
||||
await self.answer_callback_query(query.id)
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -5,15 +5,13 @@
|
|||
import os
|
||||
from asyncio import gather
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.types import Message
|
||||
from pySmartDL import SmartDL
|
||||
|
||||
from misskaty import app
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.decorator import capture_err, new_task
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
from misskaty.helper.localization import use_chat_lang
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
|
||||
__MODULE__ = "WebSS"
|
||||
__HELP__ = """
|
||||
|
|
@ -21,11 +19,11 @@ __HELP__ = """
|
|||
"""
|
||||
|
||||
|
||||
@app.on_message(filters.command(["webss"], COMMAND_HANDLER))
|
||||
@capture_err
|
||||
@app.on_cmd("webss")
|
||||
@ratelimiter
|
||||
@new_task
|
||||
@use_chat_lang()
|
||||
async def take_ss(self: Client, ctx: Message, strings):
|
||||
async def take_ss(_, ctx: Message, strings):
|
||||
if len(ctx.command) == 1:
|
||||
return await ctx.reply_msg(strings("no_url"), del_in=6)
|
||||
url = (
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ async def ytdl_extractinfo_callback(self: Client, cq: CallbackQuery, strings):
|
|||
@ratelimiter
|
||||
@use_chat_lang()
|
||||
async def ytdl_gendl_callback(self: Client, cq: CallbackQuery, strings):
|
||||
if not cq.message.reply_to_message.from_user:
|
||||
if not (cq.message.reply_to_message and cq.message.reply_to_message.from_user):
|
||||
return
|
||||
match = cq.data.split("|")
|
||||
if cq.from_user.id != cq.message.reply_to_message.from_user.id:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ async_pymongo
|
|||
pymongo
|
||||
python-dotenv
|
||||
requests
|
||||
bs4
|
||||
beautifulsoup4
|
||||
aiohttp
|
||||
chevron
|
||||
gTTS
|
||||
|
|
@ -18,7 +18,7 @@ psutil
|
|||
python-dateutil
|
||||
telegraph
|
||||
hachoir
|
||||
Pillow==9.5.0
|
||||
Pillow==10.0.0
|
||||
httpx[http2]
|
||||
git+https://github.com/yasirarism/vcsi
|
||||
git+https://github.com/yasirarism/iytdl
|
||||
|
|
|
|||
Loading…
Reference in a new issue