diff --git a/README.id.md b/README.id.md index b83897df..b3f04e83 100644 --- a/README.id.md +++ b/README.id.md @@ -188,7 +188,7 @@ PERINGATAN: Menjual Kode Kepada Orang Lain Demi Uang *Dilarang Keras*. Tuhan sel [readme-ko-url]: README.md [kofi-url]: https://ko-fi.com/yasirarism [paypal-url]: https://paypal.me/yasirarism -[qris-url]: https://telegra.ph/file/2acf7698f300ef3d9138f.jpg +[qris-url]: https://telegraph.yasirweb.eu.org/file/2acf7698f300ef3d9138f.jpg [sociabuzz-url]: https://sociabuzz.com/yasirarism/tribe [saweria-url]: https://saweria.co/yasirarism [trakteer-url]: https://trakteer.id/yasir-aris-sp7cn \ No newline at end of file diff --git a/README.md b/README.md index 03599f7d..deec35ab 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ WARNING: Selling The Codes To Other People For Money Is *Strictly Prohibited*. G [readme-ko-url]: README.id.md [kofi-url]: https://ko-fi.com/yasirarism [paypal-url]: https://paypal.me/yasirarism -[qris-url]: https://telegra.ph/file/9427d61d6968b8ee4fb2f.jpg +[qris-url]: https://telegraph.yasirweb.eu.org/file/9427d61d6968b8ee4fb2f.jpg [sociabuzz-url]: https://sociabuzz.com/yasirarism/tribe [saweria-url]: https://saweria.co/yasirarism [trakteer-url]: https://trakteer.id/yasir-aris-sp7cn \ No newline at end of file diff --git a/misskaty/core/misskaty_patch/utils/handler_error.py b/misskaty/core/misskaty_patch/utils/handler_error.py index 57e03b14..a1d10d76 100644 --- a/misskaty/core/misskaty_patch/utils/handler_error.py +++ b/misskaty/core/misskaty_patch/utils/handler_error.py @@ -59,7 +59,7 @@ async def handle_error( with contextlib.suppress(Exception): try: await m.reply_photo( - "https://telegra.ph/file/3c9162b242567ae25d5af.jpg", + "https://telegraph.yasirweb.eu.org/file/3c9162b242567ae25d5af.jpg", caption="An Internal Error Occurred while Processing your Command, the Logs have been sent to the Owners of this Bot. Sorry for Inconvenience", ) except: @@ -76,7 +76,7 @@ async def handle_error( await m.message.delete() try: await m.reply_photo( - "https://telegra.ph/file/3c9162b242567ae25d5af.jpg", + "https://telegraph.yasirweb.eu.org/file/3c9162b242567ae25d5af.jpg", caption="An Internal Error Occurred while Processing your Command, the Logs have been sent to the Owners of this Bot. Sorry for Inconvenience", ) except: diff --git a/misskaty/helper/media_helper.py b/misskaty/helper/media_helper.py index 1efb8564..a1921a10 100644 --- a/misskaty/helper/media_helper.py +++ b/misskaty/helper/media_helper.py @@ -15,7 +15,7 @@ async def post_to_telegraph(is_media: bool, title=None, content=None, media=None if is_media: # Create a Telegram Post Foto/Video response = await telegraph.upload_file(media) - return f"https://telegra.ph{response[0]['src']}" + return f"https://telegraph.yasirweb.eu.org{response[0]['src']}" # Create a Telegram Post using HTML Content response = await telegraph.create_page( title, diff --git a/misskaty/plugins/dev.py b/misskaty/plugins/dev.py index be8256ea..5a50013e 100644 --- a/misskaty/plugins/dev.py +++ b/misskaty/plugins/dev.py @@ -8,7 +8,7 @@ import pickle import re import sys import traceback -from datetime import datetime +from datetime import datetime, timedelta from inspect import getfullargspec from shutil import disk_usage from time import time @@ -19,6 +19,7 @@ import cloudscraper import requests from apscheduler.schedulers.asyncio import AsyncIOScheduler from bs4 import BeautifulSoup +from logging import getLogger from PIL import Image, ImageDraw, ImageFont from psutil import Process, boot_time, cpu_count, cpu_percent from psutil import disk_usage as disk_usage_percent @@ -26,7 +27,7 @@ from psutil import net_io_counters, virtual_memory from pyrogram import Client from pyrogram import __version__ as pyrover from pyrogram import enums, filters -from pyrogram.errors import FloodWait, PeerIdInvalid +from pyrogram.errors import FloodWait, MessageTooLong, PeerIdInvalid from pyrogram.raw.types import UpdateBotStopped from pyrogram.types import ( InlineKeyboardButton, @@ -68,6 +69,7 @@ __HELP__ = """ var = {} teskode = {} +LOGGER = getLogger("MissKaty") async def edit_or_reply(msg, **kwargs): @@ -80,27 +82,47 @@ async def edit_or_reply(msg, **kwargs): @use_chat_lang() async def log_file(_, ctx: Message, strings): """Send log file""" - msg = await ctx.reply_msg("Reading bot logs ...") + msg = await ctx.reply_msg("Reading bot logs ...", quote=True) if len(ctx.command) == 1: - await ctx.reply_document( - "MissKatyLogs.txt", - caption="Log Bot MissKatyPyro", - reply_markup=InlineKeyboardMarkup( - [ + try: + with open("MissKatyLogs.txt", "r") as file: + content = file.read() + current_utc_datetime = datetime.utcnow() + exp_datetime = current_utc_datetime + timedelta(days=7) + data = { + "content": content, + "expire_dt": str(exp_datetime), + "title": "MissKatyLogs", + "highlighter-name": "python" + } + pastelog = (await fetch.post("https://paste.yasirapi.eu.org/api/pastes", json=data)).json() + await msg.edit_msg(f"Here the Logs\nlog size: {get_readable_file_size(os.path.getsize('MissKatyLogs.txt'))}") + except Exception: + await ctx.reply_document( + "MissKatyLogs.txt", + caption="Log Bot MissKatyPyro", + reply_markup=InlineKeyboardMarkup( [ - InlineKeyboardButton( - strings("cl_btn"), - f"close#{ctx.from_user.id}", - ) + [ + InlineKeyboardButton( + strings("cl_btn"), + f"close#{ctx.from_user.id}", + ) + ] ] - ] - ), - ) - await msg.delete_msg() + ), + ) + await msg.delete_msg() elif len(ctx.command) == 2: val = ctx.text.split() tail = await shell_exec(f"tail -n {val[1]} -v MissKatyLogs.txt") - await msg.edit_msg(f"
{html.escape(tail[0])}
") + try: + await msg.edit_msg(f"
{html.escape(tail[0])}
") + except MessageTooLong: + with io.BytesIO(str.encode(tail[0])) as s: + s.name = "MissKatyLog-Tail.txt" + await ctx.reply_document(s) + await msg.delete() else: await msg.edit_msg("Unsupported parameter") @@ -108,7 +130,7 @@ async def log_file(_, ctx: Message, strings): @app.on_message(filters.command(["donate"], COMMAND_HANDLER)) async def donate(_, ctx: Message): await ctx.reply_photo( - "https://telegra.ph/file/9427d61d6968b8ee4fb2f.jpg", + "https://telegraph.yasirweb.eu.org/file/9427d61d6968b8ee4fb2f.jpg", caption=f"Hai {ctx.from_user.mention}, jika kamu merasa bot ini berguna kamu bisa melakukan donasi dengan scan QR menggunakan merchant yang support QRIS ya. Karena server bot ini menggunakan VPS dan tidaklah gratis. Terimakasih..\n\nHi {ctx.from_user.mention}, if you feel this bot is useful, you can make a donation via Paypal for international payment : https://paypal.me/yasirarism. Because this bot server is hosted in VPS and not free. Thank you..", ) diff --git a/misskaty/plugins/genss.py b/misskaty/plugins/genss.py index 777cc6a4..272afd1d 100644 --- a/misskaty/plugins/genss.py +++ b/misskaty/plugins/genss.py @@ -49,7 +49,7 @@ async def genss(self: Client, ctx: Message, strings): download_file_path = os.path.join("downloads/", file_name) downloader = SmartDL(url, download_file_path, progress_bar=False, timeout=10, verify=False) try: - downloader.start(blocking=False) + downloader.start(blocking=False, verify=False) except Exception as err: return await pesan.edit(str(err)) c_time = time.time() diff --git a/misskaty/plugins/imdb_search.py b/misskaty/plugins/imdb_search.py index 6f95fa57..c1f1e03a 100644 --- a/misskaty/plugins/imdb_search.py +++ b/misskaty/plugins/imdb_search.py @@ -66,7 +66,7 @@ async def imdb_choose(_, ctx: Message): buttons.row(InlineButton("🚩 Set Default Language", f"imdbset#{ctx.from_user.id}")) buttons.row(InlineButton("❌ Close", f"close#{ctx.from_user.id}")) await ctx.reply_photo( - "https://telegra.ph/file/270955ef0d1a8a16831a9.jpg", + "https://telegraph.yasirweb.eu.org/file/270955ef0d1a8a16831a9.jpg", caption=f"Hi {ctx.from_user.mention}, Please select the language you want to use on IMDB Search. If you want use default lang for every user, click third button. So no need click select lang if use CMD.", reply_markup=buttons, quote=True, @@ -128,7 +128,7 @@ async def imdbsetlang(_, query: CallbackQuery): async def imdb_search_id(kueri, message): BTN = [] k = await message.reply_photo( - "https://telegra.ph/file/270955ef0d1a8a16831a9.jpg", + "https://telegraph.yasirweb.eu.org/file/270955ef0d1a8a16831a9.jpg", caption=f"πŸ”Ž Menelusuri {kueri} di database IMDb ...", quote=True, ) @@ -186,7 +186,7 @@ async def imdb_search_id(kueri, message): async def imdb_search_en(kueri, message): BTN = [] k = await message.reply_photo( - "https://telegra.ph/file/270955ef0d1a8a16831a9.jpg", + "https://telegraph.yasirweb.eu.org/file/270955ef0d1a8a16831a9.jpg", caption=f"πŸ”Ž Searching {kueri} in IMDb Database...", quote=True, ) diff --git a/misskaty/plugins/inline_search.py b/misskaty/plugins/inline_search.py index 7990caf4..6f2b8ae8 100644 --- a/misskaty/plugins/inline_search.py +++ b/misskaty/plugins/inline_search.py @@ -42,7 +42,7 @@ To use this feature, just type bot username with following args below. ~ info [user id/username] - Check info about a user. """ -keywords_list = ["imdb", "pypi", "git", "google", "calc", "secretmsg", "info", "botapi"] +keywords_list = ["imdb", "pypi", "git", "google", "secretmsg", "info", "botapi"] PRVT_MSGS = {} LOGGER = getLogger("MissKaty") @@ -406,12 +406,12 @@ async def inline_menu(self, inline_query: InlineQuery): srch_results = json.loads(search_results.text) item = srch_results.get("items") data = [] - for sraeo in item: - title = sraeo.get("full_name") - link = sraeo.get("html_url") - deskripsi = sraeo.get("description") - lang = sraeo.get("language") - message_text = f"πŸ”—: {sraeo.get('html_url')}\nβ”‚\nβ””β”€πŸ΄Forks: {sraeo.get('forks')} ┃┃ 🌟Stars: {sraeo.get('stargazers_count')}\n\n" + for result in item: + title = result.get("full_name") + link = result.get("html_url") + deskripsi = result.get("description")[:25] if len(result.get("description")) > 25 else result.get("description") + lang = result.get("language") + message_text = f"πŸ”—: {result.get('html_url')}\nβ”‚\nβ””β”€πŸ΄Forks: {result.get('forks')} ┃┃ 🌟Stars: {sraeo.get('stargazers_count')}\n\n" message_text += f"Description: {deskripsi}\n" message_text += f"Language: {lang}" data.append( diff --git a/misskaty/plugins/locks.py b/misskaty/plugins/locks.py index b135d98c..71e704a7 100644 --- a/misskaty/plugins/locks.py +++ b/misskaty/plugins/locks.py @@ -81,10 +81,12 @@ async def current_chat_permissions(chat_id): except FloodWait as e: await asyncio.sleep(e.value) perm = (await app.get_chat(chat_id)).permissions + try: + perm.can_send_messages + except: + LOGGER.error(f"Got error in chat: {chat_id}, perm: {perm}") # For debug if perm.can_send_messages: perms.append("can_send_messages") - else: - LOGGER.info(f"debug perm: {perm}") # Temporary debug, idk why give error no object if perm.can_send_media_messages: perms.append("can_send_media_messages") if perm.can_send_audios: diff --git a/misskaty/plugins/ocr.py b/misskaty/plugins/ocr.py index 1e9adadb..2b0b2854 100644 --- a/misskaty/plugins/ocr.py +++ b/misskaty/plugins/ocr.py @@ -43,7 +43,7 @@ async def ocr(_, ctx: Message, strings): f"ocr_{ctx.from_user.id if ctx.from_user else ctx.sender_chat.id}.jpg" ) response = await Telegraph().upload_file(file_path) - url = f"https://telegra.ph{response[0]['src']}" + url = f"https://telegraph.yasirweb.eu.org{response[0]['src']}" req = ( await fetch.get( f"https://script.google.com/macros/s/AKfycbwURISN0wjazeJTMHTPAtxkrZTWTpsWIef5kxqVGoXqnrzdLdIQIfLO7jsR5OQ5GO16/exec?url={url}", diff --git a/misskaty/plugins/start_help.py b/misskaty/plugins/start_help.py index 33e84cd3..d89688be 100644 --- a/misskaty/plugins/start_help.py +++ b/misskaty/plugins/start_help.py @@ -74,7 +74,7 @@ async def start(_, ctx: Message, strings): nama = ctx.from_user.mention if ctx.from_user else ctx.sender_chat.title try: return await ctx.reply_photo( - photo="https://telegra.ph/file/90e9a448bc2f8b055b762.jpg", + photo="https://telegraph.yasirweb.eu.org/file/90e9a448bc2f8b055b762.jpg", caption=strings("start_msg").format(kamuh=nama), reply_markup=keyboard, ) @@ -97,7 +97,7 @@ async def start(_, ctx: Message, strings): ) else: await ctx.reply_photo( - photo="https://telegra.ph/file/90e9a448bc2f8b055b762.jpg", + photo="https://telegraph.yasirweb.eu.org/file/90e9a448bc2f8b055b762.jpg", caption=home_text_pm, reply_markup=home_keyboard_pm, )