From c49eafe20212970adf53846b507aab2cae2689a4 Mon Sep 17 00:00:00 2001 From: AAA <35992542+TNTcraftHIM@users.noreply.github.com> Date: Sun, 18 Oct 2020 15:22:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?NeteaseMusic=E6=8F=92=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9FastTelethon=E5=AF=BC=E5=85=A5=E6=8F=90=E7=A4=BA=20(#6?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: TNTcraftHIM --- list.json | 4 ++-- neteasemusic.py | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/list.json b/list.json index 699c9f4..606de14 100644 --- a/list.json +++ b/list.json @@ -282,10 +282,10 @@ }, { "name": "neteasemusic", - "version": "3.8", + "version": "3.9", "section": "daily", "maintainer": "TNTcraftHIM", - "size": "27.9 kb", + "size": "28.9 kb", "supported": true, "des-short": "网易云搜歌/随机热歌/点歌", "des": "可以在线搜索并且快速点歌(可回复信息点歌),也支持随机热歌功能,支持解锁VIP/灰色歌曲。命令:nem。" diff --git a/neteasemusic.py b/neteasemusic.py index 6096dda..347358f 100644 --- a/neteasemusic.py +++ b/neteasemusic.py @@ -10,7 +10,7 @@ from time import sleep from pagermaid.listener import listener from pagermaid import bot from pagermaid.utils import obtain_message -from os import remove, path, mkdir +from os import remove, path, mkdir, getcwd from os.path import exists from collections import defaultdict from telethon.tl.types import DocumentAttributeAudio @@ -74,7 +74,7 @@ async def nem(context): sleep(3) await context.delete() return - else: # 错误输入 + else: # 错误输入 await context.edit(helptext) return # 整理关键词 @@ -96,7 +96,7 @@ async def nem(context): else: limit = "5" url = "http://music.163.com/api/search/pc?&s=" + \ - keyword + "&offset=0&limit=" + limit +"&type=1" + keyword + "&offset=0&limit=" + limit + "&type=1" for _ in range(20): # 最多尝试20次 status = False req = requests.request("GET", url, headers=headers) @@ -459,19 +459,25 @@ async def nem(context): if not exists("plugins/NeteaseMusicExtra/FastTelethon.py"): if not exists("plugins/NeteaseMusicExtra"): mkdir("plugins/NeteaseMusicExtra") - faster = requests.request( - "GET", "https://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py") for ____ in range(6): # 最多尝试6次 + faster = requests.request( + "GET", "https://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py") if faster.status_code == 200: with open("plugins/NeteaseMusicExtra/FastTelethon.py", "wb") as f: f.write(faster.content) + break + else: + if exists("plugins/NeteaseMusicExtra/NoFastTelethon.txt"): break try: from NeteaseMusicExtra.FastTelethon import upload_file file = await upload_file(context.client, open(name, 'rb'), name) except: file = name - await bot.send_message(context.chat_id, '(`FastTelethon`支持文件导入失败,上传速度可能受到影响)') + if not exists("plugins/NeteaseMusicExtra/NoFastTelethon.txt"): + with open("plugins/NeteaseMusicExtra/NoFastTelethon.txt", "w") as f: + f.write("此文件出现表示FastTelethon支持文件在首次运行NeteaseMusic插件时导入失败\n这可能是因为Github服务器暂时性的访问出错导致的\nFastTelethon可以提升低网络性能机型在上传文件时的效率,但是正常情况提升并不明显\n如想要手动导入,可以手动下载:\nhttps://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py\n并放入当前文件夹") + await bot.send_message(context.chat_id, '`FastTelethon`支持文件导入失败,上传速度可能受到影响\n此提示仅出现**一次**,手动导入可参考:\n`' + getcwd() + '/plugins/NeteaseMusicExtra/NoFastTelethon.txt`') await context.client.send_file( context.chat_id, From 85ba149d67b34c33fa50d7fb9fda581c1b87871a Mon Sep 17 00:00:00 2001 From: Pentacene <48641773+Pentacene@users.noreply.github.com> Date: Tue, 27 Oct 2020 22:18:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Portball=20=E6=94=AF=E6=8C=81=E5=8C=BF?= =?UTF-8?q?=E5=90=8D=E7=BE=A4=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portball.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portball.py b/portball.py index 52ed965..c6b3ecb 100644 --- a/portball.py +++ b/portball.py @@ -37,7 +37,7 @@ async def portball(context): pass return False admins = await context.client.get_participants(context.chat, filter=ChannelParticipantsAdmins) - if context.sender in admins: + if (context.sender in admins) or (context.sender_id == 1087968824): try: await bot.edit_permissions(context.chat_id, reply.sender.id, timedelta(seconds=int(action[1].replace(' ',''))), send_messages=False, send_media=False, send_stickers=False, send_gifs=False, send_games=False, send_inline=False, send_polls=False, invite_users=False, change_info=False, pin_messages=False) portball_message = await bot.send_message( From df928519f3248580b28176eb7d24d25e3c9e3da4 Mon Sep 17 00:00:00 2001 From: Pentacene <48641773+Pentacene@users.noreply.github.com> Date: Tue, 27 Oct 2020 22:20:43 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Portball=201.3=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8C=BF=E5=90=8D=E7=BE=A4=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/list.json b/list.json index 606de14..76f98af 100644 --- a/list.json +++ b/list.json @@ -152,7 +152,7 @@ }, { "name": "portball", - "version": "1.22", + "version": "1.3", "section": "chat", "maintainer": "Pentacene", "size": "3.6 kb", From 2b5987ec68e22157a08423eb0267611cef6c36fc Mon Sep 17 00:00:00 2001 From: Xtao_dada Date: Sun, 8 Nov 2020 00:17:37 +0800 Subject: [PATCH 4/4] =?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('正在上传图片中 ...')