diff --git a/misskaty/plugins/admin.py b/misskaty/plugins/admin.py
index 7a829113..31910864 100644
--- a/misskaty/plugins/admin.py
+++ b/misskaty/plugins/admin.py
@@ -254,9 +254,9 @@ async def banFunc(client, message, strings):
keyboard = ikb({"🚨 Unban 🚨": f"unban_{user_id}"})
try:
await message.chat.ban_member(user_id)
- await message.reply_text(msg, reply_markup=keyboard)
- except Exception as err:
- await message.reply(f"ERROR: {err}")
+ await message.reply_msg(msg, reply_markup=keyboard)
+ except ChatAdminRequired:
+ await message.reply("Please give me permission to banned members..!!!")
# Unban members
@@ -287,6 +287,8 @@ async def unban_func(_, message, strings):
await message.reply_msg(strings("unban_success").format(umention=umention))
except PeerIdInvalid:
await message.reply_msg(strings("unknown_id", context="general"))
+ except ChatAdminRequired:
+ await message.reply("Please give me permission to unban members..!!!")
# Ban users listed in a message
diff --git a/misskaty/plugins/ban_user_or_chat.py b/misskaty/plugins/ban_user_or_chat.py
index df63d4fa..03c94055 100644
--- a/misskaty/plugins/ban_user_or_chat.py
+++ b/misskaty/plugins/ban_user_or_chat.py
@@ -90,10 +90,10 @@ async def ban_a_user(bot, message):
isban, alesan = await db.get_ban_status(k.id)
if isban:
return await message.reply(
- f"{k.mention} is already banned\nReason: {alesan['reason']}"
+ f"{k.mention} is already banned\nReason: {alesan['reason']}"
)
await db.ban_user(k.id, reason)
- await message.reply(f"Successfully banned user {k.mention}!! Reason: {reason}")
+ await message.reply(f"Successfully banned user {k.mention}!!\nReason: {reason}")
@app.on_message(filters.command("unbanuser", COMMAND_HANDLER) & filters.user(SUDO))
diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py
index c453ac53..e657d06c 100644
--- a/misskaty/plugins/chatbot_ai.py
+++ b/misskaty/plugins/chatbot_ai.py
@@ -29,7 +29,7 @@ async def bard_chatbot(_, ctx: Message, strings):
strings("no_question").format(cmd=ctx.command[0]), quote=True, del_in=5
)
if not BARD_API:
- return await ctx.reply_msg("BARD_API env is mising!!!")
+ return await ctx.reply_msg("BARD_API env is missing!!!")
msg = await ctx.reply_msg(strings("find_answers_str"), quote=True)
try:
req = await fetch.get(
diff --git a/misskaty/plugins/dev.py b/misskaty/plugins/dev.py
index ab45a506..34df0297 100644
--- a/misskaty/plugins/dev.py
+++ b/misskaty/plugins/dev.py
@@ -15,6 +15,7 @@ from time import time
from typing import Any, Optional, Tuple
import aiohttp
+import contextlib
import cloudscraper
import requests
from apscheduler.schedulers.asyncio import AsyncIOScheduler
@@ -27,7 +28,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 ChatSendPhotosForbidden, FloodWait, MessageTooLong, PeerIdInvalid
+from pyrogram.errors import ChatSendPhotosForbidden, FloodWait, MessageTooLong, PeerIdInvalid, ChatSendPlainForbidden
from pyrogram.raw.types import UpdateBotStopped
from pyrogram.types import (
InlineKeyboardButton,
@@ -124,12 +125,11 @@ async def log_file(_, ctx: Message, strings):
@app.on_message(filters.command(["donate"], COMMAND_HANDLER))
async def donate(self: Client, ctx: Message):
- try:
+ with contextlib.suppress(ChatSendPlainForbidden, ChatSendPhotosForbidden):
await ctx.reply_photo(
"https://img.yasirweb.eu.org/file/9427d61d6968b8ee4fb2f.jpg",
caption=f"Hi {ctx.from_user.mention}, If you find this bot useful, you can make a donation to the account below. Because this bot server uses VPS and is not free. Thank You..\n\nIndonesian Payment:\nQRIS: https://img.yasirweb.eu.org/file/b1c86973ae4e55721983a.jpg (Yasir Store)\nMayar: https://yasirarism.mayar.link/payme\nBank Jago: 109641845083 (Yasir Aris M)\n\nFor international people can use PayPal to support me or via GitHub Sponsor:\nhttps://paypal.me/yasirarism\nhttps://github.com/sponsors/yasirarism\n\nSource: @BeriKopi",
)
- except ChatSendPhotosForbidden:
await self.send_message(LOG_CHANNEL, f"❗️ WARNING\nI'm leaving from {ctx.chat.id} since i didn't have sufficient admin permissions.")
await ctx.chat.leave()
@@ -387,7 +387,7 @@ async def shell_cmd(_, ctx: Message, strings):
& filters.user(SUDO)
)
@app.on_edited_message(
- (filters.command(["ev", "run", "meval"]) | filters.regex(r"app.run\(\)$"))
+ (filters.command(["ev", "run", "meval"], COMMAND_HANDLER) | filters.regex(r"app.run\(\)$"))
& filters.user(SUDO)
)
@user.on_message(filters.command(["ev", "run", "meval"], ".") & filters.me)
diff --git a/misskaty/plugins/filters.py b/misskaty/plugins/filters.py
index d8f32ac5..f224f941 100644
--- a/misskaty/plugins/filters.py
+++ b/misskaty/plugins/filters.py
@@ -71,7 +71,7 @@ async def save_filters(_, m):
}
await save_filter(chat_id, name, _filter)
await m.reply_msg(f"__**Saved filter {name}.**__")
- await m.stop_propagation()
+ m.stop_propagation()
@app.on_message(filters.command("filters") & ~filters.private)
@@ -101,7 +101,7 @@ async def del_filter(_, m):
await m.reply_msg(f"**Deleted filter {name}.**")
else:
await m.reply_msg("**No such filter.**")
- await m.stop_propagation()
+ m.stop_propagation()
@app.on_message(