diff options
author | Kyomotoi <[email protected]> | 2020-09-13 16:36:05 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-09-13 16:36:05 +0800 |
commit | 9c91cc1c7f39a7178e753d5f32a707db0ae19790 (patch) | |
tree | 3c6c24745985fc8703a3dab1d188c0bade31c2af /ATRI/plugins/hitokoto.py | |
parent | 681b8c7c8841c8c889f77bf54d1cf1ce9914c016 (diff) | |
download | ATRI-9c91cc1c7f39a7178e753d5f32a707db0ae19790.tar.gz ATRI-9c91cc1c7f39a7178e753d5f32a707db0ae19790.tar.bz2 ATRI-9c91cc1c7f39a7178e753d5f32a707db0ae19790.zip |
[Update]
Diffstat (limited to 'ATRI/plugins/hitokoto.py')
-rw-r--r-- | ATRI/plugins/hitokoto.py | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/ATRI/plugins/hitokoto.py b/ATRI/plugins/hitokoto.py index 6f81f2f..a49c8fc 100644 --- a/ATRI/plugins/hitokoto.py +++ b/ATRI/plugins/hitokoto.py @@ -1,21 +1,13 @@ import json -from datetime import datetime -from random import choice from nonebot import on_command, on_natural_language, CommandSession from nonebot import NLPSession, NLPResult from ATRI.modules.response import request_api from ATRI.modules.error import errorBack +from ATRI.modules.time import sleepTime from ATRI.modules.funcControl import checkNoob -def now_time(): - now_ = datetime.now() - hour = now_.hour - minute = now_.minute - now = hour + minute / 60 - return now - url = 'https://api.imjad.cn/hitokoto/?cat=a&charset=utf-8&length=50&encode=json&fun=sync&source=' @@ -25,18 +17,8 @@ async def hitokoto(session: CommandSession): user = session.event.user_id group = session.event.group_id if checkNoob(user, group): - if 0 <= now_time() < 5.5: - await session.send( - choice( - [ - 'zzzz......', - 'zzzzzzzz......', - 'zzz...好涩哦..zzz....', - '别...不要..zzz..那..zzz..', - '嘻嘻..zzz..呐~..zzzz..' - ] - ) - ) + if sleepTime(): + await session.send(sleepTime()) else: try: rep = request_api(url) |