Archived
1
0
Fork 0

Update maimai

This commit is contained in:
多羅狼 2023-05-27 11:20:04 +08:00 committed by GitHub
parent 359cf2a0db
commit 13301b6d60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 28 deletions

View file

@ -50,27 +50,27 @@ async def _(msg: Bot.MessageSession):
await msg.finish(s.strip())
@mai.handle('today {{maimai.help.today}}')
async def _(msg: Bot.MessageSession):
if msg.target.senderFrom == "Discord|Client":
qq = msg.session.sender.id
else:
qq = msg.session.sender
h = hash_(qq)
rp = h % 100
wm_value = []
for i in range(11):
wm_value.append(h & 3)
h >>= 2
s = f"今日人品值:{rp}\n"
for i in range(11):
if wm_value[i] == 3:
s += f'{wm_list[i]}\n'
elif wm_value[i] == 0:
s += f'{wm_list[i]}\n'
s += "刘大鸽提醒您:打机时不要大力拍打或滑动哦\n今日推荐歌曲:"
music = (await total_list.get())[h % len((await total_list.get()))]
await msg.finish([Plain(s)] + song_txt(music))
# @mai.handle('today {{maimai.help.today}}')
# async def _(msg: Bot.MessageSession):
# if msg.target.senderFrom == "Discord|Client":
# qq = msg.session.sender.id
# else:
# qq = msg.session.sender
# h = hash_(qq)
# rp = h % 100
# wm_value = []
# for i in range(11):
# wm_value.append(h & 3)
# h >>= 2
# s = f"今日人品值:{rp}\n"
# for i in range(11):
# if wm_value[i] == 3:
# s += f'宜 {wm_list[i]}\n'
# elif wm_value[i] == 0:
# s += f'忌 {wm_list[i]}\n'
# s += "刘大鸽提醒您:打机时不要大力拍打或滑动哦\n今日推荐歌曲"
# music = (await total_list.get())[h % len((await total_list.get()))]
# await msg.finish([Plain(s)] + song_txt(music))
@mai.handle(['scoreline <difficulty+sid> <scoreline> {查找某首歌的分数线}',
@ -161,6 +161,13 @@ async def _(msg: Bot.MessageSession):
if img:
await msg.finish([BImage(img)])
@mai.handle('random {{maimai.help.random}}')
@mai.handle(re.compile(r".*\s?(M|m)aimai\s?.*什么"))
async def _(msg: Bot.MessageSession):
await msg.finish(song_txt((await total_list.get()).random()))
@mai.handle(re.compile(r"随个((?:dx|sd|标准))?([绿黄红紫白]?)([0-9]+\+?)"),
@ -192,11 +199,6 @@ async def _(msg: Bot.MessageSession):
@mai.handle(re.compile(r".*maimai.*什么"), desc='XXXmaimaiXXX什么 随机一首歌')
async def _(msg: Bot.MessageSession):
await msg.finish(song_txt((await total_list.get()).random()))
@mai.handle(re.compile(r"查歌(.+)"), desc='查歌<乐曲标题的一部分> 查询符合条件的乐曲')
async def _(msg: Bot.MessageSession):
name = msg.matched_msg.groups()[0].strip()

View file

@ -4,6 +4,7 @@
"maimai.help.today": "查看今天的舞萌运势。",
"maimai.help.b40": "查询 B40 信息。(仅限大陆版舞萌)",
"maimai.help.b50": "查询 B50 信息。(仅限大陆版舞萌)",
"maimai.help.random": "随机一首曲目。",
"maimai.message.too_much": "结果过多(${length} 条),请缩小搜索范围。",
"maimai.message.no_username": "请提供用户名!",
"maimai.message.not_found": "未找到此玩家,请确保此玩家的用户名和查分器中的用户名相同。",

View file

@ -4,7 +4,7 @@ from config import Config
from core.builtins import Bot
from core.component import module
n = module('natural', alias=['nl2c'], developers=['Dianliang233'], desc='{natural.help}')
n = module('natural', alias=['nl2c'], developers=['Dianliang233'], desc='{natural.help}', required_superuser=True)
# Load your API key from an environment variable or secret management service
openai.api_key = Config('openai_api_key')

View file

@ -42,7 +42,7 @@ async def _(msg: Bot.MessageSession):
try:
ipaddress.ip_address(query)
except:
return msg.finish(msg.locale.t('whois.message.ip.error.unknown'))
await msg.finish(msg.locale.t('whois.message.ip.error.unknown'))
res = await check_ip(query)
await msg.finish(await format_ip(msg, res))