新增:语音命令;修复:渊下宫带来的查询错误问题;新增:当前状态命令查询洞天宝钱数量

This commit is contained in:
Wuyi无疑 2022-01-06 00:33:49 +08:00
parent eadd9656b3
commit f06a3baff9
4 changed files with 124 additions and 39 deletions

View File

@ -52,6 +52,18 @@ $ pip3 install -r requirements.txt
**作者已经转用NoneBot2Hoshino的更新可能未经测试有bug及时提Issues** **作者已经转用NoneBot2Hoshino的更新可能未经测试有bug及时提Issues**
#### 2022-01-06
新增:`原魔`指令,支持模糊查询,例如`原魔使徒`
新增:`语音`指令,不支持模糊查询,发送`语音列表`可查看全部语音id例子:`语音可莉357`请确保运行环境有FFMpeg否则无法正常发送语音。
优化:`开启<自动签到/推送>`命令可由超级管理员at关闭或开启`开启<自动签到/推送>@xxxx`
优化:`武器`指令已支持查询特定等级且可以模糊查询,例如`武器翼90`可查询90级天空之翼的属性
优化:`当前状态`支持查询当前洞天宝钱数量
#### 2021-12-20 #### 2021-12-20
新增8角色查询UI全角色查询UI将会随背景图片改变而改变主题色。 新增8角色查询UI全角色查询UI将会随背景图片改变而改变主题色。
@ -244,22 +256,26 @@ $ pip3 install -r requirements.txt
| 查询(上期)深渊 @人 | | 获取@的群友的深渊信息一览 | 查询深渊 @Wuyi | | | 查询(上期)深渊 @人 | | 获取@的群友的深渊信息一览 | 查询深渊 @Wuyi | |
| 查询(上期)深渊\d @人 | | 获取@的群友的深渊某一层数据 | 查询深渊10 @Wuyi | | | 查询(上期)深渊\d @人 | | 获取@的群友的深渊某一层数据 | 查询深渊10 @Wuyi | |
| 当前状态 | | 获取树脂、每日委托、派遣等信息 | 当前状态 | **必须**绑定过CK和uid | | 当前状态 | | 获取树脂、每日委托、派遣等信息 | 当前状态 | **必须**绑定过CK和uid |
| 开启推送 | | 开启推送超过140树脂提醒旅行者 | 开启推送 | 群聊/私聊都可<br />**必须**绑定过CK和uid | | 开启推送 | @xxx(必须为超级管理员) | 开启推送超过140树脂提醒旅行者 | 开启推送 | 群聊/私聊都可<br />**必须**绑定过CK和uid |
| 关闭推送 | | 关闭树脂快满的提醒 | 关闭推送 | 都可以 | | 关闭推送 | @xxx(必须为超级管理员) | 关闭树脂快满的提醒 | 关闭推送 | 都可以 |
| 校验全部Cookies | | 校验当前池内全部Cookies状态 | 校验全部Cookies | **群聊** | | 校验全部Cookies | | 校验当前池内全部Cookies状态 | 校验全部Cookies | **群聊** |
| 迁移Cookies | | 迁移旧版本上上个版本全部Cookies | 迁移Cookies | **群聊** | | 迁移Cookies | | 迁移旧版本上上个版本全部Cookies | 迁移Cookies | **群聊** |
| 优化Cookies | | 优化上个版本全部Cookies | 优化Cookies | **群聊** | | 优化Cookies | | 优化上个版本全部Cookies | 优化Cookies | **群聊** |
| 签到 | | 米游社签到 | 签到 | **必须**绑定过CK和uid | | 签到 | | 米游社签到 | 签到 | **必须**绑定过CK和uid |
| 开启自动签到 | | 开启每日米游社签到 | 开启自动签到 | 群聊/私聊都可<br />**必须**绑定过CK和uid | | 开启自动签到 | @xxx(必须为超级管理员) | 开启每日米游社签到 | 开启自动签到 | 群聊/私聊都可<br />**必须**绑定过CK和uid |
| 关闭自动签到 | | 关闭每日米游社签到 | 关闭自动签到 | 群聊/私聊都可<br />**必须**绑定过CK和uid | | 关闭自动签到 | @xxx(必须为超级管理员) | 关闭每日米游社签到 | 关闭自动签到 | 群聊/私聊都可<br />**必须**绑定过CK和uid |
| 全部重签 | | 手动重新签到所有人 | 重新自动签到 | **群聊** <br />**必须**由超级管理员执行 | | 全部重签 | | 手动重新签到所有人 | 重新自动签到 | **群聊** <br />**必须**由超级管理员执行 |
| 每月统计 | | 查询当前绑定账号的每月/每日的原石/莫拉 | | 仅限群聊,**必须**绑定Cookies和uid | | 每月统计 | | 查询当前绑定账号的每月/每日的原石/莫拉 | | 仅限群聊,**必须**绑定Cookies和uid |
| 武器 | | 查询武器信息 | 武器天空之卷 | | | 武器 | | 查询武器信息 | 武器天空之卷 | 支持模糊查询 |
| 命座\d | | 查询角色命座信息 | 命座6可莉 | | | 武器 | \d | 查询武器某个等级的属性 | 武器卷90 | 支持模糊查询 |
| 角色 | | 查询角色简略信息 | 角色可莉 | | | 命座\d | | 查询角色命座信息 | 命座6可莉 | 支持模糊查询 |
| 角色 | \d | 查询角色某个等级的属性 | 角色可莉64 | | | 角色 | | 查询角色简略信息 | 角色可莉 | 支持模糊查询 |
| 角色 | <某种类型> | 匹配一整类角色 | 角色燃愿玛瑙 | | | 角色 | \d | 查询角色某个等级的属性 | 角色可莉64 | 支持模糊查询 |
| 材料 | | 输出角色材料列表 | 材料可莉 | | | 角色 | <某种类型> | 匹配一整类角色 | 角色燃愿玛瑙 | 支持模糊查询 |
| 材料 | | 输出角色材料列表 | 材料可莉 | 支持模糊查询 |
| 原魔 | | 原魔名字 | 原魔使徒 | 支持模糊查询 |
| 语音列表 | | 查看全部语音ID | 语音列表 | 不支持模糊查询 |
| 语音 | | 语音+名称+语音ID | 语音可莉357 | **必须**有FFMpeg环境 |
| 查询词云 | | 查询绑定角色的词云 | 查询词云 | 必须绑定过UID/MYSID | | 查询词云 | | 查询绑定角色的词云 | 查询词云 | 必须绑定过UID/MYSID |
### 深渊查询: ### 深渊查询:

View File

@ -2,7 +2,7 @@ from .getImg import draw_pic,draw_abyss_pic,draw_abyss0_pic,draw_wordcloud,draw_
from .getDB import (CheckDB, GetAward, GetCharInfo, GetDaily, GetMysInfo, from .getDB import (CheckDB, GetAward, GetCharInfo, GetDaily, GetMysInfo,
GetSignInfo, GetSignList, GetWeaponInfo, MysSign, OpenPush, GetSignInfo, GetSignList, GetWeaponInfo, MysSign, OpenPush,
connectDB, cookiesDB, deletecache, selectDB, get_alots, connectDB, cookiesDB, deletecache, selectDB, get_alots,
GetEnemiesInfo) GetEnemiesInfo,GetAudioInfo)
from nonebot import * from nonebot import *
from hoshino import Service,R,priv,util from hoshino import Service,R,priv,util
from hoshino.typing import MessageSegment,CQEvent, HoshinoBot from hoshino.typing import MessageSegment,CQEvent, HoshinoBot
@ -16,12 +16,15 @@ import hashlib
import sqlite3 import sqlite3
from io import BytesIO from io import BytesIO
import urllib import urllib
import requests
from base64 import b64encode
sv = Service('genshinuid') sv = Service('genshinuid')
bot = get_bot() bot = get_bot()
FILE_PATH = os.path.dirname(__file__) FILE_PATH = os.path.dirname(__file__)
FILE2_PATH = os.path.join(FILE_PATH,'mys') FILE2_PATH = os.path.join(FILE_PATH,'mys')
INDEX_PATH = os.path.join(FILE2_PATH, 'index')
Texture_PATH = os.path.join(FILE2_PATH,'texture2d') Texture_PATH = os.path.join(FILE2_PATH,'texture2d')
avatar_json = { avatar_json = {
@ -64,7 +67,8 @@ avatar_json = {
"Shogun": "雷电将军", "Shogun": "雷电将军",
"Aloy": "埃洛伊", "Aloy": "埃洛伊",
"Sara": "九条裟罗", "Sara": "九条裟罗",
"Kokomi": "珊瑚宫心海" "Kokomi": "珊瑚宫心海",
"Shenhe":"申鹤"
} }
daily_im = ''' daily_im = '''
@ -73,6 +77,7 @@ daily_im = '''
原粹树脂{}/{}{} 原粹树脂{}/{}{}
每日委托{}/{} 奖励{}领取 每日委托{}/{} 奖励{}领取
周本减半{}/{} 周本减半{}/{}
洞天宝钱{}
探索派遣 探索派遣
总数/完成/上限{}/{}/{} 总数/完成/上限{}/{}/{}
{}''' {}'''
@ -113,6 +118,56 @@ char_info_im = '''{}
cv{} cv{}
介绍{}''' 介绍{}'''
audio_json = {
"357":["357_01","357_02","357_03"],
"1000000":["1000000_01","1000000_02","1000000_03","1000000_04","1000000_05","1000000_06","1000000_07"],
"1000001":["1000001_01","1000001_02","1000001_03"],
"1000002":["1000002_01","1000002_02","1000002_03"],
"1000100":["1000100_01","1000100_02","1000100_03","1000100_04","1000100_05"],
"1000101":["1000101_01","1000101_02","1000101_03","1000101_04","1000101_05","1000101_06"],
"1000200":["1000200_01","1000200_02","1000200_03"],
"1010201":["1010201_01"],
"1000300":["1000300_01","1000300_02"],
"1000400":["1000400_01","1000400_02","1000400_03"],
"1000500":["1000500_01","1000500_02","1000500_03"],
"1010000":["1010000_01","1010000_02","1010000_03","1010000_04","1010000_05"],
"1010001":["1010001_01","1010001_02"],
"1010100":["1010100_01","1010100_02","1010100_03","1010100_04","1010100_05"],
"1010200":["1010200_01","1010200_02","1010200_03","1010200_04","1010200_05"],
"1010300":["1010300_01","1010300_02","1010300_03","1010300_04","1010300_05"],
"1010301":["1010301_01","1010301_02","1010301_03","1010301_04","1010301_05"],
"1010400":["1010400_01","1010400_02","1010400_03"],
"1020000":["1020000_01"]
}
@sv.on_prefix('语音')
async def _(bot:HoshinoBot, ev: CQEvent):
message = ev.message.extract_plain_text()
message = message.replace(' ', "")
name = ''.join(re.findall('[\u4e00-\u9fa5]', message))
if name == "列表":
f=open(os.path.join(INDEX_PATH,"语音.png"),'rb')
ls_f = base64.b64encode(f.read()).decode()
imgmes = 'base64://' + ls_f
f.close()
im = f"[CQ:image,file={imgmes}]"
await bot.send(ev,im)
elif name == "":
return
else:
audioid = re.findall(r"[0-9]+", message)[0]
if audioid in audio_json:
audioid = random.choice(audio_json[audioid])
url = await GetAudioInfo(name,audioid)
audio = BytesIO(requests.get(url).content)
audios = 'base64://' + b64encode(audio.getvalue()).decode()
im = f"[CQ:record,file={audios}]"
try:
await bot.send(ev,im)
except:
await bot.send(ev,"不存在该语音ID或者不存在该角色。")
@sv.on_fullmatch('活动列表') @sv.on_fullmatch('活动列表')
async def _(bot:HoshinoBot, ev: CQEvent): async def _(bot:HoshinoBot, ev: CQEvent):
img_path = os.path.join(FILE2_PATH,"event.jpg") img_path = os.path.join(FILE2_PATH,"event.jpg")
@ -699,8 +754,9 @@ async def daily(mode="push", uid=None):
f"{avatar_name} 剩余时间{remained_timed}") f"{avatar_name} 剩余时间{remained_timed}")
expedition_data = "\n".join(expedition_info) expedition_data = "\n".join(expedition_info)
coin = str(dailydata["current_home_coin"]) + "/" + str(dailydata["max_home_coin"])
send_mes = daily_im.format(tip, current_resin, max_resin, rec_time, finished_task_num, total_task_num, is_extra_got, used_resin_discount_num, send_mes = daily_im.format(tip, current_resin, max_resin, rec_time, finished_task_num, total_task_num, is_extra_got, used_resin_discount_num,
resin_discount_num_limit, current_expedition_num, finished_expedition_num, max_expedition_num, expedition_data) resin_discount_num_limit, coin,current_expedition_num, finished_expedition_num, max_expedition_num, expedition_data)
temp_list.append( temp_list.append(
{"qid": row[2], "gid": row[3], "message": send_mes}) {"qid": row[2], "gid": row[3], "message": send_mes})

View File

@ -667,7 +667,17 @@ async def GetMysInfo(mysid,ck):
except Exception as e: except Exception as e:
print("米游社信息读取老Api失败") print("米游社信息读取老Api失败")
print(e.with_traceback) print(e.with_traceback)
async def GetAudioInfo(name,audioid,language = "cn"):
url = "https://genshin.minigg.cn/?characters=" + name + "&audioid=" + audioid + "&language=" + language
async with AsyncClient() as client:
req = await client.get(
url=url,
headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
'Referer': 'https://genshin.minigg.cn/index.html'})
return req.text
async def GetWeaponInfo(name,level = None): async def GetWeaponInfo(name,level = None):
async with AsyncClient() as client: async with AsyncClient() as client:
req = await client.get( req = await client.get(

View File

@ -978,50 +978,53 @@ async def draw_pic(uid,nickname,image = None,mode = 2,role_level = None):
text_draw.text((640, 183.9),raw_data['stats']['spiral_abyss'], new_color, ys_font(26)) text_draw.text((640, 183.9),raw_data['stats']['spiral_abyss'], new_color, ys_font(26))
#宝箱 #宝箱
text_draw.text((258, 382.4),str(raw_data['stats']['magic_chest_number']), new_color, ys_font(24)) text_draw.text((258, 375.4),str(raw_data['stats']['magic_chest_number']), new_color, ys_font(24))
text_draw.text((258, 442),str(raw_data['stats']['common_chest_number']),new_color, ys_font(24)) text_draw.text((258, 425.4),str(raw_data['stats']['common_chest_number']),new_color, ys_font(24))
text_draw.text((258, 501.6),str(raw_data['stats']['exquisite_chest_number']),new_color, ys_font(24)) text_draw.text((258, 475.4),str(raw_data['stats']['exquisite_chest_number']),new_color, ys_font(24))
text_draw.text((258, 561.2),str(raw_data['stats']['precious_chest_number']), new_color, ys_font(24)) text_draw.text((258, 525.4),str(raw_data['stats']['precious_chest_number']), new_color, ys_font(24))
text_draw.text((258, 620.8),str(raw_data['stats']['luxurious_chest_number']), new_color, ys_font(24)) text_draw.text((258, 575.4),str(raw_data['stats']['luxurious_chest_number']), new_color, ys_font(24))
#已获角色 #已获角色
text_draw.text((258, 680.4),str(raw_data['stats']['avatar_number']),new_color, ys_font(24)) text_draw.text((740, 547),str(raw_data['stats']['avatar_number']),new_color, ys_font(24))
#开启锚点和秘境数量 #开启锚点和秘境数量
text_draw.text((745, 474.5),str(raw_data['stats']['way_point_number']),new_color, ys_font(24)) text_draw.text((258, 625.4),str(raw_data['stats']['way_point_number']),new_color, ys_font(24))
text_draw.text((745, 514),str(raw_data['stats']['domain_number']),new_color, ys_font(24)) text_draw.text((258, 675.4),str(raw_data['stats']['domain_number']),new_color, ys_font(24))
#蒙德 #蒙德
text_draw.text((490, 370),str(raw_data['world_explorations'][3]['exploration_percentage']/10) + '%',new_color, ys_font(22)) text_draw.text((490, 370),str(raw_data['world_explorations'][4]['exploration_percentage']/10) + '%',new_color, ys_font(22))
text_draw.text((490, 400),'lv.' + str(raw_data['world_explorations'][3]['level']),new_color, ys_font(22)) text_draw.text((490, 400),'lv.' + str(raw_data['world_explorations'][4]['level']),new_color, ys_font(22))
text_draw.text((513, 430), str(raw_data['stats']['anemoculus_number']), new_color, ys_font(22)) text_draw.text((513, 430), str(raw_data['stats']['anemoculus_number']), new_color, ys_font(22))
#璃月 #璃月
text_draw.text((490, 490),str(raw_data['world_explorations'][2]['exploration_percentage']/10) + '%',new_color, ys_font(22)) text_draw.text((490, 490),str(raw_data['world_explorations'][3]['exploration_percentage']/10) + '%',new_color, ys_font(22))
text_draw.text((490, 520),'lv.' + str(raw_data['world_explorations'][2]['level']),new_color, ys_font(22)) text_draw.text((490, 520),'lv.' + str(raw_data['world_explorations'][3]['level']),new_color, ys_font(22))
text_draw.text((513, 550), str(raw_data['stats']['geoculus_number']), new_color, ys_font(22)) text_draw.text((513, 550), str(raw_data['stats']['geoculus_number']), new_color, ys_font(22))
#雪山 #雪山
text_draw.text((745, 379.5),str(raw_data['world_explorations'][1]['exploration_percentage']/10) + '%',new_color, ys_font(22)) text_draw.text((745, 373.5),str(raw_data['world_explorations'][2]['exploration_percentage']/10) + '%',new_color, ys_font(22))
text_draw.text((745, 413.1),'lv.' + str(raw_data['world_explorations'][1]['level']),new_color, ys_font(22)) text_draw.text((745, 407.1),'lv.' + str(raw_data['world_explorations'][2]['level']),new_color, ys_font(22))
#稻妻 #稻妻
text_draw.text((490, 608),str(raw_data['world_explorations'][0]['exploration_percentage']/10) + '%',new_color, ys_font(22)) text_draw.text((490, 608),str(raw_data['world_explorations'][1]['exploration_percentage']/10) + '%',new_color, ys_font(22))
text_draw.text((490, 635),'lv.' + str(raw_data['world_explorations'][0]['level']),new_color, ys_font(22)) text_draw.text((490, 635),'lv.' + str(raw_data['world_explorations'][1]['level']),new_color, ys_font(22))
text_draw.text((490, 662),'lv.' + str(raw_data['world_explorations'][0]['offerings'][0]['level']),new_color, ys_font(22)) text_draw.text((490, 662),'lv.' + str(raw_data['world_explorations'][1]['offerings'][0]['level']),new_color, ys_font(22))
text_draw.text((513, 689), str(raw_data['stats']['electroculus_number']), new_color, ys_font(22)) text_draw.text((513, 689), str(raw_data['stats']['electroculus_number']), new_color, ys_font(22))
#渊下宫
text_draw.text((745, 480),str(raw_data['world_explorations'][0]['exploration_percentage']/10) + '%',new_color, ys_font(22))
#家园 #家园
if len(raw_data['homes']): if len(raw_data['homes']):
text_draw.text((693, 572.4),'lv.' + str(raw_data['homes'][0]['level']),new_color, ys_font(22)) text_draw.text((693, 582.4),'lv.' + str(raw_data['homes'][0]['level']),new_color, ys_font(22))
text_draw.text((693, 610.4),str(raw_data['homes'][0]['visit_num']),new_color, ys_font(22)) text_draw.text((693, 620.4),str(raw_data['homes'][0]['visit_num']),new_color, ys_font(22))
text_draw.text((693, 648.4),str(raw_data['homes'][0]['item_num']),new_color, ys_font(22)) text_draw.text((693, 658.4),str(raw_data['homes'][0]['item_num']),new_color, ys_font(22))
text_draw.text((693, 686.4),str(raw_data['homes'][0]['comfort_num']),new_color, ys_font(22)) text_draw.text((693, 696.4),str(raw_data['homes'][0]['comfort_num']),new_color, ys_font(22))
else: else:
text_draw.text((693, 572.4),"未开",new_color, ys_font(22)) text_draw.text((693, 582.4),"未开",new_color, ys_font(22))
text_draw.text((693, 610.4),"未开",new_color, ys_font(22)) text_draw.text((693, 620.4),"未开",new_color, ys_font(22))
text_draw.text((693, 648.4),"未开",new_color, ys_font(22)) text_draw.text((693, 658.4),"未开",new_color, ys_font(22))
text_draw.text((693, 686.4),"未开",new_color, ys_font(22)) text_draw.text((693, 696.4),"未开",new_color, ys_font(22))
#确定texture2D路径 #确定texture2D路径
charpic_mask_path = os.path.join(TEXT_PATH,"charpic_mask.png") charpic_mask_path = os.path.join(TEXT_PATH,"charpic_mask.png")