inspect bug fixes.

This commit is contained in:
thedragonsinn
2023-11-09 19:26:23 +05:30
parent 11f6418d43
commit 300e7d7755
4 changed files with 8 additions and 5 deletions

View File

@@ -61,9 +61,9 @@ class BOT(Client):
@staticmethod
def add_cmd(cmd: str | list):
def the_decorator(func):
path = inspect.stack()[1][1]
@wraps(func)
def wrapper():
path = inspect.stack()[1][1]
if isinstance(cmd, list):
for _cmd in cmd:
Config.CMD_DICT[_cmd] = {"func": func, "path": path}

View File

@@ -1,4 +1,5 @@
import asyncio
import inspect
import sys
import traceback
from io import StringIO
@@ -51,4 +52,4 @@ async def executor(bot: bot, message: Message) -> Message | None:
if Config.DEV_MODE:
Config.CMD_DICT["exec"] = executor
Config.CMD_DICT["exec"] = {"func": executor, "path":inspect.stack()[0][1]}

View File

@@ -1,4 +1,5 @@
import importlib
import inspect
import sys
import traceback
@@ -26,4 +27,4 @@ async def loader(bot: bot, message: Message) -> Message | None:
if Config.DEV_MODE:
Config.CMD_DICT["load"] = loader
Config.CMD_DICT["load"] ={"func": loader, "path":inspect.stack()[0][1]}

View File

@@ -1,4 +1,5 @@
import asyncio
import inspect
from pyrogram.enums import ParseMode
@@ -52,5 +53,5 @@ async def live_shell(bot: bot, message: Message) -> Message | None:
if Config.DEV_MODE:
Config.CMD_DICT["shell"] = live_shell
Config.CMD_DICT["sh"] = run_cmd
Config.CMD_DICT["shell"] ={"func": live_shell, "path":inspect.stack()[0][1]}
Config.CMD_DICT["sh"] = {"func": run_cmd, "path":inspect.stack()[0][1]}