Update 21 09 2023 (#285)

* debug new logs

* debug

* mm

* typo

* coba

* dd

* mm

* s

* typo

* cek

* Fixed

* mm

* dd

* kkk
This commit is contained in:
yasirarism 2023-09-21 12:19:00 +07:00 committed by GitHub
parent 90c6e8af8c
commit ec2f0d4bc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 63 additions and 39 deletions

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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,

View file

@ -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("<b>Reading bot logs ...</b>")
msg = await ctx.reply_msg("<b>Reading bot logs ...</b>", 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"<a href='https://paste.yasirapi.eu.org/{pastelog.get('paste_id')}'>Here the Logs</a>\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"<pre language='bash'>{html.escape(tail[0])}</pre>")
try:
await msg.edit_msg(f"<pre language='bash'>{html.escape(tail[0])}</pre>")
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..",
)

View file

@ -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()

View file

@ -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 <code>{kueri}</code> 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 <code>{kueri}</code> in IMDb Database...",
quote=True,
)

View file

@ -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"<b>Description:</b> {deskripsi}\n"
message_text += f"<b>Language:</b> {lang}"
data.append(

View file

@ -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:

View file

@ -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}",

View file

@ -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,
)