Skip to content

Commit

Permalink
🔖 Update to v1.4.6
Browse files Browse the repository at this point in the history
🐛 Fix lang command
  • Loading branch information
omg-xtao committed Dec 29, 2023
1 parent 9af014c commit 454481e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
18 changes: 9 additions & 9 deletions languages/built-in/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,15 @@ apt_plugin_maintainer: Author
apt_plugin_size: size
apt_plugin_support: support period
apt_plugin_des_short: description
apt_source_des: Add or delete or view the source of the plugin repository.
apt_source_parameters: "[add/del] [source url]"
apt_source_not_found: Something went wrong ~ The specified source does not exist.
apt_source_header: "Apt Source List:"
apt_source_add_success: Add success
apt_source_del_success: Del success
apt_source_add_failed: Add failed, this source already exists
apt_source_add_invalid: Add failed, invalid source
apt_source_del_failed: Del failed, this source does not exist
apt_source_des: "Add/Del/View Custom Plugin Sources."
apt_source_parameters: "[add/del] [custom plugin source links]"
apt_source_not_found: There is currently no custom plugin source.
apt_source_header: "Current custom plugin source:"
apt_source_add_success: Add successful.
apt_source_del_success: Del successful.
apt_source_add_failed: Add failed, this source already exists.
apt_source_add_invalid: Add failed, this source is invalid.
apt_source_del_failed: Deletion failed, this source does not exist.
#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)
Expand Down
9 changes: 9 additions & 0 deletions languages/built-in/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ apt_plugin_maintainer: Author
apt_plugin_size: size
apt_plugin_support: support period
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_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)
Expand Down
9 changes: 9 additions & 0 deletions languages/built-in/zh-tw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ apt_plugin_maintainer: 作者
apt_plugin_size: 容量
apt_plugin_support: 支援週期
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_des: 刪除回覆的訊息後的所有消息。
Expand Down
4 changes: 2 additions & 2 deletions pagermaid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import pyromod.listen
from pyrogram import Client

pgm_version = "1.4.5"
pgm_version_code = 1405
pgm_version = "1.4.6"
pgm_version_code = 1406
CMD_LIST = {}
module_dir = __path__[0]
working_dir = getcwd()
Expand Down
7 changes: 5 additions & 2 deletions pagermaid/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import os
import sys
from json import load as load_json
from pathlib import Path
from shutil import copyfile
from typing import Dict

from yaml import load, FullLoader, safe_load

CONFIG_PATH = Path("data/config.yml")


def strtobool(val, default=False):
"""Convert a string representation of truth to true (1) or false (0).
Expand All @@ -25,12 +28,12 @@ def strtobool(val, default=False):


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:
print(
"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)


Expand Down
5 changes: 3 additions & 2 deletions pagermaid/modules/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from pagermaid import help_messages, Config
from pagermaid.common.alias import AliasManager
from pagermaid.config import CONFIG_PATH
from pagermaid.group_manager import enforce_permission
from pagermaid.common.reload import reload_all
from pagermaid.utils import lang, Message, from_self, from_msg_get_sudo_uid
Expand Down Expand Up @@ -163,12 +164,12 @@ async def lang_change(message: Message):
for i in dir_:
if i.find("yml") != -1:
dir__.append(i[:-4])
file = pathlib.Path("config.yml").read_text()
file = CONFIG_PATH.read_text()
if to_lang in dir__:
file = file.replace(
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)
await message.edit(f"{lang('lang_change_to')} {to_lang}, {lang('lang_reboot')}")
await reload_all()
Expand Down

0 comments on commit 454481e

Please sign in to comment.