Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/cytoid/__init__.py

38 lines
1.2 KiB
Python
Raw Normal View History

2021-10-24 10:55:45 +00:00
from core.component import on_command
2021-11-12 14:25:53 +00:00
from core.elements import MessageSession, Image
2021-08-07 07:56:48 +00:00
from database import BotDBUtil
2021-07-27 17:42:47 +00:00
from .profile import cytoid_profile
from .rating import get_rating
2021-10-24 10:55:45 +00:00
cytoid = on_command('cytoid',
developers=['OasisAkari'])
2021-07-27 17:42:47 +00:00
2021-10-24 10:55:45 +00:00
@cytoid.handle('profile <UserID> {查询一个用户的基本信息}')
async def _(msg: MessageSession):
2021-07-27 17:42:47 +00:00
if msg.parsed_msg['profile']:
await cytoid_profile(msg)
2021-10-24 10:55:45 +00:00
@cytoid.handle('(b30|r30) <UserID> {查询一个用户的b30/r30记录}')
async def _(msg: MessageSession):
2021-07-27 17:42:47 +00:00
if msg.parsed_msg['b30']:
query = 'b30'
elif msg.parsed_msg['r30']:
query = 'r30'
else:
query = False
if query:
qc = BotDBUtil.CoolDown(msg, 'cytoid_rank')
c = qc.check(300)
if c == 0:
img = await get_rating(msg.parsed_msg['<UserID>'], query)
if 'path' in img:
await msg.sendMessage([Image(path=img['path'])])
if 'text' in img:
await msg.sendMessage(img['text'])
if img['status']:
qc.reset()
else:
await msg.sendMessage(f'距离上次执行已过去{int(c)}本命令的冷却时间为300秒。')