新增米游币自动获取,修复小鹿普攻图标错误

This commit is contained in:
CMHopeSunshine 2022-07-19 15:58:22 +08:00
parent 5a46174323
commit 143b1a3e3d
8 changed files with 107 additions and 84 deletions

View File

@ -3,7 +3,6 @@ import random
import re import re
from asyncio import sleep from asyncio import sleep
from collections import defaultdict from collections import defaultdict
from cv2 import log
from littlepaimon_utils.tools import FreqLimiter from littlepaimon_utils.tools import FreqLimiter
from nonebot import on_command, require, logger, get_bot from nonebot import on_command, require, logger, get_bot
@ -146,20 +145,21 @@ role_info.__paimon_help__ = {
"introduce": "查看指定角色的详细面板信息", "introduce": "查看指定角色的详细面板信息",
"priority": 4 "priority": 4
} }
get_mys_coin = on_command('myb获取',aliases={'米游币获取','获取米游币'},priority=7,block=True) get_mys_coin = on_command('myb获取', aliases={'米游币获取', '获取米游币'}, priority=7, block=True)
get_mys_coin_auto = on_command('myb自动获取',aliases={'米游币自动获取','自动获取米游币'},priority=7,block=True) get_mys_coin_auto = on_command('myb自动获取', aliases={'米游币自动获取', '自动获取米游币'}, priority=7, block=True)
get_mys_coin_auto.__paimon_help__ = { get_mys_coin_auto.__paimon_help__ = {
"usage": "myb自动获取<on|off uid>", "usage": "myb自动获取<on|off uid>",
"introduce": "自动获取米游币", "introduce": "自动获取米游币",
"priority": 10 "priority": 10
} }
add_stoken = on_command('添加stoken',priority=7,block=True) add_stoken = on_command('添加stoken', priority=7, block=True)
add_stoken.__paimon_help__ = { add_stoken.__paimon_help__ = {
"usage": "添加stoken[stoken]", "usage": "添加stoken[stoken]",
"introduce": "添加stoken以获取米游币", "introduce": "添加stoken以获取米游币",
"priority": 99 "priority": 99
} }
@sy.handle() @sy.handle()
@ys.handle() @ys.handle()
@ysa.handle() @ysa.handle()
@ -404,18 +404,14 @@ async def _(event: MessageEvent, state: T_State):
await ysc.finish(total_result) await ysc.finish(total_result)
cookie_error_msg = '这个cookie无效哦请旅行者确认是否正确\n1.ck要登录mys帐号后获取,且不能退出登录\n2.ck中要有cookie_token和account_id两个参数\n3.建议在无痕模式下取' cookie_error_msg = '这个cookie无效哦请旅行者确认是否正确\n1.ck要登录mys帐号后获取,且不能退出登录\n\n获取cookie的教程\ndocs.qq.com/doc/DQ3JLWk1vQVllZ2Z1\n'
@ysb.handle() @ysb.handle()
@exception_handler() @exception_handler()
async def ysb_handler(event: MessageEvent, msg: Message = CommandArg()): async def ysb_handler(event: MessageEvent, msg: Message = CommandArg()):
cookie = str(msg).strip() cookie = msg.extract_plain_text().strip()
if cookie == '': if cookie == '':
# res = '''旅行者好呀你可以直接用ys/ysa等指令附上uid来使用派蒙\n如果想看全部角色信息和实时便笺等功能要把cookie给派蒙哦\ncookie
# 获取方法:登录网页版米游社,在地址栏粘贴代码:\njavascript:(function(){prompt(document.domain,document.cookie)})(
# );\n复制弹窗出来的字符串手机要via或chrome浏览器才行\n然后添加派蒙私聊发送ysb接刚刚复制的字符串例如:ysb
# UM_distinctid=17d131d...\ncookie是账号重要安全信息请确保机器人持有者可信赖 '''
res = '获取cookie的教程\ndocs.qq.com/doc/DQ3JLWk1vQVllZ2Z1\n获取到后添加派蒙好友私聊发送ysb接复制到的cookie就行啦~' res = '获取cookie的教程\ndocs.qq.com/doc/DQ3JLWk1vQVllZ2Z1\n获取到后添加派蒙好友私聊发送ysb接复制到的cookie就行啦~'
await ysb.finish(res, at_sender=True) await ysb.finish(res, at_sender=True)
else: else:
@ -426,6 +422,7 @@ async def ysb_handler(event: MessageEvent, msg: Message = CommandArg()):
msg += '\n当前是在群聊里绑定,建议旅行者添加派蒙好友私聊绑定!' msg += '\n当前是在群聊里绑定,建议旅行者添加派蒙好友私聊绑定!'
await ysb.finish(msg, at_sender=True) await ysb.finish(msg, at_sender=True)
else: else:
uid = nickname = None
for data in cookie_info['data']['list']: for data in cookie_info['data']['list']:
if data['game_id'] == 2: if data['game_id'] == 2:
uid = data['game_role_id'] uid = data['game_role_id']
@ -682,7 +679,8 @@ async def auto_sign():
except Exception as e: except Exception as e:
logger.error(f'米游社签到结果发送失败:{e}') logger.error(f'米游社签到结果发送失败:{e}')
@scheduler.scheduled_job('cron', hour=config.paimon_sign_hour, minute=config.paimon_sign_minute, misfire_grace_time=10)
@scheduler.scheduled_job('cron', hour=config.paimon_coin_hour, minute=config.paimon_coin_minute, misfire_grace_time=10)
async def coin_auto_sign(): async def coin_auto_sign():
data = await get_coin_auto_sign() data = await get_coin_auto_sign()
ann = defaultdict(lambda: defaultdict(list)) ann = defaultdict(lambda: defaultdict(list))
@ -694,23 +692,30 @@ async def coin_auto_sign():
get_coin_task = MihoyoBBSCoin(stoken) get_coin_task = MihoyoBBSCoin(stoken)
data = await get_coin_task.task_run() data = await get_coin_task.task_run()
if get_coin_task.is_Right is False: if get_coin_task.is_Right is False:
ann[remind_id]['失败'].append(f'.UID{uid}') await delete_coin_auto_sign(user_id, uid)
await delete_coin_auto_sign(user_id,uid) if remind_id.startswith('q'):
await get_bot().send_private_msg(user_id=remind_id[1:],
message=f'你的uid{uid}米游币获取失败请重新绑定cookie再开启')
else: else:
ann[remind_id]['成功'].append( ann[remind_id]['失败'].append(f'.UID{uid}')
f'.UID{uid}获取myb成功') else:
if remind_id.startswith('q'):
await get_bot().send_private_msg(user_id=remind_id[1:],
message=f'你的uid{uid}米游币自动获取成功')
else:
ann[remind_id]['成功'].append(f'.UID{uid}')
for group_id, content in ann.items(): for group_id, content in ann.items():
group_str = '米游社自动签到结果:\n' group_str = '米游币自动获取结果:\n'
for type, ann_list in content.items(): for type, ann_list in content.items():
if ann_list: if ann_list:
group_str += f'签到{type}\n' group_str += f'{type}\n'
for u in ann_list: for u in ann_list:
group_str += str(ann_list.index(u) + 1) + u + '\n' group_str += str(ann_list.index(u) + 1) + u + '\n'
try: try:
await get_bot().send_group_msg(group_id=group_id, message=group_str) await get_bot().send_group_msg(group_id=group_id, message=group_str)
await sleep(random.randint(3, 8)) await sleep(random.randint(3, 8))
except Exception as e: except Exception as e:
logger.error(f'米游社签到结果发送失败:{e}') logger.error(f'米游币自动获取结果发送失败:{e}')
@scheduler.scheduled_job('cron', minute=f'*/{config.paimon_check_interval}', misfire_grace_time=10) @scheduler.scheduled_job('cron', minute=f'*/{config.paimon_check_interval}', misfire_grace_time=10)
@ -823,6 +828,7 @@ async def get_mys_coin_handler(event: MessageEvent, msg: Message = CommandArg())
msg = "米游币获取完成\n" + data msg = "米游币获取完成\n" + data
await get_mys_coin.finish(msg) await get_mys_coin.finish(msg)
@get_mys_coin_auto.handle() @get_mys_coin_auto.handle()
@exception_handler() @exception_handler()
async def get_mys_coin_auto_handler(event: MessageEvent, msg: Message = CommandArg()): async def get_mys_coin_auto_handler(event: MessageEvent, msg: Message = CommandArg()):
@ -846,13 +852,14 @@ async def get_mys_coin_auto_handler(event: MessageEvent, msg: Message = CommandA
if not stoken: if not stoken:
await mys_sign_auto.finish('你的该uid还没绑定stoken哦先用添加stoken绑定吧!', at_sender=True) await mys_sign_auto.finish('你的该uid还没绑定stoken哦先用添加stoken绑定吧!', at_sender=True)
await add_coin_auto_sign(str(event.user_id), uid, remind_id) await add_coin_auto_sign(str(event.user_id), uid, remind_id)
await mys_sign_auto.finish('开启米游币自动签到成功,派蒙会在每日0点帮你签到', at_sender=True) await mys_sign_auto.finish('开启米游币自动获取成功,派蒙会在每日0点帮你签到', at_sender=True)
elif find_action.group('action') in ['关闭', '禁用', 'off']: elif find_action.group('action') in ['关闭', '禁用', 'off']:
await delete_coin_auto_sign(str(event.user_id), uid) await delete_coin_auto_sign(str(event.user_id), uid)
await mys_sign_auto.finish('关闭米游币自动签到成功', at_sender=True) await mys_sign_auto.finish('关闭米游币自动获取成功', at_sender=True)
else: else:
await mys_sign_auto.finish('指令错误,在后面加 开启/关闭 来使用哦', at_sender=True) await mys_sign_auto.finish('指令错误,在后面加 开启/关闭 来使用哦', at_sender=True)
@add_stoken.handle() @add_stoken.handle()
@exception_handler() @exception_handler()
async def add_stoken_handler(event: MessageEvent, msg: Message = CommandArg()): async def add_stoken_handler(event: MessageEvent, msg: Message = CommandArg()):

View File

@ -18,35 +18,35 @@ bbs_Shareurl = 'https://bbs-api.mihoyo.com/apihub/api/getShareConf?entity_id={}&
bbs_Likeurl = 'https://bbs-api.mihoyo.com/apihub/sapi/upvotePost' # post json bbs_Likeurl = 'https://bbs-api.mihoyo.com/apihub/sapi/upvotePost' # post json
mihoyobbs_List = [{ mihoyobbs_List = [{
'id' : '1', 'id': '1',
'forumId': '1', 'forumId': '1',
'name' : '崩坏3', 'name': '崩坏3',
'url' : 'https://bbs.mihoyo.com/bh3/' 'url': 'https://bbs.mihoyo.com/bh3/'
}, { }, {
'id' : '2', 'id': '2',
'forumId': '26', 'forumId': '26',
'name' : '原神', 'name': '原神',
'url' : 'https://bbs.mihoyo.com/ys/' 'url': 'https://bbs.mihoyo.com/ys/'
}, { }, {
'id' : '3', 'id': '3',
'forumId': '30', 'forumId': '30',
'name' : '崩坏2', 'name': '崩坏2',
'url' : 'https://bbs.mihoyo.com/bh2/' 'url': 'https://bbs.mihoyo.com/bh2/'
}, { }, {
'id' : '4', 'id': '4',
'forumId': '37', 'forumId': '37',
'name' : '未定事件簿', 'name': '未定事件簿',
'url' : 'https://bbs.mihoyo.com/wd/' 'url': 'https://bbs.mihoyo.com/wd/'
}, { }, {
'id' : '5', 'id': '5',
'forumId': '34', 'forumId': '34',
'name' : '大别野', 'name': '大别野',
'url' : 'https://bbs.mihoyo.com/dby/' 'url': 'https://bbs.mihoyo.com/dby/'
}, { }, {
'id' : '6', 'id': '6',
'forumId': '52', 'forumId': '52',
'name' : '崩坏:星穹铁道', 'name': '崩坏:星穹铁道',
'url' : 'https://bbs.mihoyo.com/sr/' 'url': 'https://bbs.mihoyo.com/sr/'
}] }]
@ -58,34 +58,34 @@ class MihoyoBBSCoin:
def __init__(self, cookies): def __init__(self, cookies):
self.postsList = None self.postsList = None
self.headers = { self.headers = {
'DS' : old_version_get_ds_token(True), 'DS': old_version_get_ds_token(True),
'cookie' : cookies, 'cookie': cookies,
'x-rpc-client_type' : '2', 'x-rpc-client_type': '2',
'x-rpc-app_version' : '2.7.0', 'x-rpc-app_version': '2.7.0',
'x-rpc-sys_version' : '6.0.1', 'x-rpc-sys_version': '6.0.1',
'x-rpc-channel' : 'mihoyo', 'x-rpc-channel': 'mihoyo',
'x-rpc-device_id' : random_hex(32), 'x-rpc-device_id': random_hex(32),
'x-rpc-device_name' : random_text(random.randint(1, 10)), 'x-rpc-device_name': random_text(random.randint(1, 10)),
'x-rpc-device_model': 'Mi 10', 'x-rpc-device_model': 'Mi 10',
'Referer' : 'https://app.mihoyo.com', 'Referer': 'https://app.mihoyo.com',
'Host' : 'bbs-api.mihoyo.com', 'Host': 'bbs-api.mihoyo.com',
'User-Agent' : 'okhttp/4.8.0' 'User-Agent': 'okhttp/4.8.0'
} }
self.Task_do = { self.Task_do = {
'bbs_Sign' : False, 'bbs_Sign': False,
'bbs_Read_posts' : False, 'bbs_Read_posts': False,
'bbs_Read_posts_num': 3, 'bbs_Read_posts_num': 3,
'bbs_Like_posts' : False, 'bbs_Like_posts': False,
'bbs_Like_posts_num': 5, 'bbs_Like_posts_num': 5,
'bbs_Share' : False 'bbs_Share': False
} }
self.mihoyobbs_List_Use = [] self.mihoyobbs_List_Use = []
self.Today_getcoins = 0 self.Today_getcoins = 0
self.Today_have_getcoins = 0 # 这个变量以后可能会用上,先留着了 self.Today_have_getcoins = 0 # 这个变量以后可能会用上,先留着了
self.Have_coins = 0 self.Have_coins = 0
self.is_Right = True #判断stoken是否失效 self.is_Right = True # 判断stoken是否失效
#开始运行 # 开始运行
async def task_run(self): async def task_run(self):
await self.load_mihoyo_bbs_list_use() await self.load_mihoyo_bbs_list_use()
start = await self.get_tasks_list() start = await self.get_tasks_list()
@ -107,13 +107,13 @@ class MihoyoBBSCoin:
# 获取任务列表,用来判断做了哪些任务 # 获取任务列表,用来判断做了哪些任务
async def get_tasks_list(self): async def get_tasks_list(self):
logger.info('正在获取任务列表') # logger.info('正在获取任务列表')
async with AsyncClient() as client: async with AsyncClient() as client:
req = await client.get(url=bbs_Taskslist, headers=self.headers) req = await client.get(url=bbs_Taskslist, headers=self.headers)
data = req.json() data = req.json()
if 'err' in data['message'] or data['retcode'] == -100: if 'err' in data['message'] or data['retcode'] == -100:
self.is_Right = False self.is_Right = False
logger.info('stoken或cookie失效') # logger.info('stoken或cookie失效')
return '你的Cookies或Stoken已失效。' return '你的Cookies或Stoken已失效。'
# log.error('获取任务列表失败你的cookie可能已过期请重新设置cookie。') # log.error('获取任务列表失败你的cookie可能已过期请重新设置cookie。')
else: else:
@ -129,10 +129,10 @@ class MihoyoBBSCoin:
else: else:
# 如果第0个大于或等于62则直接判定任务没做 # 如果第0个大于或等于62则直接判定任务没做
if data['data']['states'][0]['mission_id'] >= 62: if data['data']['states'][0]['mission_id'] >= 62:
logger.info(f'新的一天,今天可以获得{self.Today_getcoins}个米游币') # logger.info(f'新的一天,今天可以获得{self.Today_getcoins}个米游币')
pass pass
else: else:
logger.info(f'似乎还有任务没完成,今天还能获得{self.Today_getcoins}') # logger.info(f'似乎还有任务没完成,今天还能获得{self.Today_getcoins}')
for i in data['data']['states']: for i in data['data']['states']:
# 58是讨论区签到 # 58是讨论区签到
if i['mission_id'] == 58: if i['mission_id'] == 58:
@ -161,19 +161,19 @@ class MihoyoBBSCoin:
# 获取要帖子列表 # 获取要帖子列表
async def get_list(self) -> list: async def get_list(self) -> list:
temp_list = [] temp_list = []
logger.info('正在获取帖子列表......') # logger.info('正在获取帖子列表......')
async with AsyncClient() as client: async with AsyncClient() as client:
req = await client.get(url=bbs_Listurl.format(self.mihoyobbs_List_Use[0]['forumId']), headers=self.headers) req = await client.get(url=bbs_Listurl.format(self.mihoyobbs_List_Use[0]['forumId']), headers=self.headers)
data = req.json() data = req.json()
for n in range(5): for n in range(5):
temp_list.append([data['data']['list'][n]['post']['post_id'], data['data']['list'][n]['post']['subject']]) temp_list.append([data['data']['list'][n]['post']['post_id'], data['data']['list'][n]['post']['subject']])
logger.info('已获取{}个帖子'.format(len(temp_list))) # logger.info('已获取{}个帖子'.format(len(temp_list)))
return temp_list return temp_list
# 进行签到操作 # 进行签到操作
async def signing(self): async def signing(self):
if self.Task_do['bbs_Sign']: if self.Task_do['bbs_Sign']:
logger.info("讨论区任务已经完成过了~") # logger.info("讨论区任务已经完成过了~")
return '讨论区任务已经完成过了~' return '讨论区任务已经完成过了~'
else: else:
for i in self.mihoyobbs_List_Use: for i in self.mihoyobbs_List_Use:
@ -183,14 +183,14 @@ class MihoyoBBSCoin:
if 'err' not in data['message']: if 'err' not in data['message']:
time.sleep(random.randint(2, 8)) time.sleep(random.randint(2, 8))
else: else:
logger.info("cookie或stoken已失效") # logger.info("cookie或stoken已失效")
return '你的Cookies已失效。' return '你的Cookies已失效。'
return 'SignM:完成!' return 'SignM:完成!'
# 看帖子 # 看帖子
async def read_posts(self): async def read_posts(self):
if self.Task_do['bbs_Read_posts']: if self.Task_do['bbs_Read_posts']:
logger.info("看帖任务已经完成过了~'") # logger.info("看帖任务已经完成过了~'")
return '看帖任务已经完成过了~' return '看帖任务已经完成过了~'
else: else:
num_ok = 0 num_ok = 0
@ -201,13 +201,13 @@ class MihoyoBBSCoin:
if data['message'] == 'OK': if data['message'] == 'OK':
num_ok += 1 num_ok += 1
time.sleep(random.randint(2, 8)) time.sleep(random.randint(2, 8))
logger.info('ReadM:成功!Read:{}!'.format(str(num_ok))) # logger.info('ReadM:成功!Read:{}!'.format(str(num_ok)))
return 'ReadM:成功!Read:{}!'.format(str(num_ok)) return 'ReadM:成功!Read:{}!'.format(str(num_ok))
# 点赞 # 点赞
async def like_posts(self): async def like_posts(self):
if self.Task_do['bbs_Like_posts']: if self.Task_do['bbs_Like_posts']:
logger.info('Like任务已经完成过了~') # logger.info('Like任务已经完成过了~')
return 'Like任务已经完成过了~' return 'Like任务已经完成过了~'
else: else:
num_ok = 0 num_ok = 0
@ -229,13 +229,13 @@ class MihoyoBBSCoin:
if data['message'] == 'OK': if data['message'] == 'OK':
num_cancel += 1 num_cancel += 1
time.sleep(random.randint(2, 8)) time.sleep(random.randint(2, 8))
logger.info('LikeM:完成!like:{}dislike:{}!'.format(str(num_ok), str(num_cancel))) # logger.info('LikeM:完成!like:{}dislike:{}!'.format(str(num_ok), str(num_cancel)))
return 'LikeM:完成!like:{}dislike:{}!'.format(str(num_ok), str(num_cancel)) return 'LikeM:完成!like:{}dislike:{}!'.format(str(num_ok), str(num_cancel))
# 分享操作 # 分享操作
async def share_post(self): async def share_post(self):
if self.Task_do['bbs_Share']: if self.Task_do['bbs_Share']:
logger.info( '分享任务已经完成过了~') # logger.info('分享任务已经完成过了~')
return '分享任务已经完成过了~' return '分享任务已经完成过了~'
else: else:
for _ in range(3): for _ in range(3):
@ -249,14 +249,16 @@ class MihoyoBBSCoin:
time.sleep(random.randint(2, 8)) time.sleep(random.randint(2, 8))
# add function
#add function
import hashlib import hashlib
def md5(text): def md5(text):
md5_func = hashlib.md5() md5_func = hashlib.md5()
md5_func.update(text.encode()) md5_func.update(text.encode())
return md5_func.hexdigest() return md5_func.hexdigest()
def old_version_get_ds_token(mysbbs=False): def old_version_get_ds_token(mysbbs=False):
if mysbbs: if mysbbs:
n = 'fd3ykrh7o1j54g581upo1tvpam0dsgtf' n = 'fd3ykrh7o1j54g581upo1tvpam0dsgtf'
@ -267,6 +269,7 @@ def old_version_get_ds_token(mysbbs=False):
c = md5('salt=' + n + '&t=' + i + '&r=' + r) c = md5('salt=' + n + '&t=' + i + '&r=' + r)
return i + ',' + r + ',' + c return i + ',' + r + ',' + c
def random_hex(length): def random_hex(length):
result = hex(random.randint(0, 16 ** length)).replace('0x', '').upper() result = hex(random.randint(0, 16 ** length)).replace('0x', '').upper()
if len(result) < length: if len(result) < length:

View File

@ -66,6 +66,8 @@
- `sy`修正深渊信息时间介绍 - `sy`修正深渊信息时间介绍
- `sy`没有绑定cookie时将不再错误的展示空阵容信息 - `sy`没有绑定cookie时将不再错误的展示空阵容信息
- `ssbq`修复没有派遣时会报错的bug - `ssbq`修复没有派遣时会报错的bug
+ 7.19
- 新增`米游币自动获取`#124不确保一定可用如产生其他bug请反馈
## 丨功能列表 ## 丨功能列表
@ -137,6 +139,10 @@ paimon_remind_limit = 3
paimon_sign_hour = 0 paimon_sign_hour = 0
# 自动签到开始时间(分钟) # 自动签到开始时间(分钟)
paimon_sign_minute = 0 paimon_sign_minute = 0
# 自动米游币获取开始时间(小时)
paimon_coin_hour = 0
# 自动米游币获取开始时间(分钟)
paimon_coin_minute = 5
# 对联冷却(秒) # 对联冷却(秒)
paimon_couplets_cd = 6 paimon_couplets_cd = 6

View File

@ -90,3 +90,5 @@
- `sy`修正深渊信息时间介绍 - `sy`修正深渊信息时间介绍
- `sy`没有绑定cookie时将不再错误的展示空阵容信息 - `sy`没有绑定cookie时将不再错误的展示空阵容信息
- `ssbq`修复没有派遣时会报错的bug - `ssbq`修复没有派遣时会报错的bug
+ 7.19
- 新增`米游币自动获取`#124不确保一定可用如产生其他bug请反馈

View File

@ -20,6 +20,10 @@ class PluginConfig(BaseModel):
paimon_sign_hour: int = 0 paimon_sign_hour: int = 0
# 自动签到开始时间(分钟) # 自动签到开始时间(分钟)
paimon_sign_minute: int = 0 paimon_sign_minute: int = 0
# 自动米游币获取开始时间(小时)
paimon_coin_hour: int = 0
# 自动米游币获取开始时间(分钟)
paimon_coin_minute: int = 5
# 对联冷却(秒) # 对联冷却(秒)
paimon_couplets_cd: int = 6 paimon_couplets_cd: int = 6
# 猫图冷却(秒) # 猫图冷却(秒)

View File

@ -79,6 +79,7 @@ async def get_private_cookie(value, key='user_id'):
conn.close() conn.close()
return cookie return cookie
# 通过key(如user_id, uid)获取私人Stoken # 通过key(如user_id, uid)获取私人Stoken
async def get_private_stoken(value, key='user_id'): async def get_private_stoken(value, key='user_id'):
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
@ -97,6 +98,7 @@ async def get_private_stoken(value, key='user_id'):
conn.close() conn.close()
return stoken return stoken
# 更新cookie # 更新cookie
async def update_private_cookie(user_id, uid='', mys_id='', cookie='', stoken=''): async def update_private_cookie(user_id, uid='', mys_id='', cookie='', stoken=''):
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
@ -114,10 +116,11 @@ async def update_private_cookie(user_id, uid='', mys_id='', cookie='', stoken=''
conn.commit() conn.commit()
conn.close() conn.close()
#更新stoken
# 更新stoken
async def update_private_stoken(user_id, uid='', mys_id='', cookie='', stoken=''): async def update_private_stoken(user_id, uid='', mys_id='', cookie='', stoken=''):
#保证cookie不被更新 # 保证cookie不被更新
ck = await get_private_cookie(uid,key='uid') ck = await get_private_cookie(uid, key='uid')
cookie = ck[0][1] cookie = ck[0][1]
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
@ -135,6 +138,7 @@ async def update_private_stoken(user_id, uid='', mys_id='', cookie='', stoken=''
conn.commit() conn.commit()
conn.close() conn.close()
# 删除私人cookie # 删除私人cookie
async def delete_private_cookie(user_id): async def delete_private_cookie(user_id):
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
@ -419,6 +423,7 @@ async def delete_auto_sign(user_id, uid):
conn.commit() conn.commit()
conn.close() conn.close()
async def get_coin_auto_sign(): async def get_coin_auto_sign():
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
cursor = conn.cursor() cursor = conn.cursor()
@ -434,6 +439,7 @@ async def get_coin_auto_sign():
conn.close() conn.close()
return res return res
async def add_coin_auto_sign(user_id, uid, group_id): async def add_coin_auto_sign(user_id, uid, group_id):
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
cursor = conn.cursor() cursor = conn.cursor()
@ -464,7 +470,6 @@ async def delete_coin_auto_sign(user_id, uid):
conn.close() conn.close()
async def get_all_myb_exchange(): async def get_all_myb_exchange():
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
cursor = conn.cursor() cursor = conn.cursor()
@ -538,5 +543,3 @@ async def delete_myb_exchange(user_id):
cursor.execute('DELETE FROM myb_exchange WHERE user_id=?;', (user_id,)) cursor.execute('DELETE FROM myb_exchange WHERE user_id=?;', (user_id,))
conn.commit() conn.commit()
conn.close() conn.close()

View File

@ -657,7 +657,7 @@
"10582": "Skill_S_Yae_01", "10582": "Skill_S_Yae_01",
"10583": "", "10583": "",
"10585": "Skill_E_Yae_01", "10585": "Skill_E_Yae_01",
"10591": "Skill_A_01", "10591": "Skill_A_Catalys",
"10592": "Skill_S_Heizo_01", "10592": "Skill_S_Heizo_01",
"10595": "Skill_E_Heizo_01", "10595": "Skill_E_Heizo_01",
"10602": "Skill_S_PlayerElectric_01", "10602": "Skill_S_PlayerElectric_01",

View File

@ -158,14 +158,12 @@ async def get_at_target(msg):
# message预处理获取uid、干净的msg、user_id、是否缓存 # message预处理获取uid、干净的msg、user_id、是否缓存
async def get_uid_in_msg(event: MessageEvent, msg: Message): async def get_uid_in_msg(event: MessageEvent, msg: Message):
msg = str(msg).strip() msg = msg.extract_plain_text().strip()
logger.info(msg)
if not msg: if not msg:
uid = await get_last_query(str(event.user_id)) uid = await get_last_query(str(event.user_id))
logger.info(uid)
return uid, '', str(event.user_id), True return uid, '', str(event.user_id), True
user_id = await get_at_target(event.message) or str(event.user_id) user_id = await get_at_target(event.message) or str(event.user_id)
msg = re.sub(r'\[CQ.*?\]', '', msg) # msg = re.sub(r'\[CQ.*?\]', '', msg)
use_cache = False if '-r' in msg else True use_cache = False if '-r' in msg else True
msg = msg.replace('-r', '').strip() msg = msg.replace('-r', '').strip()
find_uid = r'(?P<uid>(1|2|5)\d{8})' find_uid = r'(?P<uid>(1|2|5)\d{8})'