mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Some improvement, but still leave some minor errors
This commit is contained in:
parent
652ade33c0
commit
0bf8595132
11 changed files with 25 additions and 23 deletions
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"githubPullRequests.ignoredPullRequestBranches": [
|
||||
"master"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
"""
|
||||
* @author yasir <yasiramunandar@gmail.com>
|
||||
* @date 2022-09-06 10:12:09
|
||||
* @lastModified 2022-12-01 09:34:27
|
||||
* @projectName MissKatyPyro
|
||||
* Copyright @YasirPedia All rights reserved
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ misskaty_version = "v2.023.5.16 - Stable"
|
|||
|
||||
pymonclient = MongoClient(DATABASE_URI)
|
||||
|
||||
# Pyrogram Bot Client (Disable temporary for mongodb session)
|
||||
# Pyrogram Bot Client
|
||||
app = Client(
|
||||
"MissKatyBot",
|
||||
api_id=API_ID,
|
||||
|
|
@ -51,6 +51,9 @@ jobstores = {"default": MongoDBJobStore(client=pymonclient, database=DATABASE_NA
|
|||
scheduler = AsyncIOScheduler(jobstores=jobstores, timezone=TZ)
|
||||
|
||||
app.start()
|
||||
BOT_ID = app.me.id
|
||||
BOT_NAME = app.me.first_name
|
||||
BOT_USERNAME = app.me.username
|
||||
if USER_SESSION:
|
||||
user.start()
|
||||
UBOT_ID = user.me.id
|
||||
|
|
@ -60,6 +63,3 @@ else:
|
|||
UBOT_ID = None
|
||||
UBOT_NAME = None
|
||||
UBOT_USERNAME = None
|
||||
BOT_ID = app.me.id
|
||||
BOT_NAME = app.me.first_name
|
||||
BOT_USERNAME = app.me.username
|
||||
|
|
|
|||
|
|
@ -76,17 +76,17 @@ async def active_afk(self: Client, ctx: Message, strings):
|
|||
)
|
||||
elif afktype == "text":
|
||||
send = await ctx.reply_text(
|
||||
caption=strings("on_afk_msg_no_r").format(usr=ctx.from_user.mention, id=ctx.from_user.id, tm=seenago),
|
||||
strings("on_afk_msg_no_r").format(usr=ctx.from_user.mention, id=ctx.from_user.id, tm=seenago),
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
elif afktype == "text_reason":
|
||||
send = await ctx.reply_text(
|
||||
caption=strings("on_afk_msg_with_r").format(usr=ctx.from_user.mention, id=ctx.from_user.id, tm=seenago, reas=reasonafk),
|
||||
strings("on_afk_msg_with_r").format(usr=ctx.from_user.mention, id=ctx.from_user.id, tm=seenago, reas=reasonafk),
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
except Exception:
|
||||
send = await ctx.reply_text(
|
||||
strings("is_online").format(usr=ctx.from_user.first_name),
|
||||
strings("is_online").format(usr=ctx.from_user.first_name, id=ctx.from_user.id),
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
await put_cleanmode(ctx.chat.id, send.id)
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ async def ForwardMessage(client: user, msg: Message):
|
|||
await ForwardMessage(client, msg)
|
||||
except Exception as err:
|
||||
LOGGER.warning(f"#ERROR: {err}\n\nUnable to Forward Message to {str(FORWARD_TO_CHAT_ID[i])}, reason: <code>{err}</code>")
|
||||
except Exception as err:
|
||||
LOGGER.warning(f"#ERROR: {err}")
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@user.on_message((filters.text | filters.media) & filters.chat(FORWARD_FROM_CHAT_ID))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import random
|
||||
import re
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from pyrogram import enums, filters
|
||||
|
|
@ -11,6 +12,7 @@ from misskaty import app
|
|||
from .web_scraper import SCRAP_DICT, data_kuso
|
||||
from .pypi_search import PYPI_DICT
|
||||
from .ytdl_plugins import YT_DB
|
||||
from utils import temp
|
||||
from misskaty.core.decorator.permissions import admins_in_chat
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
|
|
@ -110,7 +112,7 @@ async def request_user(client, message):
|
|||
pass
|
||||
|
||||
|
||||
# To reduce cache
|
||||
# To reduce cache and disk
|
||||
async def clear_reqdict():
|
||||
SCRAP_DICT.clear()
|
||||
data_kuso.clear()
|
||||
|
|
@ -118,11 +120,9 @@ async def clear_reqdict():
|
|||
PYPI_DICT.clear()
|
||||
YT_DB.clear()
|
||||
admins_in_chat.clear()
|
||||
try:
|
||||
os.rmdir("downloads")
|
||||
os.rmdir("GenSS")
|
||||
except:
|
||||
pass
|
||||
temp.MELCOW.clear()
|
||||
shutil.rmtree("downloads", ignore_errors=True)
|
||||
shutil.rmtree("GensSS", ignore_errors=True)
|
||||
|
||||
|
||||
# @app.on_message(filters.regex(r"makasi|thank|terimakasih|terima kasih|mksh", re.I) & filters.chat(chat))
|
||||
|
|
|
|||
|
|
@ -300,8 +300,7 @@ async def re_enable_chat(bot, message):
|
|||
await message.reply("Chat Succesfully re-enabled")
|
||||
|
||||
|
||||
# a function for trespassing into others groups, Inspired by a Vazha
|
||||
# Not to be used , But Just to showcase his vazhatharam.
|
||||
# Not to be used
|
||||
# @app.on_message(filters.command('invite') & filters.user(SUDO))
|
||||
async def gen_invite(bot, message):
|
||||
if len(message.command) == 1:
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ async def help_command(self: Client, ctx: Message, strings):
|
|||
]
|
||||
)
|
||||
await ctx.reply_msg(
|
||||
strings("click_btn"),
|
||||
strings("click_btn").format(nm=name),
|
||||
reply_markup=key,
|
||||
)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ async def kang_sticker(self: Client, ctx: Message, strings):
|
|||
sticker_emoji = "".join(set(EMOJI_PATTERN.findall("".join(ctx.command[2:])))) or sticker_emoji
|
||||
resize = True
|
||||
else:
|
||||
return await prog_msg.edit_msg(strings("kang_help"), del_in=5)
|
||||
return await prog_msg.edit_msg(strings("kang_help"))
|
||||
try:
|
||||
if resize:
|
||||
filename = resize_image(filename)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ web = {
|
|||
"movieku": "https://107.152.37.223",
|
||||
"kusonime": "https://kusonime.com",
|
||||
"lendrive": "https://lendrive.web.id",
|
||||
"samehadaku": "https://samehadaku.cam",
|
||||
"samehadaku": "https://samehadaku.day",
|
||||
"oplovers": "https://oploverz.top",
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ async def getDataMelong(msg, kueri, CurrentPage, user, strings):
|
|||
data = await http.get(f"{web['melongmovie']}/?s={kueri}", headers=headers, follow_redirects=True)
|
||||
except Exception as err:
|
||||
await msg.edit_msg(strings("err_getweb").format(err=err))
|
||||
return None, None
|
||||
return None, 0, None
|
||||
bs4 = BeautifulSoup(data, "lxml")
|
||||
melongdata = []
|
||||
for res in bs4.select(".box"):
|
||||
|
|
|
|||
|
|
@ -155,7 +155,6 @@ async def ytdl_gendl_callback(self: Client, cq: CallbackQuery, strings):
|
|||
|
||||
media_type = "video" if match[3] == "v" else "audio"
|
||||
uid, disp_str = ytdl.get_choice_by_id(match[2], media_type, yt_url=yt_url)
|
||||
await cq.answer(f"⬇️ Downloading - {disp_str}")
|
||||
key = await ytdl.download(
|
||||
url=video_link,
|
||||
uid=uid,
|
||||
|
|
|
|||
Loading…
Reference in a new issue