mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-21 23:08:02 +00:00
🔖 Update to v1.0.9
This commit is contained in:
parent
2553fa9937
commit
ba9da97b3c
@ -9,7 +9,7 @@ import pyromod.listen
|
||||
from pyrogram import Client
|
||||
import sys
|
||||
|
||||
pgm_version = "1.0.8"
|
||||
pgm_version = "1.0.9"
|
||||
CMD_LIST = {}
|
||||
module_dir = __path__[0]
|
||||
working_dir = getcwd()
|
||||
|
@ -55,7 +55,7 @@ class Config:
|
||||
port=PROXY_PORT,
|
||||
)
|
||||
GIT_SOURCE = os.environ.get("PGM_GIT_SOURCE", config["git_source"])
|
||||
GIT_SOURCE = GIT_SOURCE.replace("TeamPGM/PagerMaid-Pyro", "TeamPGM/PagerMaid_Plugins_Pyro")
|
||||
GIT_SOURCE = GIT_SOURCE.replace("TeamPGM/PagerMaid_Plugins/", "TeamPGM/PagerMaid_Plugins_Pyro/")
|
||||
try:
|
||||
with open(f"languages{os.sep}built-in{os.sep}{LANGUAGE}.yml", "r", encoding="utf-8") as f:
|
||||
lang_dict = safe_load(f)
|
||||
|
@ -10,6 +10,7 @@ from pyrogram import Client
|
||||
|
||||
from pagermaid import log, working_dir, Config
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.single_utils import safe_remove
|
||||
from pagermaid.utils import upload_attachment, lang, Message, client
|
||||
from pagermaid.modules import plugin_list as active_plugins, __list_plugins
|
||||
|
||||
@ -62,7 +63,7 @@ async def plugin(__: Client, message: Message):
|
||||
plugin_directory = f"{working_dir}{sep}plugins{sep}"
|
||||
if message.parameter[0] == "install":
|
||||
if len(message.parameter) == 1:
|
||||
await message.edit(lang('apt_processing'))
|
||||
message = await message.edit(lang('apt_processing'))
|
||||
if reply:
|
||||
file_path = await reply.download()
|
||||
else:
|
||||
@ -137,16 +138,19 @@ async def plugin(__: Client, message: Message):
|
||||
await message.edit(lang('arg_error'))
|
||||
elif message.parameter[0] == "remove":
|
||||
if len(message.parameter) == 2:
|
||||
if exists(f"{plugin_directory}{message.parameter[1]}.py"):
|
||||
remove(f"{plugin_directory}{message.parameter[1]}.py")
|
||||
if exists(f"{plugin_directory}{message.parameter[1]}.py") or \
|
||||
exists(f"{plugin_directory}{message.parameter[1]}.py.disabled"):
|
||||
safe_remove(f"{plugin_directory}{message.parameter[1]}.py")
|
||||
safe_remove(f"{plugin_directory}{message.parameter[1]}.py.disabled")
|
||||
with open(f"{plugin_directory}version.json", 'r', encoding="utf-8") as f:
|
||||
version_json = json.load(f)
|
||||
version_json[message.parameter[1]] = "0.0"
|
||||
with open(f"{plugin_directory}version.json", 'w') as f:
|
||||
json.dump(version_json, f)
|
||||
await message.edit(f"{lang('apt_remove_success')} {message.parameter[1]}, "
|
||||
f"{lang('apt_reboot')} ")
|
||||
await log(f"{lang('apt_remove')} {message.parameter[1]}.")
|
||||
exit(0)
|
||||
elif exists(f"{plugin_directory}{message.parameter[1]}.py.disabled"):
|
||||
remove(f"{plugin_directory}{message.parameter[1]}.py.disabled")
|
||||
await message.edit(f"{lang('apt_removed_plugins')} {message.parameter[1]}.")
|
||||
await log(f"{lang('apt_removed_plugins')} {message.parameter[1]}.")
|
||||
elif "/" in message.parameter[1]:
|
||||
await message.edit(lang('arg_error'))
|
||||
else:
|
||||
|
@ -194,10 +194,11 @@ async def process_exit(start: int, _client, message=None):
|
||||
data = sqlite.get("exit_msg", {})
|
||||
cid, mid = data.get("cid", 0), data.get("mid", 0)
|
||||
if start and data and cid and mid:
|
||||
msg = await _client.get_messages(cid, mid)
|
||||
msg: Message = await _client.get_messages(cid, mid)
|
||||
if msg:
|
||||
try:
|
||||
await msg.edit(lang("restart_complete"))
|
||||
await msg.edit((msg.text if msg.from_user.is_self and msg.text else "") +
|
||||
f'\n\n> {lang("restart_complete")}')
|
||||
except Exception as e: # noqa
|
||||
pass
|
||||
del sqlite["exit_msg"]
|
||||
|
Loading…
Reference in New Issue
Block a user