mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Minor fix
This commit is contained in:
parent
a5fa7fc5ca
commit
102ec21d7a
6 changed files with 28 additions and 18 deletions
|
|
@ -46,7 +46,7 @@ MOD_NOLOAD = ["subscene_dl"]
|
||||||
HELPABLE = {}
|
HELPABLE = {}
|
||||||
cleanmode = {}
|
cleanmode = {}
|
||||||
botStartTime = time.time()
|
botStartTime = time.time()
|
||||||
misskaty_version = "v2.15"
|
misskaty_version = "v2.16.1"
|
||||||
|
|
||||||
uvloop.install()
|
uvloop.install()
|
||||||
faulthandler_enable()
|
faulthandler_enable()
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,12 @@ async def handle_error(
|
||||||
cap_day = f"{day.strftime('%A')}, {tgl_now.strftime('%d %B %Y %H:%M:%S')}"
|
cap_day = f"{day.strftime('%A')}, {tgl_now.strftime('%d %B %Y %H:%M:%S')}"
|
||||||
f_errname = f"crash_{tgl_now.strftime('%d %B %Y')}.txt"
|
f_errname = f"crash_{tgl_now.strftime('%d %B %Y')}.txt"
|
||||||
LOGGER.error(traceback.format_exc())
|
LOGGER.error(traceback.format_exc())
|
||||||
|
if isinstance(m, pyrogram.types.Message):
|
||||||
with open(f_errname, "w+", encoding="utf-8") as log:
|
with open(f_errname, "w+", encoding="utf-8") as log:
|
||||||
log.write(
|
log.write(
|
||||||
f"✍️ Message: {m.text or m.caption}\n👱♂️ User: {m.from_user.id if m.from_user else m.sender_chat.id}\n\n{traceback.format_exc()}"
|
f"✍️ Message: {m.text or m.caption}\n👱♂️ User: {m.from_user.id if m.from_user else m.sender_chat.id}\n\n{traceback.format_exc()}"
|
||||||
)
|
)
|
||||||
log.close()
|
log.close()
|
||||||
if isinstance(m, pyrogram.types.Message):
|
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
try:
|
try:
|
||||||
await m.reply_photo(
|
await m.reply_photo(
|
||||||
|
|
@ -74,6 +74,11 @@ async def handle_error(
|
||||||
caption=f"Crash Report of this Bot\n{cap_day}",
|
caption=f"Crash Report of this Bot\n{cap_day}",
|
||||||
)
|
)
|
||||||
if isinstance(m, pyrogram.types.CallbackQuery):
|
if isinstance(m, pyrogram.types.CallbackQuery):
|
||||||
|
with open(f_errname, "w+", encoding="utf-8") as log:
|
||||||
|
log.write(
|
||||||
|
f"✍️ Message: {m.message.text or m.message.caption}\n👱♂️ User: {m.from_user.id if m.from_user else m.sender_chat.id}\n\n{traceback.format_exc()}"
|
||||||
|
)
|
||||||
|
log.close()
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
await m.message.delete()
|
await m.message.delete()
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ async def shell_cmd(self: Client, ctx: Message, strings):
|
||||||
msg = (
|
msg = (
|
||||||
await ctx.edit_msg(strings("run_exec"))
|
await ctx.edit_msg(strings("run_exec"))
|
||||||
if not self.me.is_bot
|
if not self.me.is_bot
|
||||||
else await ctx.reply_msg(strings("run_exec"))
|
else await ctx.reply_msg(strings("run_exec"), quote=True)
|
||||||
)
|
)
|
||||||
shell = (await shell_exec(ctx.input))[0]
|
shell = (await shell_exec(ctx.input))[0]
|
||||||
if len(shell) > 3000:
|
if len(shell) > 3000:
|
||||||
|
|
@ -426,6 +426,7 @@ async def shell_cmd(self: Client, ctx: Message, strings):
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
quote=True,
|
||||||
)
|
)
|
||||||
await msg.delete_msg()
|
await msg.delete_msg()
|
||||||
elif len(shell) != 0:
|
elif len(shell) != 0:
|
||||||
|
|
@ -444,6 +445,7 @@ async def shell_cmd(self: Client, ctx: Message, strings):
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
quote=True,
|
||||||
)
|
)
|
||||||
if self.me.is_bot:
|
if self.me.is_bot:
|
||||||
await msg.delete_msg()
|
await msg.delete_msg()
|
||||||
|
|
@ -578,6 +580,7 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
quote=True,
|
||||||
)
|
)
|
||||||
await status_message.delete_msg()
|
await status_message.delete_msg()
|
||||||
else:
|
else:
|
||||||
|
|
@ -596,6 +599,7 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
quote=True,
|
||||||
)
|
)
|
||||||
if self.me.is_bot:
|
if self.me.is_bot:
|
||||||
await status_message.delete_msg()
|
await status_message.delete_msg()
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,13 @@ You can use markdown or html to save text too.
|
||||||
async def save_filters(_, message):
|
async def save_filters(_, message):
|
||||||
try:
|
try:
|
||||||
if len(message.command) < 2 or not message.reply_to_message:
|
if len(message.command) < 2 or not message.reply_to_message:
|
||||||
return await message.reply_text(
|
return await message.reply_msg(
|
||||||
"**Usage:**\nReply to a message with /filter [FILTER_NAME] To set a new filter."
|
"**Usage:**\nReply to a message with /filter [FILTER_NAME] To set a new filter."
|
||||||
)
|
)
|
||||||
text = message.text.markdown
|
text = message.text.markdown
|
||||||
name = text.split(None, 1)[1].strip()
|
name = text.split(None, 1)[1].strip()
|
||||||
if not name:
|
if not name:
|
||||||
return await message.reply_text("**Usage:**\n__/filter [FILTER_NAME]__")
|
return await message.reply_msg("**Usage:**\n__/filter [FILTER_NAME]__")
|
||||||
chat_id = message.chat.id
|
chat_id = message.chat.id
|
||||||
replied_message = message.reply_to_message
|
replied_message = message.reply_to_message
|
||||||
text = name.split(" ", 1)
|
text = name.split(" ", 1)
|
||||||
|
|
@ -128,9 +128,9 @@ async def save_filters(_, message):
|
||||||
"file_id": file_id,
|
"file_id": file_id,
|
||||||
}
|
}
|
||||||
await save_filter(chat_id, name, _filter)
|
await save_filter(chat_id, name, _filter)
|
||||||
return await message.reply_text(f"__**Saved filter {name}.**__")
|
return await message.reply_msg(f"__**Saved filter {name}.**__")
|
||||||
except UnboundLocalError:
|
except UnboundLocalError:
|
||||||
return await message.reply_text(
|
return await message.reply_msg(
|
||||||
"**Replied message is inaccessible.\n`Forward the message and try again`**"
|
"**Replied message is inaccessible.\n`Forward the message and try again`**"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -214,7 +214,7 @@ async def filters_re(self, message):
|
||||||
message = replied_message
|
message = replied_message
|
||||||
|
|
||||||
if data_type == "text":
|
if data_type == "text":
|
||||||
await message.reply_text(
|
await message.reply_msg(
|
||||||
text=data,
|
text=data,
|
||||||
reply_markup=keyb,
|
reply_markup=keyb,
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
|
|
@ -274,7 +274,7 @@ async def filters_re(self, message):
|
||||||
async def stop_all(_, message):
|
async def stop_all(_, message):
|
||||||
_filters = await get_filters_names(message.chat.id)
|
_filters = await get_filters_names(message.chat.id)
|
||||||
if not _filters:
|
if not _filters:
|
||||||
await message.reply_text("**No filters in this chat.**")
|
await message.reply_msg("**No filters in this chat.**")
|
||||||
else:
|
else:
|
||||||
keyboard = InlineKeyboardMarkup(
|
keyboard = InlineKeyboardMarkup(
|
||||||
[
|
[
|
||||||
|
|
@ -284,7 +284,7 @@ async def stop_all(_, message):
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
await message.reply_text(
|
await message.reply_msg(
|
||||||
"**Are you sure you want to delete all the filters in this chat forever ?.**",
|
"**Are you sure you want to delete all the filters in this chat forever ?.**",
|
||||||
reply_markup=keyboard,
|
reply_markup=keyboard,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -568,7 +568,7 @@ async def close_callback(_, query: CallbackQuery):
|
||||||
if query.from_user.id != int(userid):
|
if query.from_user.id != int(userid):
|
||||||
with contextlib.suppress(QueryIdInvalid):
|
with contextlib.suppress(QueryIdInvalid):
|
||||||
return await query.answer("⚠️ Access Denied!", True)
|
return await query.answer("⚠️ Access Denied!", True)
|
||||||
with contextlib.redirect_stdout(Exception):
|
with contextlib.suppress(Exception):
|
||||||
await query.answer("Deleting this message in 5 seconds.")
|
await query.answer("Deleting this message in 5 seconds.")
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
await query.message.delete_msg()
|
await query.message.delete_msg()
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
import contextlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
from pyrogram.errors import ChatSendPhotosForbidden, ChatWriteForbidden
|
from pyrogram.errors import ChatSendPhotosForbidden, ChatWriteForbidden, QueryIdInvalid
|
||||||
from pyrogram.types import (
|
from pyrogram.types import (
|
||||||
CallbackQuery,
|
CallbackQuery,
|
||||||
InlineKeyboardButton,
|
InlineKeyboardButton,
|
||||||
|
|
@ -155,6 +155,7 @@ async def commands_callbacc(_, cb: CallbackQuery):
|
||||||
@app.on_callback_query(filters.regex("stats_callback"))
|
@app.on_callback_query(filters.regex("stats_callback"))
|
||||||
async def stats_callbacc(_, cb: CallbackQuery):
|
async def stats_callbacc(_, cb: CallbackQuery):
|
||||||
text = await bot_sys_stats()
|
text = await bot_sys_stats()
|
||||||
|
with contextlib.suppress(QueryIdInvalid):
|
||||||
await app.answer_callback_query(cb.id, text, show_alert=True)
|
await app.answer_callback_query(cb.id, text, show_alert=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue