mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Update sementara
This commit is contained in:
parent
924853f45b
commit
f251daeb74
3 changed files with 31 additions and 21 deletions
|
|
@ -88,6 +88,7 @@ async def reply_text(
|
|||
await asleep(del_in)
|
||||
return bool(await msg.delete_msg())
|
||||
except FloodWait as e:
|
||||
LOGGER.warning(f"Got floodwait in {self.chat.id} for {e.value}'s.")
|
||||
await asleep(e.value)
|
||||
return await reply_text(self, text, *args, **kwargs)
|
||||
except TopicClosed:
|
||||
|
|
@ -134,7 +135,7 @@ async def edit_text(
|
|||
await asleep(del_in)
|
||||
return bool(await msg.delete_msg())
|
||||
except FloodWait as e:
|
||||
LOGGER.warning(str(e))
|
||||
LOGGER.warning(f"Got floodwait in {self.chat.id} for {e.value}'s.")
|
||||
await asleep(e.value)
|
||||
return await edit_text(self, text, *args, **kwargs)
|
||||
except MessageNotModified:
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ from logging import getLogger
|
|||
from time import time
|
||||
|
||||
from pyrogram import Client, enums, filters
|
||||
from pyrogram.errors import ChatAdminRequired, FloodWait, PeerIdInvalid
|
||||
from pyrogram.errors import ChatAdminRequired, FloodWait, PeerIdInvalid, UsernameNotOccupied
|
||||
from pyrogram.types import ChatPermissions, ChatPrivileges, Message
|
||||
|
||||
from database.warn_db import add_warn, get_warn, remove_warns
|
||||
|
|
@ -573,7 +573,10 @@ async def unmute(_, message, strings):
|
|||
@ratelimiter
|
||||
@use_chat_lang()
|
||||
async def warn_user(client, message, strings):
|
||||
try:
|
||||
user_id, reason = await extract_user_and_reason(message)
|
||||
except UsernameNotOccupied:
|
||||
return await message.reply_msg("Sorry, i didn't know that user.")
|
||||
chat_id = message.chat.id
|
||||
if not user_id:
|
||||
return await message.reply_text(strings("user_not_found"))
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ SOFTWARE.
|
|||
import asyncio
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrogram.errors import ChatNotModified, FloodWait
|
||||
from pyrogram.errors import ChatNotModified, FloodWait, ChatAdminRequired
|
||||
from pyrogram.types import ChatPermissions
|
||||
|
||||
from misskaty import app
|
||||
|
|
@ -120,7 +120,7 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
|
|||
@adminsOnly("can_restrict_members")
|
||||
async def locks_func(_, message):
|
||||
if len(message.command) != 2:
|
||||
return await message.reply_text(incorrect_parameters)
|
||||
return await message.reply_msg(incorrect_parameters)
|
||||
|
||||
chat_id = message.chat.id
|
||||
parameter = message.text.strip().split(None, 1)[1].lower()
|
||||
|
|
@ -134,10 +134,14 @@ async def locks_func(_, message):
|
|||
if parameter in data:
|
||||
await tg_lock(message, permissions, data[parameter], state == "lock")
|
||||
elif parameter == "all" and state == "lock":
|
||||
try:
|
||||
await app.set_chat_permissions(chat_id, ChatPermissions())
|
||||
await message.reply_text(f"Locked Everything in {message.chat.title}")
|
||||
except ChatAdminRequired:
|
||||
await message.reply_msg("Give me proper admin permission to use this command.")
|
||||
|
||||
elif parameter == "all" and state == "unlock":
|
||||
try:
|
||||
await app.set_chat_permissions(
|
||||
chat_id,
|
||||
ChatPermissions(
|
||||
|
|
@ -152,6 +156,8 @@ async def locks_func(_, message):
|
|||
),
|
||||
)
|
||||
await message.reply(f"Unlocked Everything in {message.chat.title}")
|
||||
except ChatAdminRequired:
|
||||
await message.reply_msg("Give me full admin permission to use this command.")
|
||||
|
||||
|
||||
@app.on_message(filters.command("locks", COMMAND_HANDLER) & ~filters.private)
|
||||
|
|
|
|||
Loading…
Reference in a new issue