This commit is contained in:
Pentacene 2021-04-17 09:22:43 +08:00
commit 88a4b16e07
6 changed files with 52 additions and 9 deletions

32
.github/workflows/sentry.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Sentry
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# 提交版本信息到 Sentry
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production

View File

@ -23,7 +23,6 @@ RUN pacman -Syu --needed --noconfirm \
neofetch \
sudo \
gcc \
gcc8 \
imagemagick \
libwebp \
zbar \
@ -35,7 +34,7 @@ RUN useradd pagermaid -r -m -d /pagermaid
RUN usermod -aG wheel,users pagermaid
USER pagermaid
RUN mkdir /pagermaid/workdir
RUN git clone -b master https://github.com/xtaodada/PagerMaid-Modify.git /pagermaid/workdir
RUN git clone -b master https://github.com/Xtao-Labs/PagerMaid-Modify.git /pagermaid/workdir
WORKDIR /pagermaid/workdir
RUN python3 -m virtualenv venv
RUN source venv/bin/activate; pip3 install -r requirements.txt

View File

@ -23,7 +23,6 @@ RUN pacman -Syu --needed --noconfirm \
neofetch \
sudo \
gcc \
gcc8 \
imagemagick \
libwebp \
zbar \
@ -34,7 +33,7 @@ RUN useradd pagermaid -r -m -d /pagermaid
RUN usermod -aG wheel,users pagermaid
USER pagermaid
RUN mkdir /pagermaid/workdir
RUN git clone -b master https://github.com/xtaodada/PagerMaid-Modify.git /pagermaid/workdir
RUN git clone -b master https://github.com/Xtao-Labs/PagerMaid-Modify.git /pagermaid/workdir
WORKDIR /pagermaid/workdir
RUN python3 -m virtualenv venv
RUN source venv/bin/activate; pip3 install -r requirements.txt

View File

@ -105,8 +105,15 @@ async def sticker(context):
pack_title += " (animated)"
command = '/newanimated'
response = request.urlopen(
request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
try:
response = request.urlopen(
request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
except UnicodeEncodeError:
pack_name = 's' + hex(context.sender.id)[2:]
if animated:
pack_name = 's' + hex(context.sender.id)[2:] + '_animated'
response = request.urlopen(
request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
if not response.status == 200:
try:
await context.edit(lang('sticker_telegram_server_error'))

View File

@ -5,6 +5,7 @@ from subprocess import run, PIPE
from datetime import datetime
from time import strftime
from os import remove
from os.path import exists
from git import Repo
from git.exc import GitCommandError, InvalidGitRepositoryError, NoSuchPathError
from pagermaid import log
@ -23,7 +24,7 @@ async def update(context):
parameter = None
if len(context.parameter) == 1:
parameter = context.parameter[0]
repo_url = 'https://github.com/xtaodada/PagerMaid-Modify.git'
repo_url = 'https://github.com/Xtao-Labs/PagerMaid-Modify.git'
if parameter:
if parameter == "debug":
@ -121,8 +122,12 @@ async def update(context):
await execute("git pull")
await execute("""cd ../for-update/ && find -H . -type f | awk '{print "cp " $1 " ../PagerMaid-Modify/" $1}' | sh && cd ../PagerMaid-Modify""")
await execute("rm -rf ../for-update/")
await execute("python3 -m pip install -r requirements.txt --upgrade")
await execute("python3 -m pip install -r requirements.txt")
if not exists('install.lock'):
await execute("python3 -m pip install -r requirements.txt --upgrade")
await execute("python3 -m pip install -r requirements.txt")
else:
await execute("/pagermaid/workdir/venv/bin/python -m pip install -r requirements.txt --upgrade")
await execute("/pagermaid/workdir/venv/bin/python -m pip install -r requirements.txt")
await log(f"PagerMaid-Modify {lang('update_is_updated')}")
await context.edit(lang('update_success') + lang('apt_reboot'))
await context.client.disconnect()

View File

@ -11,6 +11,7 @@ coloredlogs
requests
pytz
cowpy
googletrans>=4.0.0-rc1
pygoogletranslation
translate
gtts>=2.2.2