update genshin

This commit is contained in:
hibiki 2021-06-21 09:53:33 +08:00
parent 647ead8b6d
commit 862776b011
403 changed files with 138 additions and 239 deletions

View File

@ -84,10 +84,10 @@ MUTE_LEVEL: int = 5 # 更改禁言设置权限
# 需要为哪些群更新最新版gocq吗上传最新版gocq
# 示例:[434995955, 239483248]
UPDATE_GOCQ_GROUP: List[int] = [774261838]
UPDATE_GOCQ_GROUP: List[int] = []
# 代理
system_proxy: str = 'http://127.0.0.1:7890'
system_proxy: str = ''
buff_proxy: str = ''
# 是否存储色图

View File

@ -58,6 +58,8 @@ async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
msg = get_message_text(event.json())
imgs = get_message_imgs(event.json())
if not msg and not imgs:
await custom_welcome.finish('格式:自定义群欢迎消息 [文本] [图片]\n\t示例:自定义群欢迎消息 我们都是萝莉控,你呢? [图片]')
await custom_welcome.finish(await custom_group_welcome(msg, imgs, event.user_id, event.group_id), at_sender=True)

View File

@ -24,7 +24,7 @@ async def _(bot: Bot, event: GroupAdminNoticeEvent, state: T_State):
if event.sub_type == 'set':
await LevelUser.set_level(event.user_id, event.group_id, ADMIN_DEFAULT_AUTH)
logger.info(f'为新晋管理员 {nickname}({event.user_id}) 添加权限等级:{ADMIN_DEFAULT_AUTH}')
if event.sub_type == 'unset':
elif event.sub_type == 'unset':
await LevelUser.delete_level(event.user_id, event.group_id)
logger.info(f'将非管理员 {nickname}({event.user_id}) 取消权限等级')

View File

@ -8,6 +8,7 @@ from util.utils import get_message_text
from nonebot.adapters.cqhttp.permission import PRIVATE
from util.utils import UserExistLimiter
from asyncio.exceptions import TimeoutError
from aiohttp.client_exceptions import ServerDisconnectedError
__plugin_name__ = '磁力搜索'
__plugin_usage__ = r"""
@ -67,9 +68,17 @@ async def _(bot: Bot, event: PrivateMessageEvent, state: T_State):
f'种子:{link}')
send_flag = True
except TimeoutError:
pass
_ulmt.set_False(event.user_id)
await bt.finish(f'搜索 {keyword} 超时...')
except ServerDisconnectedError:
_ulmt.set_False(event.user_id)
await bt.finish(f'搜索 {keyword} 连接失败')
except Exception as e:
_ulmt.set_False(event.user_id)
await bt.finish(f'bt 其他未知错误..')
logger.error(f'bt 错误 e{e}')
if not send_flag:
await bt.send(f'{keyword} 超时或未搜索到...')
await bt.send(f'{keyword} 未搜索到...')
logger.info(f'USER {event.user_id} BT搜索 {keyword}{page}')
_ulmt.set_False(event.user_id)

View File

@ -120,7 +120,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
if msg.find('1井') != -1 or msg.find('一井') != -1:
num = 200
if msg.find("") == -1:
pool_name = 'horse'
pool_name = 'char'
else:
pool_name = 'card'
else:
@ -131,7 +131,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
num = num[1:]
pool_name = 'card'
else:
pool_name = 'horse'
pool_name = 'char'
num, flag = check_num(num, 200)
if not flag:
await pretty.finish(num, at_sender=True)

View File

@ -36,12 +36,15 @@ def is_expired(data: dict):
# 检查写入
def check_write(data: dict, up_char_file, game_name: str = ''):
tmp = data
if game_name == 'genshin':
if game_name in ['genshin', 'pretty']:
tmp = data['char']
if not is_expired(tmp):
if game_name == 'genshin':
if game_name in ['genshin']:
data['char']['title'] = ''
data['arms']['title'] = ''
elif game_name in ['pretty']:
data['char']['title'] = ''
data['card']['title'] = ''
else:
data['title'] = ''
else:
@ -54,7 +57,7 @@ def check_write(data: dict, up_char_file, game_name: str = ''):
with open(up_char_file, 'r', encoding='utf8') as f:
old_data = json.load(f)
tmp = old_data
if game_name == 'genshin':
if game_name in ['genshin', 'pretty']:
tmp = old_data['char']
if is_expired(tmp):
return old_data

View File

@ -1,6 +1,7 @@
import asyncio
import nonebot
import os
from services.log import logger
from .pcr_handle import update_pcr_info, init_pcr_data
from .azur_handle import update_azur_info, init_azur_data
from .prts_handle import update_prts_info, init_prts_data
@ -55,9 +56,13 @@ async def async_update_game():
tasks.append(asyncio.ensure_future(update_onmyoji_info()))
init_lst.remove(init_onmyoji_data)
await asyncio.gather(*tasks)
for func in init_lst:
await func()
try:
await asyncio.gather(*tasks)
for func in init_lst:
await func()
except asyncio.exceptions.CancelledError:
logger.info('更新异常CancelledError再次更新...')
await async_update_game()

View File

@ -10,6 +10,7 @@ from dataclasses import dataclass
from .init_card_pool import init_game_pool
from util.init_result import image
from configs.path_config import IMAGE_PATH
from services.log import logger
try:
import ujson as json
@ -89,6 +90,7 @@ async def update_pretty_info():
data, code = await update_info(url, 'pretty_card')
if code == 200:
ALL_CARD = init_game_pool('pretty_card', data, PrettyChar)
await _init_up_char()
async def init_pretty_data():
@ -100,6 +102,7 @@ async def init_pretty_data():
pretty_card_dict = json.load(f)
ALL_CHAR = init_game_pool('pretty', pretty_char_dict, PrettyChar)
ALL_CARD = init_game_pool('pretty_card', pretty_card_dict, PrettyChar)
await _init_up_char()
# 抽取卡池
@ -149,7 +152,7 @@ async def _init_up_char():
os.remove(IMAGE_PATH + '/draw_card/pretty/up_char_pool_img.png')
if os.path.exists(IMAGE_PATH + '/draw_card/genshin/up_arms_pool_img.png'):
os.remove(IMAGE_PATH + '/draw_card/pretty/up_card_pool_img.png')
print(f'成功获取赛马娘当前up信息...当前up池: {_CURRENT_CHAR_POOL_TITLE} & {_CURRENT_CARD_POOL_TITLE}')
logger.info(f'成功获取赛马娘当前up信息...当前up池: {_CURRENT_CHAR_POOL_TITLE} & {_CURRENT_CARD_POOL_TITLE}')
for key in up_char_dict.keys():
for star in up_char_dict[key]['up_char'].keys():
up_lst = []

View File

@ -36,7 +36,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
if resource_name == "" or resource_name not in in_list:
return
await qr.send(get_resource_map_mes(resource_name), at_sender=True)
await qr.send(await get_resource_map_mes(resource_name), at_sender=True)
logger.info(
f"(USER {event.user_id}, GROUP {event.group_id if event.message_type != 'private' else 'private'})"
f" 查询原神材料:" + resource_name)
@ -52,7 +52,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
rs = re.search('.*?(哪有|哪里有)(.*)', msg)
resource_name = rs.group(2) if rs else ''
if resource_name:
msg = get_resource_map_mes(resource_name)
msg = await get_resource_map_mes(resource_name)
if msg == '发送 原神资源列表 查看所有资源名称':
return
await rex_qr.send(msg, at_sender=True)
@ -100,7 +100,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
)
async def _():
try:
up_label_and_point_list()
await up_label_and_point_list()
logger.info(f'每日更新原神材料信息成功!')
except Exception as e:
logger.error(f'每日更新原神材料信息错误:{e}')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Some files were not shown because too many files have changed in this diff Show More