From 2b5987ec68e22157a08423eb0267611cef6c36fc Mon Sep 17 00:00:00 2001 From: Xtao_dada Date: Sun, 8 Nov 2020 00:17:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20xtao-some=20:=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20pixiv=20=E5=8F=8D=E4=BB=A3=20api=20,=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=20,=20=E6=8F=90=E9=86=92=20(#66)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 👷 更新 CI 通知范围 * 👷 修改提醒间隔时间 * 📦 修改 pixiv 反代 api , 优化逻辑 , 提醒 * Update list.json --- .github/workflows/python.yml | 7 +++++-- list.json | 2 +- telegram_update.py | 2 -- xtao-some.py | 18 ++++++------------ 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a6f823a..cf0c91d 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,6 +1,9 @@ name: Github commit to telegram -on: [push] +on: + push: + branches: + - master jobs: build: @@ -25,4 +28,4 @@ jobs: # 发送通知 - name: Send notice - run: python telegram_update.py ${{ secrets.TG_BOT_TOKEN }} \ No newline at end of file + run: python telegram_update.py ${{ secrets.TG_BOT_TOKEN }} diff --git a/list.json b/list.json index 76f98af..6903ef3 100644 --- a/list.json +++ b/list.json @@ -62,7 +62,7 @@ }, { "name": "xtao-some", - "version": "1.01", + "version": "1.10", "section": "daily", "maintainer": "xtaodada", "size": "18.8 kb", diff --git a/telegram_update.py b/telegram_update.py index 9b5d37c..4a84424 100644 --- a/telegram_update.py +++ b/telegram_update.py @@ -2,8 +2,6 @@ import json, time, sys from requests import get, post token = str(sys.argv[1]) - -time.sleep(30) main = json.loads(get("https://api.github.com/repos/xtaodada/PagerMaid_Plugins/commits/master").content) push_content = {} push_content['chat_id'] = '-1001441461877' diff --git a/xtao-some.py b/xtao-some.py index e033075..f5ece22 100644 --- a/xtao-some.py +++ b/xtao-some.py @@ -14,9 +14,7 @@ from os import remove async def guess(context): reply = await context.get_reply_message() await context.edit("获取中 . . .") - if reply: - pass - else: + if not reply: context.edit("宁需要回复一句话") return True text = {'text': str(reply.message.replace("/guess ", "").replace(" ", ""))} @@ -48,7 +46,7 @@ async def admin(context): try: admins = await context.client.get_participants(chat, filter=ChannelParticipantsAdmins) except: - await context.edit('请在群组中运行。') + await context.edit('请在群组中使用。') return True admin_list = [] for admin in admins: @@ -278,11 +276,9 @@ async def pixiv(context): try: await context.edit('正在下载图片中 ...') try: - r = requests.get('https://daidr.me/imageProxy/?url=' + - pixiv_json['illust']['meta_single_page']['original_image_url']) + r = requests.get(pixiv_json['illust']['meta_single_page']['original_image_url'].replace('i.pximg.net','i.pixiv.cat')) except: - r = requests.get('https://daidr.me/imageProxy/?url=' + - pixiv_json['illust']['meta_pages'][pixiv_page - 1]['image_urls']['original']) + r = requests.get(pixiv_json['illust']['meta_pages'][pixiv_page - 1]['image_urls']['original'].replace('i.pximg.net','i.pixiv.cat')) with open("pixiv.jpg", "wb") as code: code.write(r.content) await context.edit('正在上传图片中 ...') @@ -333,11 +329,9 @@ async def pixiv(context): try: await context.edit('正在下载图片中 ...') try: - r = requests.get('https://daidr.me/imageProxy/?url=' + - pixiv_json['illust']['meta_single_page']['original_image_url']) + r = requests.get(pixiv_json['illust']['meta_single_page']['original_image_url'].replace('i.pximg.net','i.pixiv.cat')) except: - r = requests.get('https://daidr.me/imageProxy/?url=' + - pixiv_json['illust']['meta_pages'][pixiv_page - 1]['image_urls']['original']) + r = requests.get(pixiv_json['illust']['meta_pages'][pixiv_page - 1]['image_urls']['original'].replace('i.pximg.net','i.pixiv.cat')) with open("pixiv.jpg", "wb") as code: code.write(r.content) await context.edit('正在上传图片中 ...')