mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 20:38:51 +00:00
NeteaseMusic插件修改FastTelethon导入提示
This commit is contained in:
parent
a94fe5efb0
commit
75a747dad9
@ -282,10 +282,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "neteasemusic",
|
"name": "neteasemusic",
|
||||||
"version": "3.8",
|
"version": "3.9",
|
||||||
"section": "daily",
|
"section": "daily",
|
||||||
"maintainer": "TNTcraftHIM",
|
"maintainer": "TNTcraftHIM",
|
||||||
"size": "27.9 kb",
|
"size": "28.9 kb",
|
||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "网易云搜歌/随机热歌/点歌",
|
"des-short": "网易云搜歌/随机热歌/点歌",
|
||||||
"des": "可以在线搜索并且快速点歌(可回复信息点歌),也支持随机热歌功能,支持解锁VIP/灰色歌曲。命令:nem。"
|
"des": "可以在线搜索并且快速点歌(可回复信息点歌),也支持随机热歌功能,支持解锁VIP/灰色歌曲。命令:nem。"
|
||||||
|
@ -10,7 +10,7 @@ from time import sleep
|
|||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
from pagermaid import bot
|
from pagermaid import bot
|
||||||
from pagermaid.utils import obtain_message
|
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 os.path import exists
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from telethon.tl.types import DocumentAttributeAudio
|
from telethon.tl.types import DocumentAttributeAudio
|
||||||
@ -459,19 +459,25 @@ async def nem(context):
|
|||||||
if not exists("plugins/NeteaseMusicExtra/FastTelethon.py"):
|
if not exists("plugins/NeteaseMusicExtra/FastTelethon.py"):
|
||||||
if not exists("plugins/NeteaseMusicExtra"):
|
if not exists("plugins/NeteaseMusicExtra"):
|
||||||
mkdir("plugins/NeteaseMusicExtra")
|
mkdir("plugins/NeteaseMusicExtra")
|
||||||
|
for ____ in range(6): # 最多尝试6次
|
||||||
faster = requests.request(
|
faster = requests.request(
|
||||||
"GET", "https://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py")
|
"GET", "https://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py")
|
||||||
for ____ in range(6): # 最多尝试6次
|
|
||||||
if faster.status_code == 200:
|
if faster.status_code == 200:
|
||||||
with open("plugins/NeteaseMusicExtra/FastTelethon.py", "wb") as f:
|
with open("plugins/NeteaseMusicExtra/FastTelethon.py", "wb") as f:
|
||||||
f.write(faster.content)
|
f.write(faster.content)
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
if exists("plugins/NeteaseMusicExtra/NoFastTelethon.txt"):
|
||||||
|
break
|
||||||
try:
|
try:
|
||||||
from NeteaseMusicExtra.FastTelethon import upload_file
|
from NeteaseMusicExtra.FastTelethon import upload_file
|
||||||
file = await upload_file(context.client, open(name, 'rb'), name)
|
file = await upload_file(context.client, open(name, 'rb'), name)
|
||||||
except:
|
except:
|
||||||
file = name
|
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(
|
await context.client.send_file(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user