mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 02:35:34 +00:00
* Update xtao-some.py * Update list.json
This commit is contained in:
parent
4334747710
commit
4ec5cd7f7f
@ -62,13 +62,13 @@
|
||||
},
|
||||
{
|
||||
"name": "xtao-some",
|
||||
"version": "1.11",
|
||||
"version": "1.12",
|
||||
"section": "daily",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "18.8 kb",
|
||||
"supported": true,
|
||||
"des-short": "一大堆便民功能。",
|
||||
"des": "超多功能 例如 -ip -pixiv -guess 等。"
|
||||
"des": "超多功能 例如 -ip -ipping -guess 等。"
|
||||
},
|
||||
{
|
||||
"name": "yb-dl",
|
||||
@ -332,13 +332,13 @@
|
||||
},
|
||||
{
|
||||
"name": "vip",
|
||||
"version": "0.1",
|
||||
"version": "0.2",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "4.0 kb",
|
||||
"supported": true,
|
||||
"des-short": "vip 捐赠用户功能",
|
||||
"des": "命令:天气:weather 。"
|
||||
"des": "命令:天气:weather Pixiv:pixiv。"
|
||||
},
|
||||
{
|
||||
"name": "calculator",
|
||||
|
120
xtao-some.py
120
xtao-some.py
@ -228,126 +228,6 @@ async def ipping(context):
|
||||
await context.edit('没有找到要查询的 ip/域名 ...')
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="pixiv",
|
||||
description="查询插画信息 (或者回复一条消息)",
|
||||
parameters="[<图片链接>] <图片序号>")
|
||||
async def pixiv(context):
|
||||
reply = await context.get_reply_message()
|
||||
await context.edit('正在查询中...')
|
||||
try:
|
||||
if reply:
|
||||
try:
|
||||
if context.arguments.strip() == '':
|
||||
pixiv_page = 1
|
||||
else:
|
||||
try:
|
||||
pixiv_page = int(context.arguments.strip())
|
||||
except:
|
||||
await context.edit('呜呜呜出错了...可能参数不是数字')
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
for num in range(0, len(reply.entities)):
|
||||
url = reply.message[reply.entities[num].offset:reply.entities[num].offset + reply.entities[num].length]
|
||||
url = urlparse(url)
|
||||
try:
|
||||
url = str(re.findall(r"\d+\.?\d*", url.path)[0])
|
||||
pixiv_json = json.loads(requests.get(
|
||||
"https://api.imjad.cn/pixiv/v2/?type=illust&id=" + url).content.decode(
|
||||
"utf-8"))
|
||||
except:
|
||||
await context.edit('呜呜呜出错了...可能是链接不上 API 服务器')
|
||||
return True
|
||||
try:
|
||||
pixiv_tag = pixiv_json['error']['user_message']
|
||||
await context.edit('没有找到要查询的 pixiv 作品...')
|
||||
return True
|
||||
except:
|
||||
if pixiv_page > pixiv_json['illust']['page_count']:
|
||||
await context.edit('呜呜呜出错了...可能是参数指定的页数大于插画页数')
|
||||
return True
|
||||
else:
|
||||
pass
|
||||
pixiv_tag = []
|
||||
pixiv_num = str(pixiv_json['illust']['page_count'])
|
||||
pixiv_list = '[' + pixiv_json['illust']['title'] + '](https://www.pixiv.net/artworks/' + str(
|
||||
pixiv_json['illust']['id']) + ')' + ' (' + str(pixiv_page) + '/' + pixiv_num + ')'
|
||||
for nums in range(0, len(pixiv_json['illust']['tags'])):
|
||||
pixiv_tag.extend(['#' + pixiv_json['illust']['tags'][nums]['name']])
|
||||
try:
|
||||
await context.edit('正在下载图片中 ...')
|
||||
try:
|
||||
r = requests.get(pixiv_json['illust']['meta_single_page']['original_image_url'].replace('i.pximg.net','i.pixiv.cat'))
|
||||
except:
|
||||
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('正在上传图片中 ...')
|
||||
await context.client.send_file(context.chat_id, 'pixiv.jpg',
|
||||
caption=pixiv_list + '\nTags: ' + ' , '.join(pixiv_tag),
|
||||
reply_to=reply.id)
|
||||
await context.delete()
|
||||
remove('pixiv.jpg')
|
||||
except:
|
||||
pass
|
||||
return True
|
||||
else:
|
||||
try:
|
||||
url = urlparse(context.arguments.split()[0])
|
||||
if len(context.arguments.split()) == 1:
|
||||
pixiv_page = 1
|
||||
else:
|
||||
try:
|
||||
pixiv_page = int(context.arguments.split()[1])
|
||||
except:
|
||||
await context.edit('呜呜呜出错了...可能参数不是数字')
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
url = str(re.findall(r"\d+\.?\d*", url.path)[0])
|
||||
pixiv_json = json.loads(requests.get(
|
||||
"https://api.imjad.cn/pixiv/v2/?type=illust&id=" + url).content.decode(
|
||||
"utf-8"))
|
||||
except:
|
||||
await context.edit('呜呜呜出错了...可能是链接不上 API 服务器')
|
||||
try:
|
||||
pixiv_tag = pixiv_json['error']['user_message']
|
||||
await context.edit('没有找到要查询的 pixiv 作品...')
|
||||
return True
|
||||
except:
|
||||
if pixiv_page > pixiv_json['illust']['page_count']:
|
||||
await context.edit('呜呜呜出错了...可能是参数指定的页数大于插画页数')
|
||||
return True
|
||||
else:
|
||||
pass
|
||||
pixiv_tag = []
|
||||
pixiv_num = str(pixiv_json['illust']['page_count'])
|
||||
pixiv_list = '[' + pixiv_json['illust']['title'] + '](https://www.pixiv.net/artworks/' + str(
|
||||
pixiv_json['illust']['id']) + ')' + ' (' + str(pixiv_page) + '/' + pixiv_num + ')'
|
||||
for nums in range(0, len(pixiv_json['illust']['tags'])):
|
||||
pixiv_tag.extend(['#' + pixiv_json['illust']['tags'][nums]['name']])
|
||||
try:
|
||||
await context.edit('正在下载图片中 ...')
|
||||
try:
|
||||
r = requests.get(pixiv_json['illust']['meta_single_page']['original_image_url'].replace('i.pximg.net','i.pixiv.cat'))
|
||||
except:
|
||||
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('正在上传图片中 ...')
|
||||
await context.client.send_file(context.chat_id, 'pixiv.jpg',
|
||||
caption=pixiv_list + '\nTags: ' + ' , '.join(pixiv_tag))
|
||||
await context.delete()
|
||||
remove('pixiv.jpg')
|
||||
except:
|
||||
pass
|
||||
return True
|
||||
await context.edit('没有找到要查询的 pixiv 作品 ...')
|
||||
except:
|
||||
await context.edit('没有找到要查询的 pixiv 作品 ...')
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="t",
|
||||
description="通过腾讯AI开放平台将目标消息翻译成指定的语言。",
|
||||
parameters="<文本>")
|
||||
|
Loading…
Reference in New Issue
Block a user