使用命令:发送"今日运势"即可
哔哩哔哩:萌新源
交流群:934541995
QQ:1648576390
以下是源码
import random
from datetime import date
from nonebot.plugin import on_command,export
from nonebot.adapters.onebot.v11 import Bot, Event
from nonebot.adapters.onebot.v11.message import Message
export = export()
export.name = '今日运势'
def ys_simple(ys):
if ys < 18:
return '大吉'
elif ys < 53:
return '吉'
elif ys < 58:
return '半吉'
elif ys < 62:
return '小吉'
elif ys < 65:
return '末小吉'
elif ys < 71:
return '末吉'
else:
return '凶'
jrys = on_command('jrys',priority=50)
@jrys.handle()
async def jrys_handle(bot: Bot, event: Event):
rnd = random.Random()
rnd.seed(( int(date.today().strftime("%y%m%d"))*45 )*( int(event.get_user_id())*55 ))
yunshi = rnd.randint(1,100)
await jrys.finish(message = Message(f'[CQ:at,qq={event.get_user_id()}]您今日的幸运指数是{yunshi}(越低越好),为"{ys_simple(yunshi)}"'))
ps:数值越低代表今日运势越好