mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-02 10:44:50 +00:00
Trying fix blacklist, fix inline imdb, use alternate name or title for justwatch
Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
parent
0cdcef3ebd
commit
e688b15c20
4 changed files with 16 additions and 11 deletions
|
|
@ -22,10 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||
SOFTWARE.
|
||||
"""
|
||||
import re
|
||||
from time import time
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import ChatPermissions
|
||||
from pyrogram.errors import ChatAdminRequired
|
||||
|
||||
from database.blacklist_db import (
|
||||
delete_blacklist_filter,
|
||||
|
|
@ -88,7 +89,7 @@ async def del_filter(_, message):
|
|||
|
||||
@app.on_message(filters.text & ~filters.private, group=8)
|
||||
@capture_err
|
||||
async def blacklist_filters_re(_, message):
|
||||
async def blacklist_filters_re(self, message):
|
||||
text = message.text.lower().strip()
|
||||
if not text:
|
||||
return
|
||||
|
|
@ -105,14 +106,18 @@ async def blacklist_filters_re(_, message):
|
|||
if user.id in await list_admins(chat_id):
|
||||
return
|
||||
try:
|
||||
await message.delete_msg()
|
||||
await message.chat.restrict_member(
|
||||
user.id,
|
||||
ChatPermissions(all_perms=False),
|
||||
until_date=int(time() + 3600),
|
||||
until_date=datetime.now() + timedelta(hours=1),
|
||||
)
|
||||
except Exception:
|
||||
except ChatAdminRequired:
|
||||
return await message.reply("Please give me admin permissions to blacklist user", quote=False)
|
||||
except Exception as err:
|
||||
self.log.info(f"ERROR Blacklist Chat: ID = {chat_id}, ERR = {err}")
|
||||
return
|
||||
return await app.send_message(
|
||||
await app.send_message(
|
||||
chat_id,
|
||||
f"Muted {user.mention} [`{user.id}`] for 1 hour "
|
||||
+ f"due to a blacklist match on {word}.",
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
|||
r_json = json.loads(
|
||||
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||
)
|
||||
ott = await search_jw(r_json.get("name"), "ID")
|
||||
ott = await search_jw(r_json.get("alternateName") or r_json.get("name"), "ID")
|
||||
typee = r_json.get("@type", "")
|
||||
res_str = ""
|
||||
tahun = (
|
||||
|
|
@ -554,7 +554,7 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
|||
r_json = json.loads(
|
||||
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||
)
|
||||
ott = await search_jw(r_json.get("name"), "US")
|
||||
ott = await search_jw(r_json.get("alternateName") or r_json.get("name"), "US")
|
||||
typee = r_json.get("@type", "")
|
||||
res_str = ""
|
||||
tahun = (
|
||||
|
|
|
|||
|
|
@ -640,7 +640,7 @@ async def imdb_inl(_, query):
|
|||
r_json = json.loads(
|
||||
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||
)
|
||||
ott = await search_jw(r_json["name"], "en_ID")
|
||||
ott = await search_jw(r_json.get("alternateName") or r_json["name"], "ID")
|
||||
res_str = ""
|
||||
typee = r_json.get("@type", "")
|
||||
tahun = (
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ async def who_is(client, message):
|
|||
quote=True,
|
||||
disable_notification=True,
|
||||
)
|
||||
await status_message.delete()
|
||||
await status_message.delete_msg()
|
||||
|
||||
|
||||
@app.on_callback_query(filters.regex("^close"))
|
||||
|
|
@ -569,8 +569,8 @@ async def close_callback(_, query: CallbackQuery):
|
|||
with contextlib.redirect_stdout(Exception):
|
||||
await query.answer("Deleting this message in 5 seconds.")
|
||||
await asyncio.sleep(5)
|
||||
await query.message.delete()
|
||||
await query.message.reply_to_message.delete()
|
||||
await query.message.delete_msg()
|
||||
await query.message.reply_to_message.delete_msg()
|
||||
|
||||
|
||||
async def mdlapi(title):
|
||||
|
|
|
|||
Loading…
Reference in a new issue