🔖 Update to v1.4.6

🐛 Fix lang command
This commit is contained in:
xtaodada 2023-12-29 20:49:54 +08:00
parent 9af014c6b7
commit 454481ecc9
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
6 changed files with 37 additions and 15 deletions

View File

@ -344,15 +344,15 @@ apt_plugin_maintainer: Author
apt_plugin_size: size apt_plugin_size: size
apt_plugin_support: support period apt_plugin_support: support period
apt_plugin_des_short: description apt_plugin_des_short: description
apt_source_des: Add or delete or view the source of the plugin repository. apt_source_des: "Add/Del/View Custom Plugin Sources."
apt_source_parameters: "[add/del] [source url]" apt_source_parameters: "[add/del] [custom plugin source links]"
apt_source_not_found: Something went wrong ~ The specified source does not exist. apt_source_not_found: There is currently no custom plugin source.
apt_source_header: "Apt Source List:" apt_source_header: "Current custom plugin source:"
apt_source_add_success: Add success apt_source_add_success: Add successful.
apt_source_del_success: Del success apt_source_del_success: Del successful.
apt_source_add_failed: Add failed, this source already exists apt_source_add_failed: Add failed, this source already exists.
apt_source_add_invalid: Add failed, invalid source apt_source_add_invalid: Add failed, this source is invalid.
apt_source_del_failed: Del failed, this source does not exist apt_source_del_failed: Deletion failed, this source does not exist.
#prune #prune
## prune ## prune
prune_des: Replying to a message with this command will delete all messages between the latest message and the message. Limit, 1000 messages based on message ID, more than 1000 messages may trigger the limit of deleting messages too quickly. (Non-group administrators only delete their own messages) prune_des: Replying to a message with this command will delete all messages between the latest message and the message. Limit, 1000 messages based on message ID, more than 1000 messages may trigger the limit of deleting messages too quickly. (Non-group administrators only delete their own messages)

View File

@ -344,6 +344,15 @@ apt_plugin_maintainer: Author
apt_plugin_size: size apt_plugin_size: size
apt_plugin_support: support period apt_plugin_support: support period
apt_plugin_des_short: descriptionの apt_plugin_des_short: descriptionの
apt_source_des: "カスタムプラグインソースの追加/削除/表示。"
apt_source_parameters: "[add/del] [カスタムプラグインのソースリンク]"
apt_source_not_found: 現在、カスタムプラグインソースはありません。
apt_source_header: "現在のカスタムプラグインソース:"
apt_source_add_success: 追加に成功しました。
apt_source_del_success: 削除しました。
apt_source_add_failed: 追加に失敗しました。このソースは既に存在します。
apt_source_add_invalid: 追加に失敗しました。このソースは無効です。
apt_source_del_failed: 削除に失敗しました。このソースは存在しません。
#prune #prune
## prune ## prune
prune_des: Replying to a message with this command will delete all messages between the latest message and the message. Limit, 1000 messages based on message ID, more than 1000 messages may trigger the limit of deleting messages too quickly. (Non-group administrators only delete their messages) prune_des: Replying to a message with this command will delete all messages between the latest message and the message. Limit, 1000 messages based on message ID, more than 1000 messages may trigger the limit of deleting messages too quickly. (Non-group administrators only delete their messages)

View File

@ -344,6 +344,15 @@ apt_plugin_maintainer: 作者
apt_plugin_size: 容量 apt_plugin_size: 容量
apt_plugin_support: 支援週期 apt_plugin_support: 支援週期
apt_plugin_des_short: 說明 apt_plugin_des_short: 說明
apt_source_des: "新增/刪除/檢視 自訂插件來源"
apt_source_parameters: "[add/del] [自訂軟體來源連結]"
apt_source_not_found: 目前沒有自訂插件來源
apt_source_header: "當前自訂插件來源:"
apt_source_add_success: 添加成功
apt_source_del_success: 刪除成功
apt_source_add_failed: 新增失敗,此來源已存在
apt_source_add_invalid: 新增失敗,此來源無效
apt_source_del_failed: 刪除失敗,此來源不存在
#prune #prune
## prune ## prune
prune_des: 刪除回覆的訊息後的所有消息。 prune_des: 刪除回覆的訊息後的所有消息。

View File

@ -22,8 +22,8 @@ from pagermaid.scheduler import scheduler
import pyromod.listen import pyromod.listen
from pyrogram import Client from pyrogram import Client
pgm_version = "1.4.5" pgm_version = "1.4.6"
pgm_version_code = 1405 pgm_version_code = 1406
CMD_LIST = {} CMD_LIST = {}
module_dir = __path__[0] module_dir = __path__[0]
working_dir = getcwd() working_dir = getcwd()

View File

@ -1,11 +1,14 @@
import os import os
import sys import sys
from json import load as load_json from json import load as load_json
from pathlib import Path
from shutil import copyfile from shutil import copyfile
from typing import Dict from typing import Dict
from yaml import load, FullLoader, safe_load from yaml import load, FullLoader, safe_load
CONFIG_PATH = Path("data/config.yml")
def strtobool(val, default=False): def strtobool(val, default=False):
"""Convert a string representation of truth to true (1) or false (0). """Convert a string representation of truth to true (1) or false (0).
@ -25,12 +28,12 @@ def strtobool(val, default=False):
try: try:
config: Dict = load(open(r"data/config.yml", encoding="utf-8"), Loader=FullLoader) config: Dict = load(open(CONFIG_PATH, encoding="utf-8"), Loader=FullLoader)
except FileNotFoundError: except FileNotFoundError:
print( print(
"The configuration file does not exist, and a new configuration file is being generated." "The configuration file does not exist, and a new configuration file is being generated."
) )
copyfile(f"{os.getcwd()}{os.sep}config.gen.yml", "data/config.yml") copyfile(f"{os.getcwd()}{os.sep}config.gen.yml", CONFIG_PATH)
sys.exit(1) sys.exit(1)

View File

@ -5,6 +5,7 @@ from pyrogram.enums import ParseMode
from pagermaid import help_messages, Config from pagermaid import help_messages, Config
from pagermaid.common.alias import AliasManager from pagermaid.common.alias import AliasManager
from pagermaid.config import CONFIG_PATH
from pagermaid.group_manager import enforce_permission from pagermaid.group_manager import enforce_permission
from pagermaid.common.reload import reload_all from pagermaid.common.reload import reload_all
from pagermaid.utils import lang, Message, from_self, from_msg_get_sudo_uid from pagermaid.utils import lang, Message, from_self, from_msg_get_sudo_uid
@ -163,12 +164,12 @@ async def lang_change(message: Message):
for i in dir_: for i in dir_:
if i.find("yml") != -1: if i.find("yml") != -1:
dir__.append(i[:-4]) dir__.append(i[:-4])
file = pathlib.Path("config.yml").read_text() file = CONFIG_PATH.read_text()
if to_lang in dir__: if to_lang in dir__:
file = file.replace( file = file.replace(
f'application_language: "{from_lang}"', f'application_language: "{to_lang}"' f'application_language: "{from_lang}"', f'application_language: "{to_lang}"'
) )
with open("config.yml", "w", encoding="utf-8") as f: with open(CONFIG_PATH, "w", encoding="utf-8") as f:
f.write(file) f.write(file)
await message.edit(f"{lang('lang_change_to')} {to_lang}, {lang('lang_reboot')}") await message.edit(f"{lang('lang_change_to')} {to_lang}, {lang('lang_reboot')}")
await reload_all() await reload_all()