🔖 Update to v1.0.3

This commit is contained in:
xtaodada 2022-05-27 23:09:24 +08:00
parent fade059e80
commit c1c8446252
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
7 changed files with 41 additions and 30 deletions

View File

@ -55,8 +55,8 @@ mtp_port: ""
mtp_secret: "" mtp_secret: ""
# Apt Git source # Apt Git source
git_source: "https://gitlab.com/Xtao-Labs/PagerMaid_Plugins/-/raw/v2/" git_source: "https://raw.githubusercontent.com/TeamPGM/PagerMaid_Plugins/v2/"
git_ssh: "https://gitlab.com/Xtao-Labs/PagerMaid-Pyro.git" git_ssh: "https://github.com/TeamPGM/PagerMaid-Pyro.git"
# Update Notice # Update Notice
update_check: "True" update_check: "True"

View File

@ -1,5 +1,5 @@
from coloredlogs import ColoredFormatter from coloredlogs import ColoredFormatter
from logging import getLogger, StreamHandler, CRITICAL, INFO, basicConfig from logging import getLogger, StreamHandler, CRITICAL, INFO, basicConfig, DEBUG
from datetime import datetime from datetime import datetime
from os import getcwd from os import getcwd
from apscheduler.schedulers.asyncio import AsyncIOScheduler from apscheduler.schedulers.asyncio import AsyncIOScheduler
@ -9,7 +9,7 @@ import pyromod.listen
from pyrogram import Client from pyrogram import Client
import sys import sys
pgm_version = "1.0.2" pgm_version = "1.0.3"
CMD_LIST = {} CMD_LIST = {}
module_dir = __path__[0] module_dir = __path__[0]
working_dir = getcwd() working_dir = getcwd()
@ -25,10 +25,10 @@ logging_format = "%(levelname)s [%(asctime)s] [%(name)s] %(message)s"
logging_handler = StreamHandler() logging_handler = StreamHandler()
logging_handler.setFormatter(ColoredFormatter(logging_format)) logging_handler.setFormatter(ColoredFormatter(logging_format))
root_logger = getLogger() root_logger = getLogger()
root_logger.setLevel(CRITICAL) root_logger.setLevel(DEBUG if Config.DEBUG else CRITICAL)
root_logger.addHandler(logging_handler) root_logger.addHandler(logging_handler)
basicConfig(level=INFO) basicConfig(level=DEBUG if Config.DEBUG else INFO)
logs.setLevel(INFO) logs.setLevel(DEBUG if Config.DEBUG else INFO)
# easy check # easy check
if not Config.API_ID: if not Config.API_ID:
@ -39,6 +39,12 @@ elif not Config.API_HASH:
sys.exit(1) sys.exit(1)
start_time = datetime.utcnow() start_time = datetime.utcnow()
try:
import uvloop
uvloop.install()
except ImportError:
pass
bot = Client("pagermaid", bot = Client("pagermaid",
session_string=Config.STRING_SESSION, session_string=Config.STRING_SESSION,
api_id=Config.API_ID, api_id=Config.API_ID,

View File

@ -8,10 +8,13 @@ from pagermaid import bot, logs, working_dir
from pagermaid.modules import module_list, plugin_list from pagermaid.modules import module_list, plugin_list
from pagermaid.utils import lang from pagermaid.utils import lang
path.insert(1, f"{working_dir}{sep}plugins") path.insert(1, f"{working_dir}{sep}plugins")
async def main():
logs.info(lang('platform') + platform + lang('platform_load')) logs.info(lang('platform') + platform + lang('platform_load'))
bot.start()
await bot.start()
for module_name in module_list: for module_name in module_list:
try: try:
@ -26,5 +29,7 @@ for plugin_name in plugin_list:
plugin_list.remove(plugin_name) plugin_list.remove(plugin_name)
logs.info(lang('start')) logs.info(lang('start'))
idle() await idle()
bot.stop() await bot.stop()
bot.run(main())

View File

@ -15,7 +15,7 @@ async def update(_: Client, message: Message):
if len(message.parameter) > 0: if len(message.parameter) > 0:
await execute('git reset --hard origin/master') await execute('git reset --hard origin/master')
await execute('git pull --all') await execute('git pull --all')
await execute(f"{executable} -m pip install -r requirements.txt --upgrade") await execute(f"{executable} -m pip install --upgrade -r requirements.txt")
await execute(f"{executable} -m pip install -r requirements.txt") await execute(f"{executable} -m pip install -r requirements.txt")
await message.edit(lang('update_success')) await message.edit(lang('update_success'))
exit(1) exit(1)

View File

@ -1,4 +1,4 @@
pyrogram==2.0.24 pyrogram==2.0.26
TgCrypto>=1.2.3 TgCrypto>=1.2.3
Pillow>=8.4.0 Pillow>=8.4.0
pytz>=2021.3 pytz>=2021.3

View File

@ -85,7 +85,7 @@ data_persistence () {
docker cp $container_name:/pagermaid/workdir $data_path docker cp $container_name:/pagermaid/workdir $data_path
docker stop $container_name &>/dev/null docker stop $container_name &>/dev/null
docker rm $container_name &>/dev/null docker rm $container_name &>/dev/null
docker run -dit -e PUID=$PUID -e PGID=$PGID -v $data_path/workdir:/pagermaid/workdir --restart=always --name="$container_name" --hostname="$container_name" mrwangzhe/pagermaid_modify <&1 docker run -dit -e PUID=$PUID -e PGID=$PGID -v $data_path/workdir:/pagermaid/workdir --restart=always --name="$container_name" --hostname="$container_name" teampgm/pagermaid_pyro <&1
echo echo
echo "数据持久化操作完成。" echo "数据持久化操作完成。"
echo echo

View File

@ -451,7 +451,7 @@ start_installation() {
configure configure
login_screen login_screen
systemctl_reload systemctl_reload
echo "PagerMaid 已经安装完毕 在telegram对话框中输入 -help 并发送查看帮助列表" echo "PagerMaid 已经安装完毕 在telegram对话框中输入 ,help 并发送查看帮助列表"
elif [ "$release" = "ubuntu" ]; then elif [ "$release" = "ubuntu" ]; then
echo "系统检测通过。" echo "系统检测通过。"
welcome welcome
@ -465,7 +465,7 @@ start_installation() {
configure configure
login_screen login_screen
systemctl_reload systemctl_reload
echo "PagerMaid 已经安装完毕 在telegram对话框中输入 -help 并发送查看帮助列表" echo "PagerMaid 已经安装完毕 在telegram对话框中输入 ,help 并发送查看帮助列表"
elif [ "$release" = "debian" ]; then elif [ "$release" = "debian" ]; then
echo "系统检测通过。" echo "系统检测通过。"
welcome welcome
@ -479,7 +479,7 @@ start_installation() {
configure configure
login_screen login_screen
systemctl_reload systemctl_reload
echo "PagerMaid 已经安装完毕 在telegram对话框中输入 -help 并发送查看帮助列表" echo "PagerMaid 已经安装完毕 在telegram对话框中输入 ,help 并发送查看帮助列表"
else else
echo "目前暂时不支持此系统。" echo "目前暂时不支持此系统。"
fi fi