I hope fixed

This commit is contained in:
yasir 2023-08-03 11:45:53 +07:00
parent 119321393e
commit d5870ffd6e
4 changed files with 16 additions and 3 deletions

View file

@ -34,6 +34,7 @@ basicConfig(
getLogger("pyrogram").setLevel(ERROR) getLogger("pyrogram").setLevel(ERROR)
getLogger("openai").setLevel(ERROR) getLogger("openai").setLevel(ERROR)
getLogger("httpx").setLevel(ERROR) getLogger("httpx").setLevel(ERROR)
getLogger("iytdl").setLevel(ERROR)
MOD_LOAD = [] MOD_LOAD = []
MOD_NOLOAD = ["subscene_dl"] MOD_NOLOAD = ["subscene_dl"]
@ -55,6 +56,7 @@ app = Client(
user = Client( user = Client(
"YasirUBot", "YasirUBot",
session_string=USER_SESSION, session_string=USER_SESSION,
mongodb=dict(connection=AsyncClient(DATABASE_URI), remove_peers=False),
) )
jobstores = { jobstores = {

View file

@ -20,6 +20,7 @@ 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
from psutil import net_io_counters, virtual_memory from psutil import net_io_counters, virtual_memory
from apscheduler.schedulers.asyncio import AsyncIOScheduler
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
@ -41,7 +42,7 @@ from misskaty.helper.functions import extract_user, extract_user_and_reason
from misskaty.helper.http import http from misskaty.helper.http import http
from misskaty.helper.human_read import get_readable_file_size, get_readable_time from misskaty.helper.human_read import get_readable_file_size, get_readable_time
from misskaty.helper.localization import use_chat_lang from misskaty.helper.localization import use_chat_lang
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, AUTO_RESTART
__MODULE__ = "DevCommand" __MODULE__ = "DevCommand"
__HELP__ = """ __HELP__ = """
@ -541,3 +542,12 @@ async def shell_exec(code, treat=True):
if treat: if treat:
stdout = stdout.decode().strip() stdout = stdout.decode().strip()
return stdout, process return stdout, process
async def auto_restart():
await shell_exec("python3 update.py")
os.execvp(sys.executable, [sys.executable, "-m", "misskaty"])
if AUTO_RESTART:
scheduler = AsyncIOScheduler(timezone="Asia/Jakarta")
scheduler.add_job(auto_restart, trigger="interval", days=3)
scheduler.start()

View file

@ -254,7 +254,7 @@ def isArgInt(txt) -> list:
@ratelimiter @ratelimiter
async def msg_quotly_cmd(self: Client, ctx: Message): async def msg_quotly_cmd(self: Client, ctx: Message):
is_reply = False is_reply = False
if ctx.command[0][1] == "r": if ctx.command[0].endswith("r"):
is_reply = True is_reply = True
if len(ctx.text.split()) > 1: if len(ctx.text.split()) > 1:
check_arg = isArgInt(ctx.command[1]) check_arg = isArgInt(ctx.command[1])
@ -279,7 +279,7 @@ async def msg_quotly_cmd(self: Client, ctx: Message):
try: try:
make_quotly = await pyrogram_to_quotly(messages, is_reply=is_reply) make_quotly = await pyrogram_to_quotly(messages, is_reply=is_reply)
bio_sticker = BytesIO(make_quotly) bio_sticker = BytesIO(make_quotly)
bio_sticker.name = "biosticker.webp" bio_sticker.name = "misskatyquote_sticker.webp"
return await ctx.reply_sticker(bio_sticker) return await ctx.reply_sticker(bio_sticker)
except Exception: except Exception:
return await ctx.reply_msg("🤷🏻‍♂️") return await ctx.reply_msg("🤷🏻‍♂️")

View file

@ -42,6 +42,7 @@ SUDO = list(
} }
) )
SUPPORT_CHAT = environ.get("SUPPORT_CHAT", "YasirPediaChannel") SUPPORT_CHAT = environ.get("SUPPORT_CHAT", "YasirPediaChannel")
AUTO_RESTART = environ.get("AUTO_RESTART", False)
OPENAI_API = getConfig("OPENAI_API") OPENAI_API = getConfig("OPENAI_API")
## Config For AUtoForwarder ## Config For AUtoForwarder