mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-22 11:42:49 +00:00
netease 网易云音乐
This commit is contained in:
parent
28cd4492ff
commit
d6a522bdb1
22
list.json
22
list.json
@ -8,7 +8,7 @@
|
||||
"size": "12.9 kb",
|
||||
"supported": true,
|
||||
"des-short": "一大堆便民功能。",
|
||||
"des": "超多功能 例如 -ip"
|
||||
"des": "超多功能 例如 ,ip"
|
||||
},
|
||||
{
|
||||
"name": "eat",
|
||||
@ -98,7 +98,7 @@
|
||||
"size": "2.09 kb",
|
||||
"supported": true,
|
||||
"des-short": "查询信用卡bin信息。",
|
||||
"des": "使用binlist api查询,1分钟限额10次否则报错。使用方法:-bin xxx (xxx为信用卡卡号前4-8位,推荐6位)"
|
||||
"des": "使用binlist api查询,1分钟限额10次否则报错。使用方法:,bin xxx (xxx为信用卡卡号前4-8位,推荐6位)"
|
||||
},
|
||||
{
|
||||
"name": "tel",
|
||||
@ -118,7 +118,7 @@
|
||||
"size": "1.3 kb",
|
||||
"supported": true,
|
||||
"des-short": "每日新闻、历史上的今天、天天成语、慧语香风、诗歌天地",
|
||||
"des": "每日新闻、历史上的今天、天天成语、慧语香风、诗歌天地。\n指令:-news"
|
||||
"des": "每日新闻、历史上的今天、天天成语、慧语香风、诗歌天地。\n指令:,news"
|
||||
},
|
||||
{
|
||||
"name": "whois",
|
||||
@ -178,7 +178,7 @@
|
||||
"size": "5.3 kb",
|
||||
"supported": true,
|
||||
"des-short": "自动转发/备份频道消息",
|
||||
"des": "自动转发频道新消息或者从零开始备份频道。\n指令:-shift\n查看帮助:-help shift"
|
||||
"des": "自动转发频道新消息或者从零开始备份频道。\n指令:,shift\n查看帮助:,help shift"
|
||||
},
|
||||
{
|
||||
"name": "dme",
|
||||
@ -188,7 +188,7 @@
|
||||
"size": "506 b",
|
||||
"supported": true,
|
||||
"des-short": "删除当前对话您发送的特定数量的消息。",
|
||||
"des": "删除当前对话您发送的特定数量的消息。\n指令:-dme"
|
||||
"des": "删除当前对话您发送的特定数量的消息。\n指令:,dme"
|
||||
},
|
||||
{
|
||||
"name": "premium",
|
||||
@ -238,7 +238,17 @@
|
||||
"size": "10.0 kb",
|
||||
"supported": true,
|
||||
"des-short": "将回复的消息转换成语录图片",
|
||||
"des": "将回复的消息或者输入字符串转换成语录图片。\n指令:-yvlu"
|
||||
"des": "将回复的消息或者输入字符串转换成语录图片。\n指令:,yvlu"
|
||||
},
|
||||
{
|
||||
"name": "netease",
|
||||
"version": "1.0",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "2.91 kb",
|
||||
"supported": true,
|
||||
"des-short": "网易云音乐",
|
||||
"des": "网易云音乐。\n指令:,netease"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
77
netease/main.py
Normal file
77
netease/main.py
Normal file
@ -0,0 +1,77 @@
|
||||
""" PagerMaid Netease Plugin , Thanks to @Music163bot """
|
||||
|
||||
from pyrogram.errors import YouBlockedUser
|
||||
from pyrogram import filters
|
||||
|
||||
from pagermaid import bot
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.single_utils import Message
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
Netease_Help_Msg = f"""
|
||||
网易云搜/点歌。
|
||||
i.e.
|
||||
`,{alias_command('netease')} 失眠飞行 兔籽鲸 / 雨客Yoker` # 通过歌曲名称+歌手(可选)点歌
|
||||
`,{alias_command('netease')} https://music.163.com/#/song?id=1430702717` # 通过歌曲链接点歌
|
||||
`,{alias_command('netease')} 1430702717` # 通过歌曲 ID 点歌
|
||||
"""
|
||||
|
||||
|
||||
async def netease_start() -> None:
|
||||
try:
|
||||
await bot.send_message("Music163bot", "/start")
|
||||
except YouBlockedUser:
|
||||
await bot.unblock_user("Music163bot")
|
||||
|
||||
|
||||
async def netease_search(keyword: str, message: Message):
|
||||
async with message.bot.conversation("Music163bot") as conv:
|
||||
await conv.send_message(f"/search {keyword}")
|
||||
await conv.mark_as_read()
|
||||
answer: Message = await conv.get_response(filters=~filters.regex("搜索中..."))
|
||||
await conv.mark_as_read()
|
||||
if not answer.reply_markup:
|
||||
return await message.edit(answer.text.html)
|
||||
await bot.request_callback_answer(
|
||||
answer.chat.id, answer.id,
|
||||
callback_data=answer.reply_markup.inline_keyboard[0][0].callback_data)
|
||||
await conv.mark_as_read()
|
||||
answer: Message = await conv.get_response(filters=filters.audio)
|
||||
await conv.mark_as_read()
|
||||
await answer.forward(message.chat.id)
|
||||
await message.safe_delete()
|
||||
|
||||
|
||||
async def netease_url(url: str, message: Message):
|
||||
async with message.bot.conversation("Music163bot") as conv:
|
||||
await conv.send_message(url)
|
||||
await conv.mark_as_read()
|
||||
answer: Message = await conv.get_response(filters=filters.audio)
|
||||
await conv.mark_as_read()
|
||||
await answer.forward(message.chat.id)
|
||||
await message.safe_delete()
|
||||
|
||||
|
||||
async def netease_id(music_id: str, message: Message):
|
||||
async with message.bot.conversation("Music163bot") as conv:
|
||||
await conv.send_message(f"/music {music_id}")
|
||||
await conv.mark_as_read()
|
||||
answer: Message = await conv.get_response(filters=filters.audio)
|
||||
await conv.mark_as_read()
|
||||
await answer.forward(message.chat.id)
|
||||
await message.safe_delete()
|
||||
|
||||
|
||||
@listener(command="netease",
|
||||
description="Netease Music",
|
||||
parameters="<query>",)
|
||||
async def netease_music(message: Message):
|
||||
if not message.arguments:
|
||||
return await message.edit(Netease_Help_Msg)
|
||||
await netease_start()
|
||||
if message.arguments.startswith("http"):
|
||||
return await netease_url(message.arguments, message)
|
||||
if message.arguments.isdigit():
|
||||
return await netease_id(message.arguments, message)
|
||||
return await netease_search(message.arguments, message)
|
Loading…
Reference in New Issue
Block a user