mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
style: format code with isort, Ruff Formatter and Yapf
This commit fixes the style issues introduced in f9f107e according to the output
from isort, Ruff Formatter and Yapf.
Details: None
This commit is contained in:
parent
f9f107ed89
commit
89b2b9a2d6
60 changed files with 808 additions and 399 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-09-06 10:12:09
|
* @date 2022-09-06 10:12:09
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from async_pymongo import AsyncClient
|
from async_pymongo import AsyncClient
|
||||||
|
|
||||||
from misskaty.vars import DATABASE_NAME, DATABASE_URI
|
from misskaty.vars import DATABASE_NAME, DATABASE_URI
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import pytz
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from misskaty.vars import SUDO
|
|
||||||
from database import dbname
|
|
||||||
|
|
||||||
|
import pytz
|
||||||
|
|
||||||
|
from database import dbname
|
||||||
|
from misskaty.vars import SUDO
|
||||||
|
|
||||||
fedsdb = dbname["federation"]
|
fedsdb = dbname["federation"]
|
||||||
|
|
||||||
|
|
@ -32,9 +33,7 @@ async def get_feds_by_owner(owner_id):
|
||||||
feds = await cursor.to_list(length=None)
|
feds = await cursor.to_list(length=None)
|
||||||
if not feds:
|
if not feds:
|
||||||
return False
|
return False
|
||||||
return [
|
return [{"fed_id": fed["fed_id"], "fed_name": fed["fed_name"]} for fed in feds]
|
||||||
{"fed_id": fed["fed_id"], "fed_name": fed["fed_name"]} for fed in feds
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
async def transfer_owner(fed_id, current_owner_id, new_owner_id):
|
async def transfer_owner(fed_id, current_owner_id, new_owner_id):
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ from database import dbname
|
||||||
|
|
||||||
greetingdb = dbname["greetings"]
|
greetingdb = dbname["greetings"]
|
||||||
|
|
||||||
|
|
||||||
async def is_welcome(chat_id: int) -> bool:
|
async def is_welcome(chat_id: int) -> bool:
|
||||||
return bool(await greetingdb.find_one({"chat_id": chat_id}))
|
return bool(await greetingdb.find_one({"chat_id": chat_id}))
|
||||||
|
|
||||||
|
|
||||||
async def toggle_welcome(chat_id: int):
|
async def toggle_welcome(chat_id: int):
|
||||||
if await is_welcome(chat_id):
|
if await is_welcome(chat_id):
|
||||||
await greetingdb.delete_one({"chat_id": chat_id})
|
await greetingdb.delete_one({"chat_id": chat_id})
|
||||||
|
|
@ -13,4 +15,5 @@ async def toggle_welcome(chat_id: int):
|
||||||
await greetingdb.insert_one({"chat_id": chat_id})
|
await greetingdb.insert_one({"chat_id": chat_id})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# todo other features for custom welcome here
|
# todo other features for custom welcome here
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@
|
||||||
# * @date 2023-06-21 22:12:27
|
# * @date 2023-06-21 22:12:27
|
||||||
# * @projectName MissKatyPyro
|
# * @projectName MissKatyPyro
|
||||||
# * Copyright ©YasirPedia All rights reserved
|
# * Copyright ©YasirPedia All rights reserved
|
||||||
import time, os, uvloop
|
import os
|
||||||
|
import time
|
||||||
from asyncio import get_event_loop
|
from asyncio import get_event_loop
|
||||||
from faulthandler import enable as faulthandler_enable
|
from faulthandler import enable as faulthandler_enable
|
||||||
from logging import ERROR, INFO, StreamHandler, basicConfig, getLogger, handlers
|
from logging import ERROR, INFO, StreamHandler, basicConfig, getLogger, handlers
|
||||||
|
|
||||||
|
import uvloop
|
||||||
from apscheduler.jobstores.mongodb import MongoDBJobStore
|
from apscheduler.jobstores.mongodb import MongoDBJobStore
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
from async_pymongo import AsyncClient
|
from async_pymongo import AsyncClient
|
||||||
|
|
@ -28,7 +30,9 @@ basicConfig(
|
||||||
format="[%(levelname)s] - [%(asctime)s - %(name)s - %(message)s] -> [%(module)s:%(lineno)d]",
|
format="[%(levelname)s] - [%(asctime)s - %(name)s - %(message)s] -> [%(module)s:%(lineno)d]",
|
||||||
datefmt="%d-%b-%y %H:%M:%S",
|
datefmt="%d-%b-%y %H:%M:%S",
|
||||||
handlers=[
|
handlers=[
|
||||||
handlers.RotatingFileHandler("MissKatyLogs.txt", mode="w+", maxBytes=5242880, backupCount=1),
|
handlers.RotatingFileHandler(
|
||||||
|
"MissKatyLogs.txt", mode="w+", maxBytes=5242880, backupCount=1
|
||||||
|
),
|
||||||
StreamHandler(),
|
StreamHandler(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
|
@ -15,7 +16,15 @@ from pyrogram import __version__, idle
|
||||||
from pyrogram.raw.all import layer
|
from pyrogram.raw.all import layer
|
||||||
|
|
||||||
from database import dbname
|
from database import dbname
|
||||||
from misskaty import BOT_NAME, BOT_USERNAME, HELPABLE, UBOT_NAME, app, scheduler, get_event_loop
|
from misskaty import (
|
||||||
|
BOT_NAME,
|
||||||
|
BOT_USERNAME,
|
||||||
|
HELPABLE,
|
||||||
|
UBOT_NAME,
|
||||||
|
app,
|
||||||
|
get_event_loop,
|
||||||
|
scheduler,
|
||||||
|
)
|
||||||
from misskaty.plugins import ALL_MODULES
|
from misskaty.plugins import ALL_MODULES
|
||||||
from misskaty.plugins.web_scraper import web
|
from misskaty.plugins.web_scraper import web
|
||||||
from misskaty.vars import SUDO, USER_SESSION
|
from misskaty.vars import SUDO, USER_SESSION
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ from logging import getLogger
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from pyrogram.errors import (
|
from pyrogram.errors import (
|
||||||
ChatAdminRequired,
|
|
||||||
ChannelPrivate,
|
ChannelPrivate,
|
||||||
|
ChatAdminRequired,
|
||||||
ChatSendPlainForbidden,
|
ChatSendPlainForbidden,
|
||||||
ChatWriteForbidden,
|
ChatWriteForbidden,
|
||||||
FloodWait,
|
FloodWait,
|
||||||
|
|
@ -22,6 +22,7 @@ from pyrogram.types import Message
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parse_cmd(msg):
|
def parse_cmd(msg):
|
||||||
return msg.text.split(None, 1)[1] if len(msg.command) > 1 else None
|
return msg.text.split(None, 1)[1] if len(msg.command) > 1 else None
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,9 @@ async def anonymous_admin_verification(
|
||||||
try:
|
try:
|
||||||
member = await CallbackQuery.message.chat.get_member(CallbackQuery.from_user.id)
|
member = await CallbackQuery.message.chat.get_member(CallbackQuery.from_user.id)
|
||||||
except pyrogram.errors.exceptions.bad_request_400.UserNotParticipant:
|
except pyrogram.errors.exceptions.bad_request_400.UserNotParticipant:
|
||||||
return await CallbackQuery.answer("You're not member of this group.", show_alert=True)
|
return await CallbackQuery.answer(
|
||||||
|
"You're not member of this group.", show_alert=True
|
||||||
|
)
|
||||||
except pyrogram.errors.exceptions.forbidden_403.ChatAdminRequired:
|
except pyrogram.errors.exceptions.forbidden_403.ChatAdminRequired:
|
||||||
return await CallbackQuery.message.edit_text(
|
return await CallbackQuery.message.edit_text(
|
||||||
"I must be admin to execute this task, or i will leave from this group.",
|
"I must be admin to execute this task, or i will leave from this group.",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ def command(
|
||||||
handler: typing.Optional[list] = None,
|
handler: typing.Optional[list] = None,
|
||||||
filtercmd: typing.Union[pyrogram.filters.Filter] = None,
|
filtercmd: typing.Union[pyrogram.filters.Filter] = None,
|
||||||
*args,
|
*args,
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
### `tgClient.command`
|
### `tgClient.command`
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ async def edit_message_text(
|
||||||
text: str,
|
text: str,
|
||||||
del_in: int = 0,
|
del_in: int = 0,
|
||||||
*args,
|
*args,
|
||||||
**kwargs
|
**kwargs,
|
||||||
) -> Union["Message", bool]:
|
) -> Union["Message", bool]:
|
||||||
"""\nExample:
|
"""\nExample:
|
||||||
message.edit_text("hello")
|
message.edit_text("hello")
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import pyrogram
|
||||||
|
|
||||||
|
|
||||||
async def get_user(
|
async def get_user(
|
||||||
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery]
|
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery],
|
||||||
) -> pyrogram.types.User or bool:
|
) -> pyrogram.types.User or bool:
|
||||||
"""
|
"""
|
||||||
### `tgEasy.get_user`
|
### `tgEasy.get_user`
|
||||||
|
|
@ -75,7 +75,7 @@ async def get_user(
|
||||||
|
|
||||||
|
|
||||||
async def get_user_adv(
|
async def get_user_adv(
|
||||||
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery]
|
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery],
|
||||||
) -> pyrogram.types.User or bool:
|
) -> pyrogram.types.User or bool:
|
||||||
"""
|
"""
|
||||||
### `tgEasy.get_user_adv`
|
### `tgEasy.get_user_adv`
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,9 @@ async def handle_error(
|
||||||
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())
|
||||||
with open(f_errname, "w+", encoding="utf-8") as log:
|
with open(f_errname, "w+", encoding="utf-8") as log:
|
||||||
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()}")
|
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()}"
|
||||||
|
)
|
||||||
log.close()
|
log.close()
|
||||||
if isinstance(m, pyrogram.types.Message):
|
if isinstance(m, pyrogram.types.Message):
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with pyromod. If not, see <https://www.gnu.org/licenses/>.
|
along with pyromod. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from contextlib import asynccontextmanager, contextmanager
|
from contextlib import asynccontextmanager, contextmanager
|
||||||
from inspect import iscoroutinefunction
|
from inspect import iscoroutinefunction
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ from .files import *
|
||||||
from .functions import *
|
from .functions import *
|
||||||
from .http import *
|
from .http import *
|
||||||
from .human_read import *
|
from .human_read import *
|
||||||
from .localization import *
|
|
||||||
from .kuso_utils import *
|
from .kuso_utils import *
|
||||||
|
from .localization import *
|
||||||
from .media_helper import *
|
from .media_helper import *
|
||||||
from .misc import *
|
from .misc import *
|
||||||
from .pyro_progress import *
|
from .pyro_progress import *
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from asyncio import gather
|
from asyncio import gather
|
||||||
|
|
||||||
from httpx import AsyncClient, Timeout
|
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
from httpx import AsyncClient, Timeout
|
||||||
|
|
||||||
# Aiohttp Async Client
|
# Aiohttp Async Client
|
||||||
session = ClientSession()
|
session = ClientSession()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ def get_readable_file_size(size_in_bytes) -> str:
|
||||||
while size_in_bytes >= 1024 and index < len(SIZE_UNITS) - 1:
|
while size_in_bytes >= 1024 and index < len(SIZE_UNITS) - 1:
|
||||||
size_in_bytes /= 1024
|
size_in_bytes /= 1024
|
||||||
index += 1
|
index += 1
|
||||||
return f"{size_in_bytes:.2f} {SIZE_UNITS[index]}" if index > 0 else f"{size_in_bytes}B"
|
return (
|
||||||
|
f"{size_in_bytes:.2f} {SIZE_UNITS[index]}" if index > 0 else f"{size_in_bytes}B"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_readable_time(seconds: int) -> str:
|
def get_readable_time(seconds: int) -> str:
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
from html import escape
|
from html import escape
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import chevron
|
import chevron
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from telegraph.aio import Telegraph
|
from telegraph.aio import Telegraph
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from misskaty import BOT_USERNAME
|
from misskaty import BOT_USERNAME
|
||||||
from misskaty.helper.http import fetch
|
from misskaty.helper.http import fetch
|
||||||
|
|
@ -26,23 +26,85 @@ async def kusonimeBypass(url: str):
|
||||||
# title = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > p:nth-child(3) > strong")[0].text.strip()
|
# title = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > p:nth-child(3) > strong")[0].text.strip()
|
||||||
try:
|
try:
|
||||||
title = soup.find("h1", {"class": "jdlz"}).text # fix title njing haha
|
title = soup.find("h1", {"class": "jdlz"}).text # fix title njing haha
|
||||||
season = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(3)")[0].text.split(":").pop().strip()
|
season = (
|
||||||
tipe = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(5)")[0].text.split(":").pop().strip()
|
soup.select(
|
||||||
status_anime = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(6)")[0].text.split(":").pop().strip()
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(3)"
|
||||||
ep = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(7)")[0].text.split(":").pop().strip()
|
)[0]
|
||||||
score = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(8)")[0].text.split(":").pop().strip()
|
.text.split(":")
|
||||||
duration = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(9)")[0].text.split(":").pop().strip()
|
.pop()
|
||||||
rilis = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(10)")[0].text.split(":").pop().strip()
|
.strip()
|
||||||
|
)
|
||||||
|
tipe = (
|
||||||
|
soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(5)"
|
||||||
|
)[0]
|
||||||
|
.text.split(":")
|
||||||
|
.pop()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
status_anime = (
|
||||||
|
soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(6)"
|
||||||
|
)[0]
|
||||||
|
.text.split(":")
|
||||||
|
.pop()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
ep = (
|
||||||
|
soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(7)"
|
||||||
|
)[0]
|
||||||
|
.text.split(":")
|
||||||
|
.pop()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
score = (
|
||||||
|
soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(8)"
|
||||||
|
)[0]
|
||||||
|
.text.split(":")
|
||||||
|
.pop()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
duration = (
|
||||||
|
soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(9)"
|
||||||
|
)[0]
|
||||||
|
.text.split(":")
|
||||||
|
.pop()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
rilis = (
|
||||||
|
soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(10)"
|
||||||
|
)[0]
|
||||||
|
.text.split(":")
|
||||||
|
.pop()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
e = traceback.format_exc()
|
e = traceback.format_exc()
|
||||||
LOGGER.error(e)
|
LOGGER.error(e)
|
||||||
title, season, tipe, status_anime, ep, score, duration, rilis = "None", "None", "None", "None", 0, 0, 0, "None"
|
title, season, tipe, status_anime, ep, score, duration, rilis = (
|
||||||
|
"None",
|
||||||
|
"None",
|
||||||
|
"None",
|
||||||
|
"None",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"None",
|
||||||
|
)
|
||||||
num = 1
|
num = 1
|
||||||
genre = []
|
genre = []
|
||||||
for _genre in soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(2)"):
|
for _genre in soup.select(
|
||||||
|
"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(2)"
|
||||||
|
):
|
||||||
gen = _genre.text.split(":").pop().strip().split(", ")
|
gen = _genre.text.split(":").pop().strip().split(", ")
|
||||||
genre = gen
|
genre = gen
|
||||||
for smokedl in soup.find("div", {"class": "dlbodz"}).find_all("div", {"class": "smokeddlrh"}):
|
for smokedl in soup.find("div", {"class": "dlbodz"}).find_all(
|
||||||
|
"div", {"class": "smokeddlrh"}
|
||||||
|
):
|
||||||
if not smokedl:
|
if not smokedl:
|
||||||
continue
|
continue
|
||||||
mendata = {"name": title, "links": []}
|
mendata = {"name": title, "links": []}
|
||||||
|
|
@ -68,7 +130,9 @@ async def kusonimeBypass(url: str):
|
||||||
mendata["links"].append({"quality": quality, "link_download": links})
|
mendata["links"].append({"quality": quality, "link_download": links})
|
||||||
data.append(mendata)
|
data.append(mendata)
|
||||||
num += 1
|
num += 1
|
||||||
for smokedl in soup.find("div", {"class": "dlbodz"}).find_all("div", {"class": "smokeddl"}):
|
for smokedl in soup.find("div", {"class": "dlbodz"}).find_all(
|
||||||
|
"div", {"class": "smokeddl"}
|
||||||
|
):
|
||||||
if not smokedl:
|
if not smokedl:
|
||||||
continue
|
continue
|
||||||
mendata = {"name": title, "links": []}
|
mendata = {"name": title, "links": []}
|
||||||
|
|
@ -94,7 +158,22 @@ async def kusonimeBypass(url: str):
|
||||||
mendata["links"].append({"quality": quality, "link_download": links})
|
mendata["links"].append({"quality": quality, "link_download": links})
|
||||||
data.append(mendata)
|
data.append(mendata)
|
||||||
num += 1
|
num += 1
|
||||||
result.update({"title": title, "thumb": thumb, "genre": genre, "genre_string": ", ".join(genre), "status_anime": status_anime, "season": season, "tipe": tipe, "ep": ep, "score": score, "duration": duration, "rilis": rilis, "data": data})
|
result.update(
|
||||||
|
{
|
||||||
|
"title": title,
|
||||||
|
"thumb": thumb,
|
||||||
|
"genre": genre,
|
||||||
|
"genre_string": ", ".join(genre),
|
||||||
|
"status_anime": status_anime,
|
||||||
|
"season": season,
|
||||||
|
"tipe": tipe,
|
||||||
|
"ep": ep,
|
||||||
|
"score": score,
|
||||||
|
"duration": duration,
|
||||||
|
"rilis": rilis,
|
||||||
|
"data": data,
|
||||||
|
}
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if result:
|
if result:
|
||||||
result.clear()
|
result.clear()
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,7 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
pairs = pairs[
|
pairs = pairs[modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)] + [
|
||||||
modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)
|
|
||||||
] + [
|
|
||||||
(
|
(
|
||||||
EqInlineKeyboardButton(
|
EqInlineKeyboardButton(
|
||||||
"Back", callback_data=f"{prefix}_home({modulo_page})"
|
"Back", callback_data=f"{prefix}_home({modulo_page})"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from pyrogram import Client, errors, raw
|
from pyrogram import Client, errors, raw
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@ import random
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
import cv2
|
|
||||||
import numpy as np
|
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
from misskaty.core.decorator import asyncify
|
|
||||||
from re import match as re_match
|
from re import match as re_match
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
from misskaty import BOT_NAME, UBOT_NAME, botStartTime
|
from misskaty import BOT_NAME, UBOT_NAME, botStartTime
|
||||||
|
from misskaty.core.decorator import asyncify
|
||||||
from misskaty.helper.http import fetch
|
from misskaty.helper.http import fetch
|
||||||
from misskaty.helper.human_read import get_readable_time
|
from misskaty.helper.human_read import get_readable_time
|
||||||
from misskaty.plugins import ALL_MODULES
|
from misskaty.plugins import ALL_MODULES
|
||||||
|
|
@ -144,13 +144,13 @@ async def search_jw(movie_name: str, locale: Union[str, None] = "ID"):
|
||||||
return m_t_
|
return m_t_
|
||||||
for item in response["results"]["data"]["popularTitles"]["edges"]:
|
for item in response["results"]["data"]["popularTitles"]["edges"]:
|
||||||
if item["node"]["content"]["title"] == movie_name:
|
if item["node"]["content"]["title"] == movie_name:
|
||||||
t_m_ = []
|
t_m_ = []
|
||||||
for offer in item["node"].get("offers", []):
|
for offer in item["node"].get("offers", []):
|
||||||
url = offer["standardWebURL"]
|
url = offer["standardWebURL"]
|
||||||
if url not in t_m_:
|
if url not in t_m_:
|
||||||
p_o = get_provider(url)
|
p_o = get_provider(url)
|
||||||
m_t_ += f"<a href='{url}'>{p_o}</a> | "
|
m_t_ += f"<a href='{url}'>{p_o}</a> | "
|
||||||
t_m_.append(url)
|
t_m_.append(url)
|
||||||
if m_t_ != "":
|
if m_t_ != "":
|
||||||
m_t_ = m_t_[:-2].strip()
|
m_t_ = m_t_[:-2].strip()
|
||||||
break
|
break
|
||||||
|
|
@ -159,11 +159,13 @@ async def search_jw(movie_name: str, locale: Union[str, None] = "ID"):
|
||||||
|
|
||||||
def isValidURL(str):
|
def isValidURL(str):
|
||||||
# Regex to check valid URL
|
# Regex to check valid URL
|
||||||
regex = ("((http|https)://)(www.)?" +
|
regex = (
|
||||||
"[a-zA-Z0-9@:%._\\+~#?&//=]" +
|
"((http|https)://)(www.)?"
|
||||||
"{2,256}\\.[a-z]" +
|
+ "[a-zA-Z0-9@:%._\\+~#?&//=]"
|
||||||
"{2,6}\\b([-a-zA-Z0-9@:%" +
|
+ "{2,256}\\.[a-z]"
|
||||||
"._\\+~#?&//=]*)")
|
+ "{2,6}\\b([-a-zA-Z0-9@:%"
|
||||||
|
+ "._\\+~#?&//=]*)"
|
||||||
|
)
|
||||||
|
|
||||||
# Compile the ReGex
|
# Compile the ReGex
|
||||||
p = re.compile(regex)
|
p = re.compile(regex)
|
||||||
|
|
@ -189,16 +191,18 @@ def gen_trans_image(source, path):
|
||||||
|
|
||||||
# apply morphology to remove isolated extraneous noise
|
# apply morphology to remove isolated extraneous noise
|
||||||
# use borderconstant of black since foreground touches the edges
|
# use borderconstant of black since foreground touches the edges
|
||||||
kernel = np.ones((3,3), np.uint8)
|
kernel = np.ones((3, 3), np.uint8)
|
||||||
mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel)
|
mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel)
|
||||||
mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel)
|
mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel)
|
||||||
|
|
||||||
# anti-alias the mask -- blur then stretch
|
# anti-alias the mask -- blur then stretch
|
||||||
# blur alpha channel
|
# blur alpha channel
|
||||||
mask = cv2.GaussianBlur(mask, (0,0), sigmaX=2, sigmaY=2, borderType = cv2.BORDER_DEFAULT)
|
mask = cv2.GaussianBlur(
|
||||||
|
mask, (0, 0), sigmaX=2, sigmaY=2, borderType=cv2.BORDER_DEFAULT
|
||||||
|
)
|
||||||
|
|
||||||
# linear stretch so that 127.5 goes to 0, but 255 stays 255
|
# linear stretch so that 127.5 goes to 0, but 255 stays 255
|
||||||
mask = (2*(mask.astype(np.float32))-255.0).clip(0,255).astype(np.uint8)
|
mask = (2 * (mask.astype(np.float32)) - 255.0).clip(0, 255).astype(np.uint8)
|
||||||
|
|
||||||
# put mask into alpha channel
|
# put mask into alpha channel
|
||||||
result = img.copy()
|
result = img.copy()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright ©YasirPedia All rights reserved
|
* Copyright ©YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import importlib
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
@ -34,7 +35,7 @@ from pyrogram.errors import (
|
||||||
PeerIdInvalid,
|
PeerIdInvalid,
|
||||||
UsernameNotOccupied,
|
UsernameNotOccupied,
|
||||||
)
|
)
|
||||||
from pyrogram.types import ChatPermissions, ChatMember, ChatPrivileges, Message
|
from pyrogram.types import ChatMember, ChatPermissions, ChatPrivileges, Message
|
||||||
|
|
||||||
from database.warn_db import add_warn, get_warn, remove_warns
|
from database.warn_db import add_warn, get_warn, remove_warns
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
|
|
@ -568,7 +569,9 @@ async def mute(client, message, strings):
|
||||||
if reason:
|
if reason:
|
||||||
msg += strings("banned_reason").format(reas=reason)
|
msg += strings("banned_reason").format(reas=reason)
|
||||||
try:
|
try:
|
||||||
await message.chat.restrict_member(user_id, permissions=ChatPermissions(all_perms=False))
|
await message.chat.restrict_member(
|
||||||
|
user_id, permissions=ChatPermissions(all_perms=False)
|
||||||
|
)
|
||||||
await message.reply_text(msg, reply_markup=keyboard)
|
await message.reply_text(msg, reply_markup=keyboard)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await message.reply_msg(str(e))
|
await message.reply_msg(str(e))
|
||||||
|
|
@ -861,21 +864,28 @@ async def set_chat_photo(_, ctx: Message):
|
||||||
os.remove(photo)
|
os.remove(photo)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.group & filters.command('mentionall', COMMAND_HANDLER))
|
@app.on_message(filters.group & filters.command("mentionall", COMMAND_HANDLER))
|
||||||
async def mentionall(app: Client, msg: Message):
|
async def mentionall(app: Client, msg: Message):
|
||||||
user = await msg.chat.get_member(msg.from_user.id)
|
user = await msg.chat.get_member(msg.from_user.id)
|
||||||
if user.status in (enums.ChatMemberStatus.OWNER, enums.ChatMemberStatus.ADMINISTRATOR):
|
if user.status in (
|
||||||
|
enums.ChatMemberStatus.OWNER,
|
||||||
|
enums.ChatMemberStatus.ADMINISTRATOR,
|
||||||
|
):
|
||||||
total = []
|
total = []
|
||||||
async for member in app.get_chat_members(msg.chat.id):
|
async for member in app.get_chat_members(msg.chat.id):
|
||||||
member: ChatMember
|
member: ChatMember
|
||||||
if member.user.username:
|
if member.user.username:
|
||||||
total.append(f'@{member.user.username}')
|
total.append(f"@{member.user.username}")
|
||||||
else:
|
else:
|
||||||
total.append(member.user.mention())
|
total.append(member.user.mention())
|
||||||
|
|
||||||
NUM = 4
|
NUM = 4
|
||||||
for i in range(0, len(total), NUM):
|
for i in range(0, len(total), NUM):
|
||||||
message = ' '.join(total[i:i+NUM])
|
message = " ".join(total[i : i + NUM])
|
||||||
await app.send_message(msg.chat.id, message, message_thread_id=msg.message_thread_id)
|
await app.send_message(
|
||||||
|
msg.chat.id, message, message_thread_id=msg.message_thread_id
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
await app.send_message(msg.chat.id, 'Admins only can do that !', reply_to_message_id=msg.id)
|
await app.send_message(
|
||||||
|
msg.chat.id, "Admins only can do that !", reply_to_message_id=msg.id
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.errors import UserAlreadyParticipant, UserIsBlocked
|
from pyrogram.errors import UserAlreadyParticipant, UserIsBlocked
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
from database import dbname
|
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import (
|
from pyrogram.types import (
|
||||||
CallbackQuery,
|
CallbackQuery,
|
||||||
|
|
@ -9,9 +7,10 @@ from pyrogram.types import (
|
||||||
Message,
|
Message,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from database import dbname
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.vars import SUDO, COMMAND_HANDLER
|
|
||||||
from misskaty.core.decorator.permissions import adminsOnly, member_permissions
|
from misskaty.core.decorator.permissions import adminsOnly, member_permissions
|
||||||
|
from misskaty.vars import COMMAND_HANDLER, SUDO
|
||||||
|
|
||||||
approvaldb = dbname["autoapprove"]
|
approvaldb = dbname["autoapprove"]
|
||||||
|
|
||||||
|
|
@ -67,13 +66,7 @@ async def approval_cb(_, cb: CallbackQuery):
|
||||||
if await approvaldb.count_documents({"chat_id": chat_id}) == 0:
|
if await approvaldb.count_documents({"chat_id": chat_id}) == 0:
|
||||||
approvaldb.insert_one({"chat_id": chat_id})
|
approvaldb.insert_one({"chat_id": chat_id})
|
||||||
keyboard_off = InlineKeyboardMarkup(
|
keyboard_off = InlineKeyboardMarkup(
|
||||||
[
|
[[InlineKeyboardButton("Turn OFF", callback_data="approval_off")]]
|
||||||
[
|
|
||||||
InlineKeyboardButton(
|
|
||||||
"Turn OFF", callback_data="approval_off"
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
await cb.edit_message_text(
|
await cb.edit_message_text(
|
||||||
"**Autoapproval for this chat: Enabled.**",
|
"**Autoapproval for this chat: Enabled.**",
|
||||||
|
|
@ -83,13 +76,7 @@ async def approval_cb(_, cb: CallbackQuery):
|
||||||
if await approvaldb.count_documents({"chat_id": chat_id}) > 0:
|
if await approvaldb.count_documents({"chat_id": chat_id}) > 0:
|
||||||
approvaldb.delete_one({"chat_id": chat_id})
|
approvaldb.delete_one({"chat_id": chat_id})
|
||||||
keyboard_on = InlineKeyboardMarkup(
|
keyboard_on = InlineKeyboardMarkup(
|
||||||
[
|
[[InlineKeyboardButton("Turn ON", callback_data="approval_on")]]
|
||||||
[
|
|
||||||
InlineKeyboardButton(
|
|
||||||
"Turn ON", callback_data="approval_on"
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
await cb.edit_message_text(
|
await cb.edit_message_text(
|
||||||
"**Autoapproval for this chat: Disabled.**",
|
"**Autoapproval for this chat: Disabled.**",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from curses.ascii import isblank
|
from curses.ascii import isblank
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
from pyrogram.errors import ChannelPrivate, PeerIdInvalid
|
from pyrogram.errors import ChannelPrivate, PeerIdInvalid
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||||
|
|
@ -93,7 +94,9 @@ async def ban_a_user(bot, message):
|
||||||
f"{k.mention} is already banned\n<b>Reason:</b> {alesan['reason']}"
|
f"{k.mention} is already banned\n<b>Reason:</b> {alesan['reason']}"
|
||||||
)
|
)
|
||||||
await db.ban_user(k.id, reason)
|
await db.ban_user(k.id, reason)
|
||||||
await message.reply(f"Successfully banned user {k.mention}!!\n<b>Reason:</b> {reason}")
|
await message.reply(
|
||||||
|
f"Successfully banned user {k.mention}!!\n<b>Reason:</b> {reason}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("unbanuser", COMMAND_HANDLER) & filters.user(SUDO))
|
@app.on_message(filters.command("unbanuser", COMMAND_HANDLER) & filters.user(SUDO))
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,13 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import ChatPermissions
|
|
||||||
from pyrogram.errors import ChatAdminRequired
|
from pyrogram.errors import ChatAdminRequired
|
||||||
|
from pyrogram.types import ChatPermissions
|
||||||
|
|
||||||
from database.blacklist_db import (
|
from database.blacklist_db import (
|
||||||
delete_blacklist_filter,
|
delete_blacklist_filter,
|
||||||
|
|
@ -113,7 +114,9 @@ async def blacklist_filters_re(self, message):
|
||||||
until_date=datetime.now() + timedelta(hours=1),
|
until_date=datetime.now() + timedelta(hours=1),
|
||||||
)
|
)
|
||||||
except ChatAdminRequired:
|
except ChatAdminRequired:
|
||||||
return await message.reply("Please give me admin permissions to blacklist user", quote=False)
|
return await message.reply(
|
||||||
|
"Please give me admin permissions to blacklist user", quote=False
|
||||||
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.info(f"ERROR Blacklist Chat: ID = {chat_id}, ERR = {err}")
|
self.log.info(f"ERROR Blacklist Chat: ID = {chat_id}, ERR = {err}")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from async_pymongo import AsyncClient
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import Message
|
from pyrogram.types import Message
|
||||||
|
|
||||||
from async_pymongo import AsyncClient
|
from misskaty import DATABASE_URI, app
|
||||||
from misskaty import app, DATABASE_URI
|
|
||||||
from misskaty.vars import SUDO
|
from misskaty.vars import SUDO
|
||||||
from utils import broadcast_messages
|
from utils import broadcast_messages
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @lastModified 2022-12-01 09:32:31
|
* @lastModified 2022-12-01 09:32:31
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
@ -16,7 +17,7 @@ from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||||
|
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.helper import get_readable_file_size, fetch, rentry
|
from misskaty.helper import fetch, get_readable_file_size, rentry
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
||||||
LIST_LINK = """
|
LIST_LINK = """
|
||||||
|
|
@ -37,9 +38,8 @@ Supported Link:
|
||||||
Credit: <a href='https://github.com/sanjit-sinha/PyBypass'>PyBypass</a>
|
Credit: <a href='https://github.com/sanjit-sinha/PyBypass'>PyBypass</a>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Stopped development for this plugin since always changed time by time.
|
# Stopped development for this plugin since always changed time by time.
|
||||||
|
|
||||||
|
|
||||||
async def pling_bypass(url):
|
async def pling_bypass(url):
|
||||||
try:
|
try:
|
||||||
id_url = re.search(r"https?://(store.kde.org|www.pling.com)\/p\/(\d+)", url)[2]
|
id_url = re.search(r"https?://(store.kde.org|www.pling.com)\/p\/(\d+)", url)[2]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import asyncio
|
||||||
import html
|
import html
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from openai import AsyncOpenAI, APIConnectionError, RateLimitError, APIStatusError
|
from openai import APIConnectionError, APIStatusError, AsyncOpenAI, RateLimitError
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.errors import MessageTooLong
|
from pyrogram.errors import MessageTooLong
|
||||||
from pyrogram.types import Message
|
from pyrogram.types import Message
|
||||||
|
|
@ -14,8 +14,7 @@ from pyrogram.types import Message
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core import pyro_cooldown
|
from misskaty.core import pyro_cooldown
|
||||||
from misskaty.helper import check_time_gap, fetch, post_to_telegraph, use_chat_lang
|
from misskaty.helper import check_time_gap, fetch, post_to_telegraph, use_chat_lang
|
||||||
from misskaty.vars import GOOGLEAI_KEY, COMMAND_HANDLER, OPENAI_KEY, SUDO
|
from misskaty.vars import COMMAND_HANDLER, GOOGLEAI_KEY, OPENAI_KEY, SUDO
|
||||||
|
|
||||||
|
|
||||||
__MODULE__ = "ChatBot"
|
__MODULE__ = "ChatBot"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -25,7 +24,9 @@ __HELP__ = """
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("ai", COMMAND_HANDLER) & pyro_cooldown.wait(10))
|
@app.on_message(filters.command("ai", COMMAND_HANDLER) & pyro_cooldown.wait(10))
|
||||||
@app.on_bot_business_message(filters.command("ai", COMMAND_HANDLER) & pyro_cooldown.wait(10))
|
@app.on_bot_business_message(
|
||||||
|
filters.command("ai", COMMAND_HANDLER) & pyro_cooldown.wait(10)
|
||||||
|
)
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def gemini_chatbot(_, ctx: Message, strings):
|
async def gemini_chatbot(_, ctx: Message, strings):
|
||||||
if len(ctx.command) == 1:
|
if len(ctx.command) == 1:
|
||||||
|
|
@ -36,18 +37,20 @@ async def gemini_chatbot(_, ctx: Message, strings):
|
||||||
return await ctx.reply_msg("GOOGLEAI_KEY env is missing!!!")
|
return await ctx.reply_msg("GOOGLEAI_KEY env is missing!!!")
|
||||||
msg = await ctx.reply_msg(strings("find_answers_str"), quote=True)
|
msg = await ctx.reply_msg(strings("find_answers_str"), quote=True)
|
||||||
try:
|
try:
|
||||||
data = {
|
data = {"query": ctx.text.split(maxsplit=1)[1], "key": GOOGLEAI_KEY}
|
||||||
"query": ctx.text.split(maxsplit=1)[1],
|
|
||||||
"key": GOOGLEAI_KEY
|
|
||||||
}
|
|
||||||
# Fetch from API beacuse my VPS is not supported
|
# Fetch from API beacuse my VPS is not supported
|
||||||
response = await fetch.post(
|
response = await fetch.post("https://yasirapi.eu.org/gemini", data=data)
|
||||||
"https://yasirapi.eu.org/gemini", data=data
|
|
||||||
)
|
|
||||||
if not response.json().get("candidates"):
|
if not response.json().get("candidates"):
|
||||||
await ctx.reply_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.")
|
await ctx.reply_msg(
|
||||||
|
"⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
await ctx.reply_msg(html.escape(response.json()["candidates"][0]["content"]["parts"][0]["text"])+'\n<b>Powered by:</b> <code>Gemini Flash 1.5</code>')
|
await ctx.reply_msg(
|
||||||
|
html.escape(
|
||||||
|
response.json()["candidates"][0]["content"]["parts"][0]["text"]
|
||||||
|
)
|
||||||
|
+ "\n<b>Powered by:</b> <code>Gemini Flash 1.5</code>"
|
||||||
|
)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await ctx.reply_msg(str(e))
|
await ctx.reply_msg(str(e))
|
||||||
|
|
@ -101,9 +104,13 @@ async def openai_chatbot(_, ctx: Message, strings):
|
||||||
await msg.edit_msg(f"The server could not be reached because {e.__cause__}")
|
await msg.edit_msg(f"The server could not be reached because {e.__cause__}")
|
||||||
except RateLimitError as e:
|
except RateLimitError as e:
|
||||||
if "billing details" in str(e):
|
if "billing details" in str(e):
|
||||||
return await msg.edit_msg("This openai key from this bot has expired, please give openai key donation for bot owner.")
|
return await msg.edit_msg(
|
||||||
|
"This openai key from this bot has expired, please give openai key donation for bot owner."
|
||||||
|
)
|
||||||
await msg.edit_msg("You're got rate limit, please try again later.")
|
await msg.edit_msg("You're got rate limit, please try again later.")
|
||||||
except APIStatusError as e:
|
except APIStatusError as e:
|
||||||
await msg.edit_msg(f"Another {e.status_code} status code was received with response {e.response}")
|
await msg.edit_msg(
|
||||||
|
f"Another {e.status_code} status code was received with response {e.response}"
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await msg.edit_msg(f"ERROR: {e}")
|
await msg.edit_msg(f"ERROR: {e}")
|
||||||
|
|
|
||||||
|
|
@ -5,23 +5,22 @@ import io
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from inspect import getfullargspec
|
from inspect import getfullargspec
|
||||||
|
from logging import getLogger
|
||||||
from shutil import disk_usage
|
from shutil import disk_usage
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Any, Optional, Tuple
|
from typing import Any, Optional, Tuple
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import contextlib
|
|
||||||
import cloudscraper
|
import cloudscraper
|
||||||
import requests
|
import requests
|
||||||
import platform
|
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from logging import getLogger
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from psutil import Process, boot_time, cpu_count, cpu_percent
|
from psutil import Process, boot_time, cpu_count, cpu_percent
|
||||||
from psutil import disk_usage as disk_usage_percent
|
from psutil import disk_usage as disk_usage_percent
|
||||||
|
|
@ -29,15 +28,22 @@ from psutil import net_io_counters, virtual_memory
|
||||||
from pyrogram import Client
|
from pyrogram import Client
|
||||||
from pyrogram import __version__ as pyrover
|
from pyrogram import __version__ as pyrover
|
||||||
from pyrogram import enums, filters
|
from pyrogram import enums, filters
|
||||||
from pyrogram.errors import ChatSendPhotosForbidden, FloodWait, MessageTooLong, PeerIdInvalid, ChatSendPlainForbidden, ReactionInvalid
|
from pyrogram.errors import (
|
||||||
|
ChatSendPhotosForbidden,
|
||||||
|
ChatSendPlainForbidden,
|
||||||
|
FloodWait,
|
||||||
|
MessageTooLong,
|
||||||
|
PeerIdInvalid,
|
||||||
|
ReactionInvalid,
|
||||||
|
)
|
||||||
from pyrogram.raw.types import UpdateBotStopped
|
from pyrogram.raw.types import UpdateBotStopped
|
||||||
from pyrogram.types import (
|
from pyrogram.types import (
|
||||||
InlineKeyboardButton,
|
InlineKeyboardButton,
|
||||||
InlineKeyboardMarkup,
|
InlineKeyboardMarkup,
|
||||||
InputMediaPhoto,
|
InputMediaPhoto,
|
||||||
LabeledPrice,
|
LabeledPrice,
|
||||||
PreCheckoutQuery,
|
|
||||||
Message,
|
Message,
|
||||||
|
PreCheckoutQuery,
|
||||||
)
|
)
|
||||||
|
|
||||||
from database.gban_db import add_gban_user, is_gbanned_user, remove_gban_user
|
from database.gban_db import add_gban_user, is_gbanned_user, remove_gban_user
|
||||||
|
|
@ -92,7 +98,7 @@ async def star_donation(self: Client, ctx: Message):
|
||||||
currency="XTR",
|
currency="XTR",
|
||||||
prices=[LabeledPrice(label="Donation", amount=amount)],
|
prices=[LabeledPrice(label="Donation", amount=amount)],
|
||||||
message_thread_id=ctx.message_thread_id,
|
message_thread_id=ctx.message_thread_id,
|
||||||
payload="stars"
|
payload="stars",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,17 +110,23 @@ async def pre_checkout_query_handler(_: Client, query: PreCheckoutQuery):
|
||||||
@app.on_message(filters.private, group=3)
|
@app.on_message(filters.private, group=3)
|
||||||
async def successful_payment_handler(_: Client, message: Message):
|
async def successful_payment_handler(_: Client, message: Message):
|
||||||
if message.successful_payment:
|
if message.successful_payment:
|
||||||
await message.reply(f"Thanks for support for <b>{message.successful_payment.total_amount} {message.successful_payment.currency}</b>! Your transaction ID is : <code>{message.successful_payment.telegram_payment_charge_id}</code>")
|
await message.reply(
|
||||||
|
f"Thanks for support for <b>{message.successful_payment.total_amount} {message.successful_payment.currency}</b>! Your transaction ID is : <code>{message.successful_payment.telegram_payment_charge_id}</code>"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["refund_star"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["refund_star"], COMMAND_HANDLER))
|
||||||
async def refund_star_payment(client: Client, message: Message):
|
async def refund_star_payment(client: Client, message: Message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply_msg("Please input telegram_payment_charge_id after command.")
|
return await message.reply_msg(
|
||||||
|
"Please input telegram_payment_charge_id after command."
|
||||||
|
)
|
||||||
trx_id = message.command[1]
|
trx_id = message.command[1]
|
||||||
try:
|
try:
|
||||||
await client.refund_star_payment(message.from_user.id, trx_id)
|
await client.refund_star_payment(message.from_user.id, trx_id)
|
||||||
await message.reply_msg(f"Great {message.from_user.mention}, your stars has been refunded to your balance.")
|
await message.reply_msg(
|
||||||
|
f"Great {message.from_user.mention}, your stars has been refunded to your balance."
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await message.reply_msg(e)
|
await message.reply_msg(e)
|
||||||
|
|
||||||
|
|
@ -131,8 +143,12 @@ async def log_file(_, ctx: Message, strings):
|
||||||
data = {
|
data = {
|
||||||
"value": content,
|
"value": content,
|
||||||
}
|
}
|
||||||
pastelog = await fetch.post("https://paste.yasirapi.eu.org/save", data=data, follow_redirects=True)
|
pastelog = await fetch.post(
|
||||||
await msg.edit_msg(f"<a href='{pastelog.url}'>Here the Logs</a>\nlog size: {get_readable_file_size(os.path.getsize('MissKatyLogs.txt'))}")
|
"https://paste.yasirapi.eu.org/save", data=data, follow_redirects=True
|
||||||
|
)
|
||||||
|
await msg.edit_msg(
|
||||||
|
f"<a href='{pastelog.url}'>Here the Logs</a>\nlog size: {get_readable_file_size(os.path.getsize('MissKatyLogs.txt'))}"
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
await ctx.reply_document(
|
await ctx.reply_document(
|
||||||
"MissKatyLogs.txt",
|
"MissKatyLogs.txt",
|
||||||
|
|
@ -171,10 +187,15 @@ async def donate(self: Client, ctx: Message):
|
||||||
"https://img.yasirweb.eu.org/file/ee74ce527fb8264b54691.jpg",
|
"https://img.yasirweb.eu.org/file/ee74ce527fb8264b54691.jpg",
|
||||||
caption="Hi, 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\n<b>Indonesian Payment:</b>\n<b>QRIS:</b> https://img.yasirweb.eu.org/file/ee74ce527fb8264b54691.jpg (Yasir Store)\n<b>Bank Jago:</b> 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\n<b>Source:</b> @BeriKopi",
|
caption="Hi, 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\n<b>Indonesian Payment:</b>\n<b>QRIS:</b> https://img.yasirweb.eu.org/file/ee74ce527fb8264b54691.jpg (Yasir Store)\n<b>Bank Jago:</b> 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\n<b>Source:</b> @BeriKopi",
|
||||||
reply_to_message_id=ctx.id,
|
reply_to_message_id=ctx.id,
|
||||||
message_effect_id=5159385139981059251 if ctx.chat.type.value == "private" else None
|
message_effect_id=5159385139981059251
|
||||||
|
if ctx.chat.type.value == "private"
|
||||||
|
else None,
|
||||||
)
|
)
|
||||||
except (ChatSendPlainForbidden, ChatSendPhotosForbidden):
|
except (ChatSendPlainForbidden, ChatSendPhotosForbidden):
|
||||||
await self.send_message(LOG_CHANNEL, f"❗️ <b>WARNING</b>\nI'm leaving from {ctx.chat.id} since i didn't have sufficient admin permissions.")
|
await self.send_message(
|
||||||
|
LOG_CHANNEL,
|
||||||
|
f"❗️ <b>WARNING</b>\nI'm leaving from {ctx.chat.id} since i didn't have sufficient admin permissions.",
|
||||||
|
)
|
||||||
await ctx.chat.leave()
|
await ctx.chat.leave()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -372,7 +393,9 @@ async def unban_globally(_, ctx: Message):
|
||||||
filters.command(["shell", "sh", "term"], COMMAND_HANDLER) & filters.user(SUDO)
|
filters.command(["shell", "sh", "term"], COMMAND_HANDLER) & filters.user(SUDO)
|
||||||
)
|
)
|
||||||
@app.on_edited_message(
|
@app.on_edited_message(
|
||||||
filters.command(["shell", "sh", "term"], COMMAND_HANDLER) & filters.user(SUDO) & ~filters.react
|
filters.command(["shell", "sh", "term"], COMMAND_HANDLER)
|
||||||
|
& filters.user(SUDO)
|
||||||
|
& ~filters.react
|
||||||
)
|
)
|
||||||
@user.on_message(filters.command(["shell", "sh", "term"], ".") & filters.me)
|
@user.on_message(filters.command(["shell", "sh", "term"], ".") & filters.me)
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
|
|
@ -435,8 +458,12 @@ async def shell_cmd(self: Client, ctx: Message, strings):
|
||||||
& filters.user(SUDO)
|
& filters.user(SUDO)
|
||||||
)
|
)
|
||||||
@app.on_edited_message(
|
@app.on_edited_message(
|
||||||
(filters.command(["ev", "run", "meval"], COMMAND_HANDLER) | filters.regex(r"app.run\(\)$"))
|
(
|
||||||
& filters.user(SUDO) & ~filters.react
|
filters.command(["ev", "run", "meval"], COMMAND_HANDLER)
|
||||||
|
| filters.regex(r"app.run\(\)$")
|
||||||
|
)
|
||||||
|
& filters.user(SUDO)
|
||||||
|
& ~filters.react
|
||||||
)
|
)
|
||||||
@user.on_message(filters.command(["ev", "run", "meval"], ".") & filters.me)
|
@user.on_message(filters.command(["ev", "run", "meval"], ".") & filters.me)
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
|
|
@ -449,7 +476,9 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||||
else await ctx.reply_msg(strings("run_eval"), quote=True)
|
else await ctx.reply_msg(strings("run_eval"), quote=True)
|
||||||
)
|
)
|
||||||
code = (
|
code = (
|
||||||
ctx.text.split(maxsplit=1)[1] if ctx.command else ctx.text.split("\napp.run()")[0]
|
ctx.text.split(maxsplit=1)[1]
|
||||||
|
if ctx.command
|
||||||
|
else ctx.text.split("\napp.run()")[0]
|
||||||
)
|
)
|
||||||
out_buf = io.StringIO()
|
out_buf = io.StringIO()
|
||||||
out = ""
|
out = ""
|
||||||
|
|
@ -586,6 +615,7 @@ async def update_restart(_, ctx: Message, strings):
|
||||||
async def tespoll(self, msg):
|
async def tespoll(self, msg):
|
||||||
await ctx.reply(msg)
|
await ctx.reply(msg)
|
||||||
|
|
||||||
|
|
||||||
@app.on_raw_update(group=-99)
|
@app.on_raw_update(group=-99)
|
||||||
async def updtebot(client, update, users, _):
|
async def updtebot(client, update, users, _):
|
||||||
if isinstance(update, UpdateBotStopped):
|
if isinstance(update, UpdateBotStopped):
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,17 @@
|
||||||
# * @projectName MissKatyPyro
|
# * @projectName MissKatyPyro
|
||||||
# * Copyright ©YasirPedia All rights reserved
|
# * Copyright ©YasirPedia All rights reserved
|
||||||
import asyncio
|
import asyncio
|
||||||
import cloudscraper
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
from cloudscraper import create_scraper
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
|
import cloudscraper
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from cloudscraper import create_scraper
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.file_id import FileId
|
from pyrogram.file_id import FileId
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
@ -183,32 +183,46 @@ async def instadl(_, message):
|
||||||
msg = await message.reply("Trying download...")
|
msg = await message.reply("Trying download...")
|
||||||
try:
|
try:
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0",
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0",
|
||||||
"Accept": "*/*",
|
"Accept": "*/*",
|
||||||
"Accept-Language": "en-US,en;q=0.5",
|
"Accept-Language": "en-US,en;q=0.5",
|
||||||
"Accept-Encoding": "gzip, deflate, br",
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
"Content-Length": "99",
|
"Content-Length": "99",
|
||||||
"Origin": "https://saveig.app",
|
"Origin": "https://saveig.app",
|
||||||
"Connection": "keep-alive",
|
"Connection": "keep-alive",
|
||||||
"Referer": "https://saveig.app/id",
|
"Referer": "https://saveig.app/id",
|
||||||
}
|
}
|
||||||
post = create_scraper().post("https://saveig.app/api/ajaxSearch", data={"q": link, "t": "media", "lang": "id"}, headers=headers)
|
post = create_scraper().post(
|
||||||
|
"https://saveig.app/api/ajaxSearch",
|
||||||
|
data={"q": link, "t": "media", "lang": "id"},
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
if post.status_code not in [200, 401]:
|
if post.status_code not in [200, 401]:
|
||||||
return await message.reply("Unknown error.")
|
return await message.reply("Unknown error.")
|
||||||
res = post.json()
|
res = post.json()
|
||||||
if r := re.findall(r'href="(https?://(?!play\.google\.com|/)[^"]+)"', res["data"]):
|
if r := re.findall(
|
||||||
|
r'href="(https?://(?!play\.google\.com|/)[^"]+)"', res["data"]
|
||||||
|
):
|
||||||
res = r[0].replace("&", "&")
|
res = r[0].replace("&", "&")
|
||||||
fname = (await fetch.head(res)).headers.get("content-disposition", "").split("filename=")[1]
|
fname = (
|
||||||
is_img = (await fetch.head(res)).headers.get("content-type").startswith("image")
|
(await fetch.head(res))
|
||||||
|
.headers.get("content-disposition", "")
|
||||||
|
.split("filename=")[1]
|
||||||
|
)
|
||||||
|
is_img = (
|
||||||
|
(await fetch.head(res)).headers.get("content-type").startswith("image")
|
||||||
|
)
|
||||||
if is_img:
|
if is_img:
|
||||||
await message.reply_photo(res, caption=fname)
|
await message.reply_photo(res, caption=fname)
|
||||||
else:
|
else:
|
||||||
await message.reply_video(res, caption=fname)
|
await message.reply_video(res, caption=fname)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await message.reply(f"Failed to download instagram video..\n\n<b>Reason:</b> {e}")
|
await message.reply(
|
||||||
|
f"Failed to download instagram video..\n\n<b>Reason:</b> {e}"
|
||||||
|
)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -251,15 +265,29 @@ async def twitterdl(_, message):
|
||||||
if post.status_code not in [200, 401]:
|
if post.status_code not in [200, 401]:
|
||||||
return await msg.edit_msg("Unknown error.")
|
return await msg.edit_msg("Unknown error.")
|
||||||
soup = BeautifulSoup(post.text, "lxml")
|
soup = BeautifulSoup(post.text, "lxml")
|
||||||
cekdata = soup.find("a", {"pure-button pure-button-primary is-center u-bl dl-button download_link without_watermark vignette_active"})
|
cekdata = soup.find(
|
||||||
|
"a",
|
||||||
|
{
|
||||||
|
"pure-button pure-button-primary is-center u-bl dl-button download_link without_watermark vignette_active"
|
||||||
|
},
|
||||||
|
)
|
||||||
if not cekdata:
|
if not cekdata:
|
||||||
return await message.reply("ERROR: Oops! It seems that this tweet doesn't have a video! Try later or check your link")
|
return await message.reply(
|
||||||
|
"ERROR: Oops! It seems that this tweet doesn't have a video! Try later or check your link"
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
fname = (await fetch.head(cekdata.get("href"))).headers.get("content-disposition", "").split("filename=")[1]
|
fname = (
|
||||||
|
(await fetch.head(cekdata.get("href")))
|
||||||
|
.headers.get("content-disposition", "")
|
||||||
|
.split("filename=")[1]
|
||||||
|
)
|
||||||
obj = SmartDL(cekdata.get("href"), progress_bar=False, timeout=15)
|
obj = SmartDL(cekdata.get("href"), progress_bar=False, timeout=15)
|
||||||
obj.start()
|
obj.start()
|
||||||
path = obj.get_dest()
|
path = obj.get_dest()
|
||||||
await message.reply_video(path, caption=f"<code>{fname}</code>\n\nUploaded for {message.from_user.mention} [<code>{message.from_user.id}</code>]",)
|
await message.reply_video(
|
||||||
|
path,
|
||||||
|
caption=f"<code>{fname}</code>\n\nUploaded for {message.from_user.mention} [<code>{message.from_user.id}</code>]",
|
||||||
|
)
|
||||||
except Exception as er:
|
except Exception as er:
|
||||||
LOGGER.error("ERROR: while fetching TwitterDL. %s", er)
|
LOGGER.error("ERROR: while fetching TwitterDL. %s", er)
|
||||||
return await msg.edit_msg("ERROR: Got error while extracting link.")
|
return await msg.edit_msg("ERROR: Got error while extracting link.")
|
||||||
|
|
@ -284,8 +312,10 @@ async def tiktokdl(_, message):
|
||||||
"https://lovetik.com/api/ajax/search", data={"query": link}
|
"https://lovetik.com/api/ajax/search", data={"query": link}
|
||||||
)
|
)
|
||||||
).json()
|
).json()
|
||||||
fname = (await fetch.head(r["links"][0]["a"])).headers.get("content-disposition", "")
|
fname = (await fetch.head(r["links"][0]["a"])).headers.get(
|
||||||
filename = unquote(fname.split('filename=')[1].strip('"').split('"')[0])
|
"content-disposition", ""
|
||||||
|
)
|
||||||
|
filename = unquote(fname.split("filename=")[1].strip('"').split('"')[0])
|
||||||
await message.reply_video(
|
await message.reply_video(
|
||||||
r["links"][0]["a"],
|
r["links"][0]["a"],
|
||||||
caption=f"<b>Title:</b> <code>{filename}</code>\n<b>Uploader</b>: <a href='https://www.tiktok.com/{r['author']}'>{r['author_name']}</a>\n\nUploaded for {message.from_user.mention} [<code>{message.from_user.id}</code>]",
|
caption=f"<b>Title:</b> <code>{filename}</code>\n<b>Uploader</b>: <a href='https://www.tiktok.com/{r['author']}'>{r['author_name']}</a>\n\nUploaded for {message.from_user.mention} [<code>{message.from_user.id}</code>]",
|
||||||
|
|
|
||||||
|
|
@ -23,20 +23,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import uuid
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from database.feds_db import *
|
import uuid
|
||||||
|
|
||||||
from misskaty import app, BOT_ID
|
|
||||||
from misskaty.vars import SUDO, LOG_GROUP_ID, COMMAND_HANDLER
|
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.enums import ChatMemberStatus, ChatType, ParseMode
|
from pyrogram.enums import ChatMemberStatus, ChatType, ParseMode
|
||||||
|
from pyrogram.errors import FloodWait, PeerIdInvalid
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
||||||
from misskaty.helper.functions import extract_user, extract_user_and_reason
|
from database.feds_db import *
|
||||||
from pyrogram.errors import FloodWait, PeerIdInvalid
|
from misskaty import BOT_ID, app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
|
from misskaty.helper.functions import extract_user, extract_user_and_reason
|
||||||
|
from misskaty.vars import COMMAND_HANDLER, LOG_GROUP_ID, SUDO
|
||||||
|
|
||||||
__MODULE__ = "Federation"
|
__MODULE__ = "Federation"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -451,7 +450,9 @@ async def get_all_fadmins_mentions(client, message):
|
||||||
|
|
||||||
fadmin_ids = fed_info.get("fadmins", [])
|
fadmin_ids = fed_info.get("fadmins", [])
|
||||||
if not fadmin_ids:
|
if not fadmin_ids:
|
||||||
return await message.reply_text(f"**Owner: {fed_info['owner_mention']}\n\nNo fadmins found in the federation.")
|
return await message.reply_text(
|
||||||
|
f"**Owner: {fed_info['owner_mention']}\n\nNo fadmins found in the federation."
|
||||||
|
)
|
||||||
|
|
||||||
user_mentions = []
|
user_mentions = []
|
||||||
for user_id in fadmin_ids:
|
for user_id in fadmin_ids:
|
||||||
|
|
@ -460,7 +461,10 @@ async def get_all_fadmins_mentions(client, message):
|
||||||
user_mentions.append(f"● {user.mention}[`{user.id}`]")
|
user_mentions.append(f"● {user.mention}[`{user.id}`]")
|
||||||
except Exception:
|
except Exception:
|
||||||
user_mentions.append(f"● `Admin🥷`[`{user_id}`]")
|
user_mentions.append(f"● `Admin🥷`[`{user_id}`]")
|
||||||
reply_text = f"**Owner: {fed_info['owner_mention']}\n\nList of fadmins:**\n" + "\n".join(user_mentions)
|
reply_text = (
|
||||||
|
f"**Owner: {fed_info['owner_mention']}\n\nList of fadmins:**\n"
|
||||||
|
+ "\n".join(user_mentions)
|
||||||
|
)
|
||||||
await message.reply_text(reply_text)
|
await message.reply_text(reply_text)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -572,7 +576,9 @@ async def fban_user(client, message):
|
||||||
chat = message.chat
|
chat = message.chat
|
||||||
from_user = message.from_user
|
from_user = message.from_user
|
||||||
if message.chat.type == ChatType.PRIVATE:
|
if message.chat.type == ChatType.PRIVATE:
|
||||||
return await message.reply_text("This command is specific to groups, not our pm!.")
|
return await message.reply_text(
|
||||||
|
"This command is specific to groups, not our pm!."
|
||||||
|
)
|
||||||
fed_id = await get_fed_id(chat.id)
|
fed_id = await get_fed_id(chat.id)
|
||||||
if not fed_id:
|
if not fed_id:
|
||||||
return await message.reply_text("**This chat is not a part of any federation.")
|
return await message.reply_text("**This chat is not a part of any federation.")
|
||||||
|
|
@ -592,7 +598,9 @@ async def fban_user(client, message):
|
||||||
try:
|
try:
|
||||||
user = await app.get_users(user_id)
|
user = await app.get_users(user_id)
|
||||||
except PeerIdInvalid:
|
except PeerIdInvalid:
|
||||||
return await message.reply_msg("Sorry, i never meet this user. So i cannot fban.")
|
return await message.reply_msg(
|
||||||
|
"Sorry, i never meet this user. So i cannot fban."
|
||||||
|
)
|
||||||
if not user_id:
|
if not user_id:
|
||||||
return await message.reply_text("I can't find that user.")
|
return await message.reply_text("I can't find that user.")
|
||||||
if user_id in all_admins or user_id in SUDO:
|
if user_id in all_admins or user_id in SUDO:
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,10 @@ from .ytdl_plugins import YT_DB
|
||||||
chat = [-1001128045651, -1001255283935, -1001455886928]
|
chat = [-1001128045651, -1001255283935, -1001455886928]
|
||||||
REQUEST_DB = {}
|
REQUEST_DB = {}
|
||||||
|
|
||||||
|
|
||||||
# This modules is only working for my movies group to help collect a list of film requests by members.
|
# This modules is only working for my movies group to help collect a list of film requests by members.
|
||||||
|
|
||||||
|
|
||||||
# @app.on_message(filters.regex(r"alamu'?ala[iy]ku+m", re.I) & filters.chat(chat))
|
# @app.on_message(filters.regex(r"alamu'?ala[iy]ku+m", re.I) & filters.chat(chat))
|
||||||
async def salamregex(_, message):
|
async def salamregex(_, message):
|
||||||
await message.reply_text(text=f"Wa'alaikumsalam {message.from_user.mention} 😇")
|
await message.reply_text(text=f"Wa'alaikumsalam {message.from_user.mention} 😇")
|
||||||
|
|
@ -186,7 +188,8 @@ async def callbackreq(c, q):
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text="✅ Request Completed", callback_data="reqcompl"
|
text="✅ Request Completed",
|
||||||
|
callback_data="reqcompl",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
@ -199,7 +202,8 @@ async def callbackreq(c, q):
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text="✅ Request Completed", callback_data="reqcompl"
|
text="✅ Request Completed",
|
||||||
|
callback_data="reqcompl",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
@ -300,7 +304,8 @@ async def callbackreject(c, q):
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text="🚫 Request Rejected", callback_data="reqreject"
|
text="🚫 Request Rejected",
|
||||||
|
callback_data="reqreject",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
@ -313,7 +318,8 @@ async def callbackreject(c, q):
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text="🚫 Request Rejected", callback_data="reqreject"
|
text="🚫 Request Rejected",
|
||||||
|
callback_data="reqreject",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
@ -428,7 +434,8 @@ async def callbackaft_unav(_, q):
|
||||||
@app.on_callback_query(filters.regex(r"^reqavailable$"))
|
@app.on_callback_query(filters.regex(r"^reqavailable$"))
|
||||||
async def callbackaft_dahada(_, q):
|
async def callbackaft_dahada(_, q):
|
||||||
await q.answer(
|
await q.answer(
|
||||||
"Request ini sudah ada, silahkan cari 🔍 di channelnya yaa 😉..", show_alert=True
|
"Request ini sudah ada, silahkan cari 🔍 di channelnya yaa 😉..",
|
||||||
|
show_alert=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
|
|
@ -55,7 +56,9 @@ You can use markdown or html to save text too.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["addfilter", "filter"], COMMAND_HANDLER) & ~filters.private)
|
@app.on_message(
|
||||||
|
filters.command(["addfilter", "filter"], COMMAND_HANDLER) & ~filters.private
|
||||||
|
)
|
||||||
@adminsOnly("can_change_info")
|
@adminsOnly("can_change_info")
|
||||||
async def save_filters(_, message):
|
async def save_filters(_, message):
|
||||||
try:
|
try:
|
||||||
|
|
@ -80,7 +83,11 @@ async def save_filters(_, message):
|
||||||
elif not replied_message.text and not replied_message.caption:
|
elif not replied_message.text and not replied_message.caption:
|
||||||
data = None
|
data = None
|
||||||
else:
|
else:
|
||||||
data = replied_message.text.markdown if replied_message.text else replied_message.caption.markdown
|
data = (
|
||||||
|
replied_message.text.markdown
|
||||||
|
if replied_message.text
|
||||||
|
else replied_message.caption.markdown
|
||||||
|
)
|
||||||
if replied_message.text:
|
if replied_message.text:
|
||||||
_type = "text"
|
_type = "text"
|
||||||
file_id = None
|
file_id = None
|
||||||
|
|
@ -110,7 +117,9 @@ async def save_filters(_, message):
|
||||||
file_id = replied_message.voice.file_id
|
file_id = replied_message.voice.file_id
|
||||||
if replied_message.reply_markup and "~" not in data:
|
if replied_message.reply_markup and "~" not in data:
|
||||||
if urls := extract_urls(replied_message.reply_markup):
|
if urls := extract_urls(replied_message.reply_markup):
|
||||||
response = "\n".join([f"{name}=[{text}, {url}]" for name, text, url in urls])
|
response = "\n".join(
|
||||||
|
[f"{name}=[{text}, {url}]" for name, text, url in urls]
|
||||||
|
)
|
||||||
data = data + response
|
data = data + response
|
||||||
name = name.replace("_", " ")
|
name = name.replace("_", " ")
|
||||||
_filter = {
|
_filter = {
|
||||||
|
|
@ -121,7 +130,9 @@ async def save_filters(_, message):
|
||||||
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_text(f"__**Saved filter {name}.**__")
|
||||||
except UnboundLocalError:
|
except UnboundLocalError:
|
||||||
return await message.reply_text("**Replied message is inaccessible.\n`Forward the message and try again`**")
|
return await message.reply_text(
|
||||||
|
"**Replied message is inaccessible.\n`Forward the message and try again`**"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("filters", COMMAND_HANDLER) & ~filters.private)
|
@app.on_message(filters.command("filters", COMMAND_HANDLER) & ~filters.private)
|
||||||
|
|
@ -137,7 +148,9 @@ async def get_filterss(_, m):
|
||||||
await m.reply_msg(msg)
|
await m.reply_msg(msg)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["stop", "stopfilter"], COMMAND_HANDLER) & ~filters.private)
|
@app.on_message(
|
||||||
|
filters.command(["stop", "stopfilter"], COMMAND_HANDLER) & ~filters.private
|
||||||
|
)
|
||||||
@adminsOnly("can_change_info")
|
@adminsOnly("can_change_info")
|
||||||
async def del_filter(_, m):
|
async def del_filter(_, m):
|
||||||
if len(m.command) < 2:
|
if len(m.command) < 2:
|
||||||
|
|
@ -159,7 +172,9 @@ async def del_filter(_, m):
|
||||||
)
|
)
|
||||||
async def filters_re(_, message):
|
async def filters_re(_, message):
|
||||||
text = message.text.lower().strip()
|
text = message.text.lower().strip()
|
||||||
if not text or (message.command and message.command[0].lower() in ["filter", "addfilter"]):
|
if not text or (
|
||||||
|
message.command and message.command[0].lower() in ["filter", "addfilter"]
|
||||||
|
):
|
||||||
return
|
return
|
||||||
chat_id = message.chat.id
|
chat_id = message.chat.id
|
||||||
list_of_filters = await get_filters_names(chat_id)
|
list_of_filters = await get_filters_names(chat_id)
|
||||||
|
|
@ -242,12 +257,16 @@ async def stop_all(_, message):
|
||||||
else:
|
else:
|
||||||
keyboard = InlineKeyboardMarkup(
|
keyboard = InlineKeyboardMarkup(
|
||||||
[
|
[
|
||||||
[InlineKeyboardButton("YES, DO IT", callback_data="stop_yes"),
|
[
|
||||||
InlineKeyboardButton("Cancel", callback_data="stop_no")
|
InlineKeyboardButton("YES, DO IT", callback_data="stop_yes"),
|
||||||
|
InlineKeyboardButton("Cancel", callback_data="stop_no"),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
await message.reply_text("**Are you sure you want to delete all the filters in this chat forever ?.**", reply_markup=keyboard)
|
await message.reply_text(
|
||||||
|
"**Are you sure you want to delete all the filters in this chat forever ?.**",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex("stop_(.*)"))
|
@app.on_callback_query(filters.regex("stop_(.*)"))
|
||||||
|
|
@ -257,12 +276,17 @@ async def stop_all_cb(_, cb):
|
||||||
permissions = await member_permissions(chat_id, from_user.id)
|
permissions = await member_permissions(chat_id, from_user.id)
|
||||||
permission = "can_change_info"
|
permission = "can_change_info"
|
||||||
if permission not in permissions:
|
if permission not in permissions:
|
||||||
return await cb.answer(f"You don't have the required permission.\n Permission: {permission}", show_alert=True)
|
return await cb.answer(
|
||||||
|
f"You don't have the required permission.\n Permission: {permission}",
|
||||||
|
show_alert=True,
|
||||||
|
)
|
||||||
input = cb.data.split("_", 1)[1]
|
input = cb.data.split("_", 1)[1]
|
||||||
if input == "yes":
|
if input == "yes":
|
||||||
stoped_all = await deleteall_filters(chat_id)
|
stoped_all = await deleteall_filters(chat_id)
|
||||||
if stoped_all:
|
if stoped_all:
|
||||||
return await cb.message.edit("**Successfully deleted all filters on this chat.**")
|
return await cb.message.edit(
|
||||||
|
"**Successfully deleted all filters on this chat.**"
|
||||||
|
)
|
||||||
if input == "no":
|
if input == "no":
|
||||||
await cb.message.reply_to_message.delete()
|
await cb.message.reply_to_message.delete()
|
||||||
await cb.message.delete()
|
await cb.message.delete()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import textwrap
|
import textwrap
|
||||||
import regex
|
|
||||||
from asyncio import gather
|
from asyncio import gather
|
||||||
from os import remove as hapus
|
from os import remove as hapus
|
||||||
|
|
||||||
|
import regex
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.errors import MessageIdInvalid, PeerIdInvalid, ReactionInvalid
|
from pyrogram.errors import MessageIdInvalid, PeerIdInvalid, ReactionInvalid
|
||||||
|
|
@ -201,16 +201,20 @@ async def beriharapan(c, m):
|
||||||
@user.on_message(filters.command("react", "."))
|
@user.on_message(filters.command("react", "."))
|
||||||
async def givereact(c, m):
|
async def givereact(c, m):
|
||||||
if len(m.command) == 1:
|
if len(m.command) == 1:
|
||||||
return await m.reply("Please add reaction after command, you can give multiple reaction too.")
|
return await m.reply(
|
||||||
|
"Please add reaction after command, you can give multiple reaction too."
|
||||||
|
)
|
||||||
if not m.reply_to_message:
|
if not m.reply_to_message:
|
||||||
return await m.reply("Please reply to the message you want to react to.")
|
return await m.reply("Please reply to the message you want to react to.")
|
||||||
emot = list(regex.findall(r'\p{Emoji}', m.text))
|
emot = list(regex.findall(r"\p{Emoji}", m.text))
|
||||||
try:
|
try:
|
||||||
await m.reply_to_message.react(emoji=emot)
|
await m.reply_to_message.react(emoji=emot)
|
||||||
except ReactionInvalid:
|
except ReactionInvalid:
|
||||||
await m.reply("Please give valid reaction.")
|
await m.reply("Please give valid reaction.")
|
||||||
except MessageIdInvalid:
|
except MessageIdInvalid:
|
||||||
await m.reply("Sorry, i couldn't react to other bots or without being as administrator.")
|
await m.reply(
|
||||||
|
"Sorry, i couldn't react to other bots or without being as administrator."
|
||||||
|
)
|
||||||
except PeerIdInvalid:
|
except PeerIdInvalid:
|
||||||
await m.reply("Sorry, i can't react chat without join that groups.")
|
await m.reply("Sorry, i can't react chat without join that groups.")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
@ -46,7 +47,9 @@ async def genss(self: Client, ctx: Message, strings):
|
||||||
file_name = os.path.basename(url)
|
file_name = os.path.basename(url)
|
||||||
download_file_path = os.path.join("downloads/", file_name)
|
download_file_path = os.path.join("downloads/", file_name)
|
||||||
try:
|
try:
|
||||||
downloader = SmartDL(url, download_file_path, progress_bar=False, timeout=10, verify=False)
|
downloader = SmartDL(
|
||||||
|
url, download_file_path, progress_bar=False, timeout=10, verify=False
|
||||||
|
)
|
||||||
downloader.start(blocking=False)
|
downloader.start(blocking=False)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
return await pesan.edit(str(err))
|
return await pesan.edit(str(err))
|
||||||
|
|
@ -111,7 +114,9 @@ async def genss(self: Client, ctx: Message, strings):
|
||||||
)
|
)
|
||||||
await ctx.reply_msg(
|
await ctx.reply_msg(
|
||||||
strings("up_msg").format(
|
strings("up_msg").format(
|
||||||
namma=ctx.from_user.mention if ctx.from_user else ctx.sender_chat.title,
|
namma=ctx.from_user.mention
|
||||||
|
if ctx.from_user
|
||||||
|
else ctx.sender_chat.title,
|
||||||
id=ctx.from_user.id if ctx.from_user else ctx.sender_chat.title,
|
id=ctx.from_user.id if ctx.from_user else ctx.sender_chat.title,
|
||||||
bot_uname=self.me.username,
|
bot_uname=self.me.username,
|
||||||
),
|
),
|
||||||
|
|
@ -178,7 +183,9 @@ async def genss(self: Client, ctx: Message, strings):
|
||||||
)
|
)
|
||||||
await ctx.reply_msg(
|
await ctx.reply_msg(
|
||||||
strings("up_msg").format(
|
strings("up_msg").format(
|
||||||
namma=ctx.from_user.mention if ctx.from_user else ctx.sender_chat.title,
|
namma=ctx.from_user.mention
|
||||||
|
if ctx.from_user
|
||||||
|
else ctx.sender_chat.title,
|
||||||
id=ctx.from_user.id if ctx.from_user else ctx.sender_chat.id,
|
id=ctx.from_user.id if ctx.from_user else ctx.sender_chat.id,
|
||||||
bot_uname=self.me.username,
|
bot_uname=self.me.username,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ from pyrogram.errors import (
|
||||||
)
|
)
|
||||||
from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
||||||
from database.users_chats_db import db
|
|
||||||
from database.greetings_db import is_welcome, toggle_welcome
|
from database.greetings_db import is_welcome, toggle_welcome
|
||||||
|
from database.users_chats_db import db
|
||||||
from misskaty import BOT_USERNAME, app
|
from misskaty import BOT_USERNAME, app
|
||||||
from misskaty.core.decorator import asyncify, capture_err
|
from misskaty.core.decorator import asyncify, capture_err
|
||||||
from misskaty.helper import fetch, use_chat_lang
|
from misskaty.helper import fetch, use_chat_lang
|
||||||
|
|
@ -169,7 +169,9 @@ async def member_has_joined(c: app, member: ChatMemberUpdated, strings):
|
||||||
@app.adminsOnly("can_change_info")
|
@app.adminsOnly("can_change_info")
|
||||||
async def welcome_toggle_handler(client, message):
|
async def welcome_toggle_handler(client, message):
|
||||||
is_enabled = await toggle_welcome(message.chat.id)
|
is_enabled = await toggle_welcome(message.chat.id)
|
||||||
await message.reply_msg(f"Welcome messages are now {'enabled' if is_enabled else 'disabled'}.")
|
await message.reply_msg(
|
||||||
|
f"Welcome messages are now {'enabled' if is_enabled else 'disabled'}."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# ToDo with ChatMemberUpdated
|
# ToDo with ChatMemberUpdated
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
# * @projectName MissKatyPyro
|
# * @projectName MissKatyPyro
|
||||||
# * Copyright ©YasirPedia All rights reserved
|
# * Copyright ©YasirPedia All rights reserved
|
||||||
import contextlib
|
import contextlib
|
||||||
import httpx
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from urllib.parse import quote_plus
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
|
import httpx
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from deep_translator import GoogleTranslator
|
from deep_translator import GoogleTranslator
|
||||||
from pykeyboard import InlineButton, InlineKeyboard
|
from pykeyboard import InlineButton, InlineKeyboard
|
||||||
|
|
@ -145,7 +145,9 @@ async def imdb_search_id(kueri, message):
|
||||||
return await k.edit_caption(
|
return await k.edit_caption(
|
||||||
f"⛔️ Tidak ditemukan hasil untuk kueri: <code>{kueri}</code>"
|
f"⛔️ Tidak ditemukan hasil untuk kueri: <code>{kueri}</code>"
|
||||||
)
|
)
|
||||||
msg += f"🎬 Ditemukan ({len(res)}) hasil untuk kueri: <code>{kueri}</code>\n\n"
|
msg += (
|
||||||
|
f"🎬 Ditemukan ({len(res)}) hasil untuk kueri: <code>{kueri}</code>\n\n"
|
||||||
|
)
|
||||||
for num, movie in enumerate(res, start=1):
|
for num, movie in enumerate(res, start=1):
|
||||||
title = movie.get("l")
|
title = movie.get("l")
|
||||||
if year := movie.get("yr"):
|
if year := movie.get("yr"):
|
||||||
|
|
@ -207,7 +209,9 @@ async def imdb_search_en(kueri, message):
|
||||||
return await k.edit_caption(
|
return await k.edit_caption(
|
||||||
f"⛔️ Result not found for keywords: <code>{kueri}</code>"
|
f"⛔️ Result not found for keywords: <code>{kueri}</code>"
|
||||||
)
|
)
|
||||||
msg += f"🎬 Found ({len(res)}) result for keywords: <code>{kueri}</code>\n\n"
|
msg += (
|
||||||
|
f"🎬 Found ({len(res)}) result for keywords: <code>{kueri}</code>\n\n"
|
||||||
|
)
|
||||||
for num, movie in enumerate(res, start=1):
|
for num, movie in enumerate(res, start=1):
|
||||||
title = movie.get("l")
|
title = movie.get("l")
|
||||||
if year := movie.get("yr"):
|
if year := movie.get("yr"):
|
||||||
|
|
@ -300,13 +304,17 @@ async def imdbcari(_, query: CallbackQuery):
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text="🚩 Language", callback_data=f"imdbset#{uid}"
|
text="🚩 Language", callback_data=f"imdbset#{uid}"
|
||||||
),
|
),
|
||||||
InlineKeyboardButton(text="❌ Close", callback_data=f"close#{uid}"),
|
InlineKeyboardButton(
|
||||||
|
text="❌ Close", callback_data=f"close#{uid}"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
buttons.add(*BTN)
|
buttons.add(*BTN)
|
||||||
await query.message.edit_caption(msg, reply_markup=buttons)
|
await query.message.edit_caption(msg, reply_markup=buttons)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await query.message.edit_caption(f"HTTP Exception for IMDB Search - <code>{exc}</code>")
|
await query.message.edit_caption(
|
||||||
|
f"HTTP Exception for IMDB Search - <code>{exc}</code>"
|
||||||
|
)
|
||||||
except (MessageIdInvalid, MessageNotModified):
|
except (MessageIdInvalid, MessageNotModified):
|
||||||
pass
|
pass
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
@ -357,13 +365,17 @@ async def imdbcari(_, query: CallbackQuery):
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text="🚩 Language", callback_data=f"imdbset#{uid}"
|
text="🚩 Language", callback_data=f"imdbset#{uid}"
|
||||||
),
|
),
|
||||||
InlineKeyboardButton(text="❌ Close", callback_data=f"close#{uid}"),
|
InlineKeyboardButton(
|
||||||
|
text="❌ Close", callback_data=f"close#{uid}"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
buttons.add(*BTN)
|
buttons.add(*BTN)
|
||||||
await query.message.edit_caption(msg, reply_markup=buttons)
|
await query.message.edit_caption(msg, reply_markup=buttons)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await query.message.edit_caption(f"HTTP Exception for IMDB Search - <code>{exc}</code>")
|
await query.message.edit_caption(
|
||||||
|
f"HTTP Exception for IMDB Search - <code>{exc}</code>"
|
||||||
|
)
|
||||||
except (MessageIdInvalid, MessageNotModified):
|
except (MessageIdInvalid, MessageNotModified):
|
||||||
pass
|
pass
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
@ -387,7 +399,9 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
||||||
r_json = json.loads(
|
r_json = json.loads(
|
||||||
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||||
)
|
)
|
||||||
ott = await search_jw(r_json.get("alternateName") or r_json.get("name"), "ID")
|
ott = await search_jw(
|
||||||
|
r_json.get("alternateName") or r_json.get("name"), "ID"
|
||||||
|
)
|
||||||
typee = r_json.get("@type", "")
|
typee = r_json.get("@type", "")
|
||||||
res_str = ""
|
res_str = ""
|
||||||
tahun = (
|
tahun = (
|
||||||
|
|
@ -402,7 +416,9 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if durasi := sop.select('li[data-testid="title-techspec_runtime"]'):
|
if durasi := sop.select('li[data-testid="title-techspec_runtime"]'):
|
||||||
durasi = (
|
durasi = (
|
||||||
durasi[0].find(class_="ipc-metadata-list-item__content-container").text
|
durasi[0]
|
||||||
|
.find(class_="ipc-metadata-list-item__content-container")
|
||||||
|
.text
|
||||||
)
|
)
|
||||||
res_str += f"<b>Durasi:</b> <code>{GoogleTranslator('auto', 'id').translate(durasi)}</code>\n"
|
res_str += f"<b>Durasi:</b> <code>{GoogleTranslator('auto', 'id').translate(durasi)}</code>\n"
|
||||||
if kategori := r_json.get("contentRating"):
|
if kategori := r_json.get("contentRating"):
|
||||||
|
|
@ -420,9 +436,7 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
||||||
rilis_url = release[0].find(
|
rilis_url = release[0].find(
|
||||||
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
)["href"]
|
)["href"]
|
||||||
res_str += (
|
res_str += f"<b>Rilis:</b> <a href='https://www.imdb.com{rilis_url}'>{rilis}</a>\n"
|
||||||
f"<b>Rilis:</b> <a href='https://www.imdb.com{rilis_url}'>{rilis}</a>\n"
|
|
||||||
)
|
|
||||||
if genre := r_json.get("genre"):
|
if genre := r_json.get("genre"):
|
||||||
genre = "".join(
|
genre = "".join(
|
||||||
f"{GENRES_EMOJI[i]} #{i.replace('-', '_').replace(' ', '_')}, "
|
f"{GENRES_EMOJI[i]} #{i.replace('-', '_').replace(' ', '_')}, "
|
||||||
|
|
@ -461,19 +475,26 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
||||||
)
|
)
|
||||||
res_str += f"<b>Penulis:</b> {creator[:-2]}\n"
|
res_str += f"<b>Penulis:</b> {creator[:-2]}\n"
|
||||||
if actors := r_json.get("actor"):
|
if actors := r_json.get("actor"):
|
||||||
actor = "".join(f"<a href='{i['url']}'>{i['name']}</a>, " for i in actors)
|
actor = "".join(
|
||||||
|
f"<a href='{i['url']}'>{i['name']}</a>, " for i in actors
|
||||||
|
)
|
||||||
res_str += f"<b>Pemeran:</b> {actor[:-2]}\n\n"
|
res_str += f"<b>Pemeran:</b> {actor[:-2]}\n\n"
|
||||||
if deskripsi := r_json.get("description"):
|
if deskripsi := r_json.get("description"):
|
||||||
summary = GoogleTranslator("auto", "id").translate(deskripsi)
|
summary = GoogleTranslator("auto", "id").translate(deskripsi)
|
||||||
res_str += f"<b>📜 Plot:</b>\n<blockquote><code>{summary}</code></blockquote>\n\n"
|
res_str += f"<b>📜 Plot:</b>\n<blockquote><code>{summary}</code></blockquote>\n\n"
|
||||||
if keywd := r_json.get("keywords"):
|
if keywd := r_json.get("keywords"):
|
||||||
key_ = "".join(
|
key_ = "".join(
|
||||||
f"#{i.replace(' ', '_').replace('-', '_')}, " for i in keywd.split(",")
|
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
||||||
|
for i in keywd.split(",")
|
||||||
|
)
|
||||||
|
res_str += (
|
||||||
|
f"<b>🔥 Kata Kunci:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
||||||
)
|
)
|
||||||
res_str += f"<b>🔥 Kata Kunci:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
|
||||||
if award := sop.select('li[data-testid="award_information"]'):
|
if award := sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
award[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
award[0]
|
||||||
|
.find(class_="ipc-metadata-list-item__list-content-item")
|
||||||
|
.text
|
||||||
)
|
)
|
||||||
res_str += f"<b>🏆 Penghargaan:</b>\n<blockquote><code>{GoogleTranslator('auto', 'id').translate(awards)}</code></blockquote>\n"
|
res_str += f"<b>🏆 Penghargaan:</b>\n<blockquote><code>{GoogleTranslator('auto', 'id').translate(awards)}</code></blockquote>\n"
|
||||||
else:
|
else:
|
||||||
|
|
@ -521,15 +542,21 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
||||||
res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup
|
res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup
|
||||||
)
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
LOGGER.error(f"Terjadi error saat menampilkan data IMDB. ERROR: {err}")
|
LOGGER.error(
|
||||||
|
f"Terjadi error saat menampilkan data IMDB. ERROR: {err}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
await query.message.edit_caption(
|
await query.message.edit_caption(
|
||||||
res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup
|
res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await query.message.edit_caption(f"HTTP Exception for IMDB Search - <code>{exc}</code>")
|
await query.message.edit_caption(
|
||||||
|
f"HTTP Exception for IMDB Search - <code>{exc}</code>"
|
||||||
|
)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
await query.message.edit_caption("Maaf, gagal mendapatkan info data dari IMDB.")
|
await query.message.edit_caption(
|
||||||
|
"Maaf, gagal mendapatkan info data dari IMDB."
|
||||||
|
)
|
||||||
except (MessageNotModified, MessageIdInvalid):
|
except (MessageNotModified, MessageIdInvalid):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -549,7 +576,9 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
r_json = json.loads(
|
r_json = json.loads(
|
||||||
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||||
)
|
)
|
||||||
ott = await search_jw(r_json.get("alternateName") or r_json.get("name"), "US")
|
ott = await search_jw(
|
||||||
|
r_json.get("alternateName") or r_json.get("name"), "US"
|
||||||
|
)
|
||||||
typee = r_json.get("@type", "")
|
typee = r_json.get("@type", "")
|
||||||
res_str = ""
|
res_str = ""
|
||||||
tahun = (
|
tahun = (
|
||||||
|
|
@ -564,7 +593,9 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if durasi := sop.select('li[data-testid="title-techspec_runtime"]'):
|
if durasi := sop.select('li[data-testid="title-techspec_runtime"]'):
|
||||||
durasi = (
|
durasi = (
|
||||||
durasi[0].find(class_="ipc-metadata-list-item__content-container").text
|
durasi[0]
|
||||||
|
.find(class_="ipc-metadata-list-item__content-container")
|
||||||
|
.text
|
||||||
)
|
)
|
||||||
res_str += f"<b>Duration:</b> <code>{durasi}</code>\n"
|
res_str += f"<b>Duration:</b> <code>{durasi}</code>\n"
|
||||||
if kategori := r_json.get("contentRating"):
|
if kategori := r_json.get("contentRating"):
|
||||||
|
|
@ -582,9 +613,7 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
rilis_url = release[0].find(
|
rilis_url = release[0].find(
|
||||||
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
)["href"]
|
)["href"]
|
||||||
res_str += (
|
res_str += f"<b>Rilis:</b> <a href='https://www.imdb.com{rilis_url}'>{rilis}</a>\n"
|
||||||
f"<b>Rilis:</b> <a href='https://www.imdb.com{rilis_url}'>{rilis}</a>\n"
|
|
||||||
)
|
|
||||||
if genre := r_json.get("genre"):
|
if genre := r_json.get("genre"):
|
||||||
genre = "".join(
|
genre = "".join(
|
||||||
f"{GENRES_EMOJI[i]} #{i.replace('-', '_').replace(' ', '_')}, "
|
f"{GENRES_EMOJI[i]} #{i.replace('-', '_').replace(' ', '_')}, "
|
||||||
|
|
@ -612,7 +641,8 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
res_str += "\n<b>🙎 Cast Info:</b>\n"
|
res_str += "\n<b>🙎 Cast Info:</b>\n"
|
||||||
if r_json.get("director"):
|
if r_json.get("director"):
|
||||||
director = "".join(
|
director = "".join(
|
||||||
f"<a href='{i['url']}'>{i['name']}</a>, " for i in r_json["director"]
|
f"<a href='{i['url']}'>{i['name']}</a>, "
|
||||||
|
for i in r_json["director"]
|
||||||
)
|
)
|
||||||
res_str += f"<b>Director:</b> {director[:-2]}\n"
|
res_str += f"<b>Director:</b> {director[:-2]}\n"
|
||||||
if r_json.get("creator"):
|
if r_json.get("creator"):
|
||||||
|
|
@ -634,10 +664,14 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
||||||
for i in r_json["keywords"].split(",")
|
for i in r_json["keywords"].split(",")
|
||||||
)
|
)
|
||||||
res_str += f"<b>🔥 Keywords:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
res_str += (
|
||||||
|
f"<b>🔥 Keywords:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
||||||
|
)
|
||||||
if award := sop.select('li[data-testid="award_information"]'):
|
if award := sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
award[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
award[0]
|
||||||
|
.find(class_="ipc-metadata-list-item__list-content-item")
|
||||||
|
.text
|
||||||
)
|
)
|
||||||
res_str += f"<b>🏆 Awards:</b>\n<blockquote><code>{awards}</code></blockquote>\n"
|
res_str += f"<b>🏆 Awards:</b>\n<blockquote><code>{awards}</code></blockquote>\n"
|
||||||
else:
|
else:
|
||||||
|
|
@ -691,7 +725,9 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup
|
res_str, parse_mode=enums.ParseMode.HTML, reply_markup=markup
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await query.message.edit_caption(f"HTTP Exception for IMDB Search - <code>{exc}</code>")
|
await query.message.edit_caption(
|
||||||
|
f"HTTP Exception for IMDB Search - <code>{exc}</code>"
|
||||||
|
)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
await query.message.edit_caption("Sorry, failed getting data from IMDB.")
|
await query.message.edit_caption("Sorry, failed getting data from IMDB.")
|
||||||
except (MessageNotModified, MessageIdInvalid):
|
except (MessageNotModified, MessageIdInvalid):
|
||||||
|
|
|
||||||
|
|
@ -117,9 +117,9 @@ async def inline_menu(self, inline_query: InlineQuery):
|
||||||
description="New Calculator",
|
description="New Calculator",
|
||||||
input_message_content=InputTextMessageContent(
|
input_message_content=InputTextMessageContent(
|
||||||
message_text=f"Made by @{self.me.username}",
|
message_text=f"Made by @{self.me.username}",
|
||||||
disable_web_page_preview=True
|
disable_web_page_preview=True,
|
||||||
),
|
),
|
||||||
reply_markup=calc_btn(inline_query.from_user.id)
|
reply_markup=calc_btn(inline_query.from_user.id),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
|
|
@ -130,9 +130,8 @@ async def inline_menu(self, inline_query: InlineQuery):
|
||||||
title="Answer",
|
title="Answer",
|
||||||
description=f"Result: {result}",
|
description=f"Result: {result}",
|
||||||
input_message_content=InputTextMessageContent(
|
input_message_content=InputTextMessageContent(
|
||||||
message_text=f"{data} = {result}",
|
message_text=f"{data} = {result}", disable_web_page_preview=True
|
||||||
disable_web_page_preview=True
|
),
|
||||||
)
|
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
await inline_query.answer(
|
await inline_query.answer(
|
||||||
|
|
@ -731,7 +730,9 @@ async def imdb_inl(_, query):
|
||||||
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
||||||
for i in r_json["keywords"].split(",")
|
for i in r_json["keywords"].split(",")
|
||||||
)
|
)
|
||||||
res_str += f"<b>🔥 Kata Kunci:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
res_str += (
|
||||||
|
f"<b>🔥 Kata Kunci:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
||||||
|
)
|
||||||
if award := sop.select('li[data-testid="award_information"]'):
|
if award := sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
award[0]
|
award[0]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
|
|
@ -178,7 +179,7 @@ async def locks_func(_, message):
|
||||||
chat_id,
|
chat_id,
|
||||||
ChatPermissions(
|
ChatPermissions(
|
||||||
all_perms=True,
|
all_perms=True,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
await message.reply(f"Unlocked Everything in {message.chat.title}")
|
await message.reply(f"Unlocked Everything in {message.chat.title}")
|
||||||
except ChatAdminRequired:
|
except ChatAdminRequired:
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @created 2022-12-01 09:12:27
|
* @created 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
@ -66,7 +67,9 @@ DETAILS
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
link = await post_to_telegraph(False, "MissKaty MediaInfo", f"<code>{body_text}</code>")
|
link = await post_to_telegraph(
|
||||||
|
False, "MissKaty MediaInfo", f"<code>{body_text}</code>"
|
||||||
|
)
|
||||||
markup = InlineKeyboardMarkup(
|
markup = InlineKeyboardMarkup(
|
||||||
[[InlineKeyboardButton(text=strings("viweb"), url=link)]]
|
[[InlineKeyboardButton(text=strings("viweb"), url=link)]]
|
||||||
)
|
)
|
||||||
|
|
@ -76,7 +79,11 @@ DETAILS
|
||||||
out_file.name = "MissKaty_Mediainfo.txt"
|
out_file.name = "MissKaty_Mediainfo.txt"
|
||||||
await ctx.reply_document(
|
await ctx.reply_document(
|
||||||
out_file,
|
out_file,
|
||||||
caption=strings("capt_media").format(ment=ctx.from_user.mention if ctx.from_user else ctx.sender_chat.title),
|
caption=strings("capt_media").format(
|
||||||
|
ment=ctx.from_user.mention
|
||||||
|
if ctx.from_user
|
||||||
|
else ctx.sender_chat.title
|
||||||
|
),
|
||||||
thumb="assets/thumb.jpg",
|
thumb="assets/thumb.jpg",
|
||||||
reply_markup=markup,
|
reply_markup=markup,
|
||||||
)
|
)
|
||||||
|
|
@ -119,7 +126,11 @@ DETAILS
|
||||||
out_file.name = "MissKaty_Mediainfo.txt"
|
out_file.name = "MissKaty_Mediainfo.txt"
|
||||||
await ctx.reply_document(
|
await ctx.reply_document(
|
||||||
out_file,
|
out_file,
|
||||||
caption=strings("capt_media").format(ment=ctx.from_user.mention if ctx.from_user else ctx.sender_chat.title),
|
caption=strings("capt_media").format(
|
||||||
|
ment=ctx.from_user.mention
|
||||||
|
if ctx.from_user
|
||||||
|
else ctx.sender_chat.title
|
||||||
|
),
|
||||||
thumb="assets/thumb.jpg",
|
thumb="assets/thumb.jpg",
|
||||||
reply_markup=markup,
|
reply_markup=markup,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
@ -39,7 +39,7 @@ from pyrogram.types import (
|
||||||
from misskaty import BOT_USERNAME, app
|
from misskaty import BOT_USERNAME, app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.helper.http import fetch
|
from misskaty.helper.http import fetch
|
||||||
from misskaty.helper.tools import rentry, gen_trans_image
|
from misskaty.helper.tools import gen_trans_image, rentry
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
from utils import extract_user, get_file_id
|
from utils import extract_user, get_file_id
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ def calcExpression(text):
|
||||||
except (SyntaxError, ZeroDivisionError):
|
except (SyntaxError, ZeroDivisionError):
|
||||||
return ""
|
return ""
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return float(eval(text.replace('(', '*(')))
|
return float(eval(text.replace("(", "*(")))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOGGER.error(e, exc_info=True)
|
LOGGER.error(e, exc_info=True)
|
||||||
return ""
|
return ""
|
||||||
|
|
@ -129,9 +129,10 @@ async def calculate_handler(self, ctx):
|
||||||
text=f"Made by @{self.me.username}",
|
text=f"Made by @{self.me.username}",
|
||||||
reply_markup=calc_btn(ctx.from_user.id),
|
reply_markup=calc_btn(ctx.from_user.id),
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
quote=True
|
quote=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex("^calc"))
|
@app.on_callback_query(filters.regex("^calc"))
|
||||||
async def calc_cb(self, query):
|
async def calc_cb(self, query):
|
||||||
_, uid, data = query.data.split("|")
|
_, uid, data = query.data.split("|")
|
||||||
|
|
@ -139,7 +140,7 @@ async def calc_cb(self, query):
|
||||||
return await query.answer("Who are you??", show_alert=True, cache_time=5)
|
return await query.answer("Who are you??", show_alert=True, cache_time=5)
|
||||||
try:
|
try:
|
||||||
text = query.message.text.split("\n")[0].strip().split("=")[0].strip()
|
text = query.message.text.split("\n")[0].strip().split("=")[0].strip()
|
||||||
text = '' if f"Made by @{self.me.username}" in text else text
|
text = "" if f"Made by @{self.me.username}" in text else text
|
||||||
inpt = text + query.data
|
inpt = text + query.data
|
||||||
result = ""
|
result = ""
|
||||||
if data == "=":
|
if data == "=":
|
||||||
|
|
@ -167,7 +168,7 @@ async def calc_cb(self, query):
|
||||||
await query.message.edit_msg(
|
await query.message.edit_msg(
|
||||||
text=text,
|
text=text,
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
reply_markup=calc_btn(query.from_user.id)
|
reply_markup=calc_btn(query.from_user.id),
|
||||||
)
|
)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
LOGGER.error(error)
|
LOGGER.error(error)
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from attr import Attribute
|
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from apscheduler.jobstores.base import ConflictingIdError
|
from apscheduler.jobstores.base import ConflictingIdError
|
||||||
|
from attr import Attribute
|
||||||
from pyrogram import __version__, filters
|
from pyrogram import __version__, filters
|
||||||
from pyrogram.errors import (
|
from pyrogram.errors import (
|
||||||
ChannelInvalid,
|
ChannelInvalid,
|
||||||
|
|
@ -17,7 +17,7 @@ from pyrogram.errors import (
|
||||||
ChatNotModified,
|
ChatNotModified,
|
||||||
ChatRestricted,
|
ChatRestricted,
|
||||||
PeerIdInvalid,
|
PeerIdInvalid,
|
||||||
QueryIdInvalid
|
QueryIdInvalid,
|
||||||
)
|
)
|
||||||
from pyrogram.types import ChatPermissions, InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import ChatPermissions, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
@ -241,7 +241,7 @@ async def nightmode_handler(self, msg, strings):
|
||||||
can_send_roundvideos=msg.chat.permissions.can_send_roundvideos,
|
can_send_roundvideos=msg.chat.permissions.can_send_roundvideos,
|
||||||
can_send_stickers=msg.chat.permissions.can_send_stickers,
|
can_send_stickers=msg.chat.permissions.can_send_stickers,
|
||||||
can_send_videos=msg.chat.permissions.can_send_videos,
|
can_send_videos=msg.chat.permissions.can_send_videos,
|
||||||
can_send_voices=msg.chat.permissions.can_send_voices
|
can_send_voices=msg.chat.permissions.can_send_voices,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
# schedule to enable nightmode
|
# schedule to enable nightmode
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,25 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from re import findall
|
from re import findall
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
||||||
from database.notes_db import delete_note, get_note, get_note_names, save_note, deleteall_notes
|
from database.notes_db import (
|
||||||
|
delete_note,
|
||||||
|
deleteall_notes,
|
||||||
|
get_note,
|
||||||
|
get_note_names,
|
||||||
|
save_note,
|
||||||
|
)
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.core.decorator.permissions import adminsOnly, member_permissions
|
from misskaty.core.decorator.permissions import adminsOnly, member_permissions
|
||||||
from misskaty.core.keyboard import ikb
|
from misskaty.core.keyboard import ikb
|
||||||
from misskaty.helper.functions import extract_text_and_keyb, extract_urls
|
from misskaty.helper.functions import extract_text_and_keyb, extract_urls
|
||||||
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
||||||
__MODULE__ = "Notes"
|
__MODULE__ = "Notes"
|
||||||
__HELP__ = """/notes To Get All The Notes In The Chat.
|
__HELP__ = """/notes To Get All The Notes In The Chat.
|
||||||
|
|
@ -51,12 +57,16 @@ To change caption of any files use.\n/save [NOTE_NAME] or /addnote [NOTE_NAME] [
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["addnote", "save"], COMMAND_HANDLER) & ~filters.private)
|
@app.on_message(
|
||||||
|
filters.command(["addnote", "save"], COMMAND_HANDLER) & ~filters.private
|
||||||
|
)
|
||||||
@adminsOnly("can_change_info")
|
@adminsOnly("can_change_info")
|
||||||
async def save_notee(_, message):
|
async def save_notee(_, 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:
|
||||||
await message.reply_msg("**Usage:**\nReply to a message with /save [NOTE_NAME] to save a new note.")
|
await message.reply_msg(
|
||||||
|
"**Usage:**\nReply to a message with /save [NOTE_NAME] to save a new note."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
text = message.text.markdown
|
text = message.text.markdown
|
||||||
name = text.split(None, 1)[1].strip()
|
name = text.split(None, 1)[1].strip()
|
||||||
|
|
@ -74,7 +84,11 @@ async def save_notee(_, message):
|
||||||
elif not replied_message.text and not replied_message.caption:
|
elif not replied_message.text and not replied_message.caption:
|
||||||
data = None
|
data = None
|
||||||
else:
|
else:
|
||||||
data = replied_message.text.markdown if replied_message.text else replied_message.caption.markdown
|
data = (
|
||||||
|
replied_message.text.markdown
|
||||||
|
if replied_message.text
|
||||||
|
else replied_message.caption.markdown
|
||||||
|
)
|
||||||
if replied_message.text:
|
if replied_message.text:
|
||||||
_type = "text"
|
_type = "text"
|
||||||
file_id = None
|
file_id = None
|
||||||
|
|
@ -104,7 +118,9 @@ async def save_notee(_, message):
|
||||||
file_id = replied_message.voice.file_id
|
file_id = replied_message.voice.file_id
|
||||||
if replied_message.reply_markup and "~" not in data:
|
if replied_message.reply_markup and "~" not in data:
|
||||||
if urls := extract_urls(replied_message.reply_markup):
|
if urls := extract_urls(replied_message.reply_markup):
|
||||||
response = "\n".join([f"{name}=[{text}, {url}]" for name, text, url in urls])
|
response = "\n".join(
|
||||||
|
[f"{name}=[{text}, {url}]" for name, text, url in urls]
|
||||||
|
)
|
||||||
data = data + response
|
data = data + response
|
||||||
note = {
|
note = {
|
||||||
"type": _type,
|
"type": _type,
|
||||||
|
|
@ -116,7 +132,9 @@ async def save_notee(_, message):
|
||||||
await save_note(chat_id, name, note)
|
await save_note(chat_id, name, note)
|
||||||
await message.reply_msg(f"__**Saved note {name}.**__")
|
await message.reply_msg(f"__**Saved note {name}.**__")
|
||||||
except UnboundLocalError:
|
except UnboundLocalError:
|
||||||
return await message.reply_text("**Replied message is inaccessible.\n`Forward the message and try again`**")
|
return await message.reply_text(
|
||||||
|
"**Replied message is inaccessible.\n`Forward the message and try again`**"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("notes", COMMAND_HANDLER) & ~filters.private)
|
@app.on_message(filters.command("notes", COMMAND_HANDLER) & ~filters.private)
|
||||||
|
|
@ -206,7 +224,9 @@ async def get_one_note(self, message):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["delnote", "clear"], COMMAND_HANDLER) & ~filters.private)
|
@app.on_message(
|
||||||
|
filters.command(["delnote", "clear"], COMMAND_HANDLER) & ~filters.private
|
||||||
|
)
|
||||||
@adminsOnly("can_change_info")
|
@adminsOnly("can_change_info")
|
||||||
async def del_note(_, message):
|
async def del_note(_, message):
|
||||||
if len(message.command) < 2:
|
if len(message.command) < 2:
|
||||||
|
|
@ -233,12 +253,16 @@ async def delete_all(_, message):
|
||||||
return await message.reply_text("**No notes in this chat.**")
|
return await message.reply_text("**No notes in this chat.**")
|
||||||
keyboard = InlineKeyboardMarkup(
|
keyboard = InlineKeyboardMarkup(
|
||||||
[
|
[
|
||||||
[InlineKeyboardButton("YES, DO IT", callback_data="delete_yes"),
|
[
|
||||||
InlineKeyboardButton("Cancel", callback_data="delete_no")
|
InlineKeyboardButton("YES, DO IT", callback_data="delete_yes"),
|
||||||
|
InlineKeyboardButton("Cancel", callback_data="delete_no"),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
await message.reply_text("**Are you sure you want to delete all the notes in this chat forever ?.**", reply_markup=keyboard)
|
await message.reply_text(
|
||||||
|
"**Are you sure you want to delete all the notes in this chat forever ?.**",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex("delete_(.*)"))
|
@app.on_callback_query(filters.regex("delete_(.*)"))
|
||||||
|
|
@ -248,9 +272,14 @@ async def delete_all_cb(_, cb):
|
||||||
permissions = await member_permissions(chat_id, from_user.id)
|
permissions = await member_permissions(chat_id, from_user.id)
|
||||||
permission = "can_change_info"
|
permission = "can_change_info"
|
||||||
if permission not in permissions:
|
if permission not in permissions:
|
||||||
return await cb.answer(f"You don't have the required permission.\n Permission: {permission}", show_alert=True)
|
return await cb.answer(
|
||||||
|
f"You don't have the required permission.\n Permission: {permission}",
|
||||||
|
show_alert=True,
|
||||||
|
)
|
||||||
input = cb.data.split("_", 1)[1]
|
input = cb.data.split("_", 1)[1]
|
||||||
if input == "yes":
|
if input == "yes":
|
||||||
stoped_all = await deleteall_notes(chat_id)
|
stoped_all = await deleteall_notes(chat_id)
|
||||||
if stoped_all:
|
if stoped_all:
|
||||||
return await cb.message.edit("**Successfully deleted all notes on this chat.**")
|
return await cb.message.edit(
|
||||||
|
"**Successfully deleted all notes on this chat.**"
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author Yasir Aris M <yasiramunandar@gmail.com>
|
* @author Yasir Aris M <yasiramunandar@gmail.com>
|
||||||
* @created 2022-12-01 09:12:27
|
* @created 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from json import loads as json_loads
|
from json import loads as json_loads
|
||||||
from os import remove
|
from os import remove
|
||||||
from re import compile as compiles
|
from re import compile as compiles
|
||||||
|
|
@ -214,7 +215,9 @@ async def wastepaste(_, message):
|
||||||
"expire_at": 0,
|
"expire_at": 0,
|
||||||
"expire_in": 0,
|
"expire_in": 0,
|
||||||
}
|
}
|
||||||
response = await fetch.post("https://paste.yasir.eu.org/api/new", json=json_data)
|
response = await fetch.post(
|
||||||
|
"https://paste.yasir.eu.org/api/new", json=json_data
|
||||||
|
)
|
||||||
url = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
url = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return await msg.edit_msg(f"ERROR: {e}")
|
return await msg.edit_msg(f"ERROR: {e}")
|
||||||
|
|
@ -282,7 +285,9 @@ async def nekopaste(_, message):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
x = (
|
x = (
|
||||||
await fetch.post("https://nekobin.com/api/documents", json={"content": data})
|
await fetch.post(
|
||||||
|
"https://nekobin.com/api/documents", json={"content": data}
|
||||||
|
)
|
||||||
).json()
|
).json()
|
||||||
url = f"https://nekobin.com/{x['result']['key']}"
|
url = f"https://nekobin.com/{x['result']['key']}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import time
|
import time
|
||||||
from asyncio import Lock
|
from asyncio import Lock
|
||||||
|
|
@ -18,9 +19,9 @@ from misskaty import app, botStartTime, misskaty_version
|
||||||
from misskaty.helper.human_read import get_readable_time
|
from misskaty.helper.human_read import get_readable_time
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
||||||
|
|
||||||
PING_LOCK = Lock()
|
PING_LOCK = Lock()
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["ping"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["ping"], COMMAND_HANDLER))
|
||||||
async def ping(_, ctx: Message):
|
async def ping(_, ctx: Message):
|
||||||
currentTime = get_readable_time(time.time() - botStartTime)
|
currentTime = get_readable_time(time.time() - botStartTime)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2023-01-23 19:41:27
|
* @date 2023-01-23 19:41:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pykeyboard import InlineButton, InlineKeyboard
|
from pykeyboard import InlineButton, InlineKeyboard
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.errors import MessageTooLong, QueryIdInvalid
|
from pyrogram.errors import MessageTooLong, QueryIdInvalid
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ __HELP__ = """
|
||||||
/genstring - Generate string session using this bot. Only support Pyrogram v2 and Telethon.
|
/genstring - Generate string session using this bot. Only support Pyrogram v2 and Telethon.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
ask_ques = "**» Please choose the library for which you want generate string :**\n\nNote: I'm not collecting any personal info from this feature, you can deploy own bot if you want."
|
ask_ques = "**» Please choose the library for which you want generate string :**\n\nNote: I'm not collecting any personal info from this feature, you can deploy own bot if you want."
|
||||||
buttons_ques = [
|
buttons_ques = [
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
|
|
@ -20,7 +21,6 @@ from misskaty.helper import bot_sys_stats, paginate_modules
|
||||||
from misskaty.helper.localization import use_chat_lang
|
from misskaty.helper.localization import use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
||||||
|
|
||||||
home_keyboard_pm = InlineKeyboardMarkup(
|
home_keyboard_pm = InlineKeyboardMarkup(
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|
@ -104,13 +104,17 @@ async def start(self, ctx: Message, strings):
|
||||||
strings("help_name").format(mod=HELPABLE[module].__MODULE__)
|
strings("help_name").format(mod=HELPABLE[module].__MODULE__)
|
||||||
+ HELPABLE[module].__HELP__
|
+ HELPABLE[module].__HELP__
|
||||||
)
|
)
|
||||||
await ctx.reply_msg(text, disable_web_page_preview=True, message_effect_id=5104841245755180586)
|
await ctx.reply_msg(
|
||||||
|
text,
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
message_effect_id=5104841245755180586,
|
||||||
|
)
|
||||||
if module == "federation":
|
if module == "federation":
|
||||||
return await ctx.reply(
|
return await ctx.reply(
|
||||||
text=text,
|
text=text,
|
||||||
reply_markup=FED_MARKUP,
|
reply_markup=FED_MARKUP,
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
message_effect_id=5104841245755180586
|
message_effect_id=5104841245755180586,
|
||||||
)
|
)
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
text,
|
text,
|
||||||
|
|
@ -118,13 +122,12 @@ async def start(self, ctx: Message, strings):
|
||||||
[[InlineKeyboardButton("back", callback_data="help_back")]]
|
[[InlineKeyboardButton("back", callback_data="help_back")]]
|
||||||
),
|
),
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
message_effect_id=5104841245755180586)
|
message_effect_id=5104841245755180586,
|
||||||
|
)
|
||||||
elif name == "help":
|
elif name == "help":
|
||||||
text, keyb = await help_parser(ctx.from_user.first_name)
|
text, keyb = await help_parser(ctx.from_user.first_name)
|
||||||
await ctx.reply_msg(
|
await ctx.reply_msg(
|
||||||
text,
|
text, reply_markup=keyb, message_effect_id=5104841245755180586
|
||||||
reply_markup=keyb,
|
|
||||||
message_effect_id=5104841245755180586
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await self.send_photo(
|
await self.send_photo(
|
||||||
|
|
@ -133,7 +136,7 @@ async def start(self, ctx: Message, strings):
|
||||||
caption=home_text_pm,
|
caption=home_text_pm,
|
||||||
reply_markup=home_keyboard_pm,
|
reply_markup=home_keyboard_pm,
|
||||||
reply_to_message_id=ctx.id,
|
reply_to_message_id=ctx.id,
|
||||||
message_effect_id=5104841245755180586
|
message_effect_id=5104841245755180586,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,7 +147,7 @@ async def commands_callbacc(_, cb: CallbackQuery):
|
||||||
cb.message.chat.id,
|
cb.message.chat.id,
|
||||||
text=text,
|
text=text,
|
||||||
reply_markup=keyb,
|
reply_markup=keyb,
|
||||||
message_effect_id=5104841245755180586
|
message_effect_id=5104841245755180586,
|
||||||
)
|
)
|
||||||
await cb.message.delete_msg()
|
await cb.message.delete_msg()
|
||||||
|
|
||||||
|
|
@ -187,19 +190,26 @@ async def help_command(_, ctx: Message, strings):
|
||||||
strings("help_name").format(mod=HELPABLE[name].__MODULE__)
|
strings("help_name").format(mod=HELPABLE[name].__MODULE__)
|
||||||
+ HELPABLE[name].__HELP__
|
+ HELPABLE[name].__HELP__
|
||||||
)
|
)
|
||||||
await ctx.reply_msg(text, disable_web_page_preview=True, message_effect_id=5104841245755180586)
|
await ctx.reply_msg(
|
||||||
|
text,
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
message_effect_id=5104841245755180586,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
text, help_keyboard = await help_parser(ctx.from_user.first_name)
|
text, help_keyboard = await help_parser(ctx.from_user.first_name)
|
||||||
await ctx.reply_msg(
|
await ctx.reply_msg(
|
||||||
text,
|
text,
|
||||||
reply_markup=help_keyboard,
|
reply_markup=help_keyboard,
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
message_effect_id=5104841245755180586
|
message_effect_id=5104841245755180586,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
text, help_keyboard = await help_parser(ctx.from_user.first_name)
|
text, help_keyboard = await help_parser(ctx.from_user.first_name)
|
||||||
await ctx.reply_msg(
|
await ctx.reply_msg(
|
||||||
text, reply_markup=help_keyboard, disable_web_page_preview=True, message_effect_id=5104841245755180586
|
text,
|
||||||
|
reply_markup=help_keyboard,
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
message_effect_id=5104841245755180586,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ async def kang_sticker(self: Client, ctx: Message, strings):
|
||||||
),
|
),
|
||||||
emoji=sticker_emoji,
|
emoji=sticker_emoji,
|
||||||
)
|
)
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except PeerIdInvalid:
|
except PeerIdInvalid:
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @date 2022-12-01 09:12:27
|
* @date 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Code in this plugin to learn basic userbot in pyrogram
|
# Code in this plugin to learn basic userbot in pyrogram
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
"""
|
"""
|
||||||
* @author yasir <yasiramunandar@gmail.com>
|
* @author yasir <yasiramunandar@gmail.com>
|
||||||
* @created 2022-12-01 09:12:27
|
* @created 2022-12-01 09:12:27
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import httpx
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import cloudscraper
|
import cloudscraper
|
||||||
|
import httpx
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from cachetools import TTLCache
|
from cachetools import TTLCache
|
||||||
from pykeyboard import InlineButton, InlineKeyboard
|
from pykeyboard import InlineButton, InlineKeyboard
|
||||||
|
|
@ -20,7 +21,7 @@ from pyrogram.types import Message
|
||||||
|
|
||||||
from database import dbname
|
from database import dbname
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.helper import Cache, Kusonime, fetch, use_chat_lang, post_to_telegraph
|
from misskaty.helper import Cache, Kusonime, fetch, post_to_telegraph, use_chat_lang
|
||||||
|
|
||||||
__MODULE__ = "WebScraper"
|
__MODULE__ = "WebScraper"
|
||||||
__HELP__ = """
|
__HELP__ = """
|
||||||
|
|
@ -76,28 +77,28 @@ async def getDataTerbit21(msg, kueri, CurrentPage, strings):
|
||||||
with contextlib.redirect_stdout(sys.stderr):
|
with contextlib.redirect_stdout(sys.stderr):
|
||||||
try:
|
try:
|
||||||
if kueri:
|
if kueri:
|
||||||
terbitjson = await fetch.get(f"{web['yasirapi']}/terbit21?q={kueri}")
|
terbitjson = await fetch.get(
|
||||||
|
f"{web['yasirapi']}/terbit21?q={kueri}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
terbitjson = await fetch.get(f"{web['yasirapi']}/terbit21")
|
terbitjson = await fetch.get(f"{web['yasirapi']}/terbit21")
|
||||||
terbitjson.raise_for_status()
|
terbitjson.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>")
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>"
|
||||||
|
)
|
||||||
return None, None
|
return None, None
|
||||||
res = terbitjson.json()
|
res = terbitjson.json()
|
||||||
if not res.get("result"):
|
if not res.get("result"):
|
||||||
await msg.edit_msg(strings("no_result"), del_in=5)
|
await msg.edit_msg(strings("no_result"), del_in=5)
|
||||||
return None, None
|
return None, None
|
||||||
SCRAP_DICT.add(
|
SCRAP_DICT.add(msg.id, [split_arr(res["result"], 6), kueri], timeout=1800)
|
||||||
msg.id, [split_arr(res["result"], 6), kueri], timeout=1800
|
|
||||||
)
|
|
||||||
index = int(CurrentPage - 1)
|
index = int(CurrentPage - 1)
|
||||||
PageLen = len(SCRAP_DICT[msg.id][0])
|
PageLen = len(SCRAP_DICT[msg.id][0])
|
||||||
if kueri:
|
if kueri:
|
||||||
TerbitRes = strings("header_with_query").format(web="Terbit21", kueri=kueri)
|
TerbitRes = strings("header_with_query").format(web="Terbit21", kueri=kueri)
|
||||||
else:
|
else:
|
||||||
TerbitRes = strings("header_no_query").format(
|
TerbitRes = strings("header_no_query").format(web="Terbit21", cmd="terbit21")
|
||||||
web="Terbit21", cmd="terbit21"
|
|
||||||
)
|
|
||||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||||
TerbitRes += f"<b>{index*6+c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>{strings('cat_text')}:</b> <code>{i['kategori']}</code>\n"
|
TerbitRes += f"<b>{index*6+c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>{strings('cat_text')}:</b> <code>{i['kategori']}</code>\n"
|
||||||
TerbitRes += (
|
TerbitRes += (
|
||||||
|
|
@ -119,7 +120,9 @@ async def getDatalk21(msg, kueri, CurrentPage, strings):
|
||||||
lk21json = await fetch.get(f"{web['yasirapi']}/lk21")
|
lk21json = await fetch.get(f"{web['yasirapi']}/lk21")
|
||||||
lk21json.raise_for_status()
|
lk21json.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>")
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>"
|
||||||
|
)
|
||||||
return None, None
|
return None, None
|
||||||
res = lk21json.json()
|
res = lk21json.json()
|
||||||
if not res.get("result"):
|
if not res.get("result"):
|
||||||
|
|
@ -129,9 +132,7 @@ async def getDatalk21(msg, kueri, CurrentPage, strings):
|
||||||
index = int(CurrentPage - 1)
|
index = int(CurrentPage - 1)
|
||||||
PageLen = len(SCRAP_DICT[msg.id][0])
|
PageLen = len(SCRAP_DICT[msg.id][0])
|
||||||
if kueri:
|
if kueri:
|
||||||
lkResult = strings("header_with_query").format(
|
lkResult = strings("header_with_query").format(web="Layarkaca21", kueri=kueri)
|
||||||
web="Layarkaca21", kueri=kueri
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
lkResult = strings("header_no_query").format(web="Layarkaca21", cmd="lk21")
|
lkResult = strings("header_no_query").format(web="Layarkaca21", cmd="lk21")
|
||||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||||
|
|
@ -150,12 +151,18 @@ async def getDataPahe(msg, kueri, CurrentPage, strings):
|
||||||
with contextlib.redirect_stdout(sys.stderr):
|
with contextlib.redirect_stdout(sys.stderr):
|
||||||
try:
|
try:
|
||||||
if kueri:
|
if kueri:
|
||||||
pahejson = await fetch.get(f"{web['yasirapi']}/pahe?q={kueri}&domain={web['pahe']}")
|
pahejson = await fetch.get(
|
||||||
|
f"{web['yasirapi']}/pahe?q={kueri}&domain={web['pahe']}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
pahejson = await fetch.get(f"{web['yasirapi']}/pahe?domain={web['pahe']}")
|
pahejson = await fetch.get(
|
||||||
|
f"{web['yasirapi']}/pahe?domain={web['pahe']}"
|
||||||
|
)
|
||||||
pahejson.raise_for_status()
|
pahejson.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>")
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>"
|
||||||
|
)
|
||||||
return None, None
|
return None, None
|
||||||
res = pahejson.json()
|
res = pahejson.json()
|
||||||
if not res.get("result"):
|
if not res.get("result"):
|
||||||
|
|
@ -170,9 +177,7 @@ async def getDataPahe(msg, kueri, CurrentPage, strings):
|
||||||
else strings("header_no_query").format(web="Pahe", cmd="pahe")
|
else strings("header_no_query").format(web="Pahe", cmd="pahe")
|
||||||
)
|
)
|
||||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||||
paheResult += (
|
paheResult += f"<b>{index*6+c}. <a href='{i['link']}'>{i['judul']}</a></b>\n\n"
|
||||||
f"<b>{index*6+c}. <a href='{i['link']}'>{i['judul']}</a></b>\n\n"
|
|
||||||
)
|
|
||||||
return paheResult, PageLen
|
return paheResult, PageLen
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -187,7 +192,10 @@ async def getDataKuso(msg, kueri, CurrentPage, user, strings):
|
||||||
)
|
)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>", disable_web_page_preview=True)
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>",
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
)
|
||||||
return None, 0, None, None
|
return None, 0, None, None
|
||||||
res = BeautifulSoup(data, "lxml").find_all("h2", {"class": "episodeye"})
|
res = BeautifulSoup(data, "lxml").find_all("h2", {"class": "episodeye"})
|
||||||
for i in res:
|
for i in res:
|
||||||
|
|
@ -237,7 +245,9 @@ async def getDataMovieku(msg, kueri, CurrentPage, strings):
|
||||||
)
|
)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>")
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>"
|
||||||
|
)
|
||||||
return None, None
|
return None, None
|
||||||
r = BeautifulSoup(data, "lxml")
|
r = BeautifulSoup(data, "lxml")
|
||||||
res = r.find_all(class_="bx")
|
res = r.find_all(class_="bx")
|
||||||
|
|
@ -271,11 +281,15 @@ async def getDataNodrakor(msg, kueri, CurrentPage, user, strings):
|
||||||
with contextlib.redirect_stdout(sys.stderr):
|
with contextlib.redirect_stdout(sys.stderr):
|
||||||
try:
|
try:
|
||||||
data = await fetch.get(
|
data = await fetch.get(
|
||||||
f"{web['nodrakor']}/?s={kueri}", follow_redirects=True,
|
f"{web['nodrakor']}/?s={kueri}",
|
||||||
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", disable_web_page_preview=True)
|
await msg.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
)
|
||||||
return None, 0, None
|
return None, 0, None
|
||||||
text = BeautifulSoup(data, "lxml")
|
text = BeautifulSoup(data, "lxml")
|
||||||
entry = text.find_all(class_="entry-header")
|
entry = text.find_all(class_="entry-header")
|
||||||
|
|
@ -319,11 +333,15 @@ async def getDataSavefilm21(msg, kueri, CurrentPage, user, strings):
|
||||||
with contextlib.redirect_stdout(sys.stderr):
|
with contextlib.redirect_stdout(sys.stderr):
|
||||||
try:
|
try:
|
||||||
data = await fetch.get(
|
data = await fetch.get(
|
||||||
f"{web['savefilm21']}/?s={kueri}", follow_redirects=True,
|
f"{web['savefilm21']}/?s={kueri}",
|
||||||
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", disable_web_page_preview=True)
|
await msg.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
)
|
||||||
return None, 0, None
|
return None, 0, None
|
||||||
text = BeautifulSoup(data, "lxml")
|
text = BeautifulSoup(data, "lxml")
|
||||||
entry = text.find_all(class_="entry-header")
|
entry = text.find_all(class_="entry-header")
|
||||||
|
|
@ -367,13 +385,17 @@ async def getDataLendrive(msg, kueri, CurrentPage, user, strings):
|
||||||
try:
|
try:
|
||||||
if kueri:
|
if kueri:
|
||||||
data = await fetch.get(
|
data = await fetch.get(
|
||||||
f"{web['lendrive']}/?s={kueri}", follow_redirects=True,
|
f"{web['lendrive']}/?s={kueri}",
|
||||||
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
data = await fetch.get(web["lendrive"], follow_redirects=True)
|
data = await fetch.get(web["lendrive"], follow_redirects=True)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>", disable_web_page_preview=True)
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>",
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
)
|
||||||
return None, 0, None
|
return None, 0, None
|
||||||
res = BeautifulSoup(data, "lxml")
|
res = BeautifulSoup(data, "lxml")
|
||||||
lenddata = []
|
lenddata = []
|
||||||
|
|
@ -391,7 +413,12 @@ async def getDataLendrive(msg, kueri, CurrentPage, user, strings):
|
||||||
else o.find(class_="typez BD")
|
else o.find(class_="typez BD")
|
||||||
)
|
)
|
||||||
lenddata.append(
|
lenddata.append(
|
||||||
{"judul": title, "link": link, "quality": kualitas or "N/A", "status": status}
|
{
|
||||||
|
"judul": title,
|
||||||
|
"link": link,
|
||||||
|
"quality": kualitas or "N/A",
|
||||||
|
"status": status,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
if not lenddata:
|
if not lenddata:
|
||||||
await msg.edit_msg(strings("no_result"), del_in=5)
|
await msg.edit_msg(strings("no_result"), del_in=5)
|
||||||
|
|
@ -422,11 +449,15 @@ async def getDataMelong(msg, kueri, CurrentPage, user, strings):
|
||||||
with contextlib.redirect_stdout(sys.stderr):
|
with contextlib.redirect_stdout(sys.stderr):
|
||||||
try:
|
try:
|
||||||
data = await fetch.get(
|
data = await fetch.get(
|
||||||
f"{web['melongmovie']}/?s={kueri}", follow_redirects=True,
|
f"{web['melongmovie']}/?s={kueri}",
|
||||||
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", disable_web_page_preview=True)
|
await msg.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
)
|
||||||
return None, 0, None
|
return None, 0, None
|
||||||
bs4 = BeautifulSoup(data, "lxml")
|
bs4 = BeautifulSoup(data, "lxml")
|
||||||
melongdata = []
|
melongdata = []
|
||||||
|
|
@ -472,7 +503,10 @@ async def getDataGomov(msg, kueri, CurrentPage, user, strings):
|
||||||
)
|
)
|
||||||
gomovv.raise_for_status()
|
gomovv.raise_for_status()
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await msg.edit_msg(f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>", disable_web_page_preview=True)
|
await msg.edit_msg(
|
||||||
|
f"ERROR: Failed to fetch data from {exc.request.url} - <code>{exc}</code>",
|
||||||
|
disable_web_page_preview=True,
|
||||||
|
)
|
||||||
return None, 0, None
|
return None, 0, None
|
||||||
text = BeautifulSoup(gomovv, "lxml")
|
text = BeautifulSoup(gomovv, "lxml")
|
||||||
entry = text.find_all(class_="entry-header")
|
entry = text.find_all(class_="entry-header")
|
||||||
|
|
@ -543,8 +577,8 @@ async def getSame(msg, query, current_page, strings):
|
||||||
PageLen = len(savedict[msg.id][0])
|
PageLen = len(savedict[msg.id][0])
|
||||||
sameresult = "".join(
|
sameresult = "".join(
|
||||||
f"<b>{index * 6 + c}. <a href='{i['url']}'>{i['title']}</a>\n<b>Status:</b> {i['sta']}\n</b>Rating:</b> {i['rate']}\n\n"
|
f"<b>{index * 6 + c}. <a href='{i['url']}'>{i['title']}</a>\n<b>Status:</b> {i['sta']}\n</b>Rating:</b> {i['rate']}\n\n"
|
||||||
for c, i in enumerate(savedict[msg.id][0][index], start=1)
|
for c, i in enumerate(savedict[msg.id][0][index], start=1)
|
||||||
)
|
)
|
||||||
return sameresult, PageLen
|
return sameresult, PageLen
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -634,7 +668,7 @@ async def pahe_s(_, message, strings):
|
||||||
|
|
||||||
|
|
||||||
# Gomov CMD
|
# Gomov CMD
|
||||||
@app.on_cmd(["gomov","klikxxi"], no_channel=True)
|
@app.on_cmd(["gomov", "klikxxi"], no_channel=True)
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def gomov_s(self, message, strings):
|
async def gomov_s(self, message, strings):
|
||||||
kueri = " ".join(message.command[1:])
|
kueri = " ".join(message.command[1:])
|
||||||
|
|
@ -1287,7 +1321,9 @@ async def kusonime_scrap(client, callback_query, strings):
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
if init_url := data_kuso.get(link, False):
|
if init_url := data_kuso.get(link, False):
|
||||||
await callback_query.message.edit_msg(init_url.get("ph_url"), reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
init_url.get("ph_url"), reply_markup=keyboard
|
||||||
|
)
|
||||||
tgh = await kuso.telegraph(link, client.me.username)
|
tgh = await kuso.telegraph(link, client.me.username)
|
||||||
data_kuso[link] = {"ph_url": tgh}
|
data_kuso[link] = {"ph_url": tgh}
|
||||||
return await callback_query.message.edit_msg(tgh, reply_markup=keyboard)
|
return await callback_query.message.edit_msg(tgh, reply_markup=keyboard)
|
||||||
|
|
@ -1332,9 +1368,14 @@ async def savefilm21_scrap(_, callback_query, strings):
|
||||||
strings("res_scrape").format(link=link, kl=res), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=res), reply_markup=keyboard
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await callback_query.message.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
await callback_query.message.edit_msg(f"ERROR: {err}", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"ERROR: {err}", reply_markup=keyboard
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# NoDrakor DDL
|
# NoDrakor DDL
|
||||||
|
|
@ -1367,26 +1408,35 @@ async def nodrakorddl_scrap(_, callback_query, strings):
|
||||||
html.raise_for_status()
|
html.raise_for_status()
|
||||||
soup = BeautifulSoup(html.text, "lxml")
|
soup = BeautifulSoup(html.text, "lxml")
|
||||||
if "/tv/" in link:
|
if "/tv/" in link:
|
||||||
result = soup.find("div", {"entry-content entry-content-single"}).find_all("p")
|
result = soup.find(
|
||||||
|
"div", {"entry-content entry-content-single"}
|
||||||
|
).find_all("p")
|
||||||
msg = "".join(str(f"{i}\n") for i in result)
|
msg = "".join(str(f"{i}\n") for i in result)
|
||||||
link = await post_to_telegraph(False, "MissKaty NoDrakor", msg)
|
link = await post_to_telegraph(False, "MissKaty NoDrakor", msg)
|
||||||
return await callback_query.message.edit_msg(
|
return await callback_query.message.edit_msg(
|
||||||
strings("res_scrape").format(link=link, kl=link), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=link),
|
||||||
|
reply_markup=keyboard,
|
||||||
)
|
)
|
||||||
res = soup.find_all(class_="button button-shadow")
|
res = soup.find_all(class_="button button-shadow")
|
||||||
res = "".join(f"{i.text}\n{i['href']}\n\n" for i in res)
|
res = "".join(f"{i.text}\n{i['href']}\n\n" for i in res)
|
||||||
if len(res) > 3500:
|
if len(res) > 3500:
|
||||||
link = await post_to_telegraph(False, "MissKaty NoDrakor", res)
|
link = await post_to_telegraph(False, "MissKaty NoDrakor", res)
|
||||||
return await callback_query.message.edit_msg(
|
return await callback_query.message.edit_msg(
|
||||||
strings("res_scrape").format(link=link, kl=link), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=link),
|
||||||
|
reply_markup=keyboard,
|
||||||
)
|
)
|
||||||
await callback_query.message.edit_msg(
|
await callback_query.message.edit_msg(
|
||||||
strings("res_scrape").format(link=link, kl=res), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=res), reply_markup=keyboard
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await callback_query.message.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
await callback_query.message.edit_msg(f"ERROR: {err}", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"ERROR: {err}", reply_markup=keyboard
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Scrape Link Download Movieku.CC
|
# Scrape Link Download Movieku.CC
|
||||||
|
|
@ -1409,14 +1459,18 @@ async def muviku_scrap(_, message, strings):
|
||||||
data.append({"link": link, "kualitas": kualitas})
|
data.append({"link": link, "kualitas": kualitas})
|
||||||
if not data:
|
if not data:
|
||||||
return await message.reply(strings("no_result"))
|
return await message.reply(strings("no_result"))
|
||||||
res = "".join(f"<b>Host: {i['kualitas']}</b>\n{i['link']}\n\n" for i in data)
|
res = "".join(
|
||||||
|
f"<b>Host: {i['kualitas']}</b>\n{i['link']}\n\n" for i in data
|
||||||
|
)
|
||||||
await message.reply(res)
|
await message.reply(res)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return await message.reply(
|
return await message.reply(
|
||||||
strings("invalid_cmd_scrape").format(cmd=message.command[0])
|
strings("invalid_cmd_scrape").format(cmd=message.command[0])
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await message.reply(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>")
|
await message.reply(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>"
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await message.reply(f"ERROR: {str(e)}")
|
await message.reply(f"ERROR: {str(e)}")
|
||||||
|
|
||||||
|
|
@ -1459,9 +1513,14 @@ async def melong_scrap(_, callback_query, strings):
|
||||||
strings("res_scrape").format(link=link, kl=rep), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=rep), reply_markup=keyboard
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await callback_query.message.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
await callback_query.message.edit_msg(f"ERROR: {err}", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"ERROR: {err}", reply_markup=keyboard
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Scrape DDL Link Gomov
|
# Scrape DDL Link Gomov
|
||||||
|
|
@ -1503,9 +1562,14 @@ async def gomov_dl(_, callback_query, strings):
|
||||||
strings("res_scrape").format(link=link, kl=hasil), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=hasil), reply_markup=keyboard
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await callback_query.message.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
await callback_query.message.edit_msg(f"ERROR: {err}", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"ERROR: {err}", reply_markup=keyboard
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.on_cb("lendriveextract#")
|
@app.on_cb("lendriveextract#")
|
||||||
|
|
@ -1541,12 +1605,18 @@ async def lendrive_dl(_, callback_query, strings):
|
||||||
continue
|
continue
|
||||||
kl += f"{i.find('strong')}:\n"
|
kl += f"{i.find('strong')}:\n"
|
||||||
kl += "".join(
|
kl += "".join(
|
||||||
f"[ <a href='{a.get('href')}'>{a.text}</a> ]\n" for a in i.findAll("a")
|
f"[ <a href='{a.get('href')}'>{a.text}</a> ]\n"
|
||||||
|
for a in i.findAll("a")
|
||||||
)
|
)
|
||||||
await callback_query.message.edit_msg(
|
await callback_query.message.edit_msg(
|
||||||
strings("res_scrape").format(link=link, kl=kl), reply_markup=keyboard
|
strings("res_scrape").format(link=link, kl=kl), reply_markup=keyboard
|
||||||
)
|
)
|
||||||
except httpx.HTTPError as exc:
|
except httpx.HTTPError as exc:
|
||||||
await callback_query.message.edit_msg(f"HTTP Exception for {exc.request.url} - <code>{exc}</code>", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"HTTP Exception for {exc.request.url} - <code>{exc}</code>",
|
||||||
|
reply_markup=keyboard,
|
||||||
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
await callback_query.message.edit_msg(f"ERROR: {err}", reply_markup=keyboard)
|
await callback_query.message.edit_msg(
|
||||||
|
f"ERROR: {err}", reply_markup=keyboard
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ async def take_ss(_, ctx: Message, strings):
|
||||||
msg = await ctx.reply_msg(strings("wait_str"))
|
msg = await ctx.reply_msg(strings("wait_str"))
|
||||||
try:
|
try:
|
||||||
url = f"https://webss.yasirweb.eu.org/api/screenshot?resX=1280&resY=900&outFormat=jpg&waitTime=1000&isFullPage=false&dismissModals=false&url={url}"
|
url = f"https://webss.yasirweb.eu.org/api/screenshot?resX=1280&resY=900&outFormat=jpg&waitTime=1000&isFullPage=false&dismissModals=false&url={url}"
|
||||||
downloader = SmartDL(url, download_file_path, progress_bar=False, timeout=15, verify=False)
|
downloader = SmartDL(
|
||||||
|
url, download_file_path, progress_bar=False, timeout=15, verify=False
|
||||||
|
)
|
||||||
downloader.start(blocking=True)
|
downloader.start(blocking=True)
|
||||||
await gather(
|
await gather(
|
||||||
*[
|
*[
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ from pyrogram.types import (
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core import pyro_cooldown
|
from misskaty.core import pyro_cooldown
|
||||||
from misskaty.core.decorator import capture_err, new_task
|
from misskaty.core.decorator import capture_err, new_task
|
||||||
from misskaty.helper import fetch, use_chat_lang, isValidURL
|
from misskaty.helper import fetch, isValidURL, use_chat_lang
|
||||||
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO
|
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
@ -94,7 +94,11 @@ async def ytsearch(_, ctx: Message, strings):
|
||||||
async def ytdownv2(self, ctx: Message, strings):
|
async def ytdownv2(self, ctx: Message, strings):
|
||||||
if not ctx.from_user:
|
if not ctx.from_user:
|
||||||
return await ctx.reply_msg(strings("no_channel"))
|
return await ctx.reply_msg(strings("no_channel"))
|
||||||
url = ctx.command[1] if ctx.command and len(ctx.command) > 1 else ctx.text or ctx.caption
|
url = (
|
||||||
|
ctx.command[1]
|
||||||
|
if ctx.command and len(ctx.command) > 1
|
||||||
|
else ctx.text or ctx.caption
|
||||||
|
)
|
||||||
if not isValidURL(url):
|
if not isValidURL(url):
|
||||||
return await ctx.reply_msg(strings("invalid_link"))
|
return await ctx.reply_msg(strings("invalid_link"))
|
||||||
async with iYTDL(log_group_id=0, cache_path="cache", silent=True) as ytdl:
|
async with iYTDL(log_group_id=0, cache_path="cache", silent=True) as ytdl:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ basicConfig(
|
||||||
format="[%(levelname)s] - [%(asctime)s - %(name)s - %(message)s] -> [%(module)s:%(lineno)d]",
|
format="[%(levelname)s] - [%(asctime)s - %(name)s - %(message)s] -> [%(module)s:%(lineno)d]",
|
||||||
datefmt="%d-%b-%y %H:%M:%S",
|
datefmt="%d-%b-%y %H:%M:%S",
|
||||||
handlers=[
|
handlers=[
|
||||||
handlers.RotatingFileHandler("MissKatyLogs.txt", mode="w+", maxBytes=5242880, backupCount=1),
|
handlers.RotatingFileHandler(
|
||||||
|
"MissKatyLogs.txt", mode="w+", maxBytes=5242880, backupCount=1
|
||||||
|
),
|
||||||
StreamHandler(),
|
StreamHandler(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
6
utils.py
6
utils.py
|
|
@ -128,7 +128,11 @@ def extract_user(message: Message) -> Union[int, str]:
|
||||||
user_first_name = message.reply_to_message.from_user.first_name
|
user_first_name = message.reply_to_message.from_user.first_name
|
||||||
|
|
||||||
elif len(message.command) > 1:
|
elif len(message.command) > 1:
|
||||||
if message.entities and len(message.entities) > 1 and message.entities[1].type.value == "text_mention":
|
if (
|
||||||
|
message.entities
|
||||||
|
and len(message.entities) > 1
|
||||||
|
and message.entities[1].type.value == "text_mention"
|
||||||
|
):
|
||||||
required_entity = message.entities[1]
|
required_entity = message.entities[1]
|
||||||
user_id = required_entity.user.id
|
user_id = required_entity.user.id
|
||||||
user_first_name = required_entity.user.first_name
|
user_first_name = required_entity.user.first_name
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue