mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
update 0.0.6.2
This commit is contained in:
Regular → Executable
+66
-66
@@ -1,66 +1,66 @@
|
||||
from nonebot import on_command
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
|
||||
from utils.utils import get_message_text
|
||||
from services.log import logger
|
||||
from configs.config import NICKNAME
|
||||
import random
|
||||
import asyncio
|
||||
|
||||
|
||||
__zx_plugin_name__ = "roll"
|
||||
__plugin_usage__ = """
|
||||
usage:
|
||||
随机数字 或 随机选择事件
|
||||
指令:
|
||||
roll: 随机 0-100 的数字
|
||||
roll *[文本]: 随机事件
|
||||
示例:roll 吃饭 睡觉 打游戏
|
||||
""".strip()
|
||||
__plugin_des__ = "犹豫不决吗?那就让我帮你决定吧"
|
||||
__plugin_cmd__ = ["roll", "roll *[文本]"]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
__plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["roll"],
|
||||
}
|
||||
|
||||
|
||||
roll = on_command("roll", priority=5, block=True)
|
||||
|
||||
|
||||
@roll.handle()
|
||||
async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
msg = get_message_text(event.json()).split()
|
||||
if not msg:
|
||||
await roll.finish(f"roll: {random.randint(0, 100)}", at_sender=True)
|
||||
user_name = event.sender.card if event.sender.card else event.sender.nickname
|
||||
await roll.send(
|
||||
random.choice(
|
||||
[
|
||||
"转动命运的齿轮,拨开眼前迷雾...",
|
||||
f"启动吧,命运的水晶球,为{user_name}指引方向!",
|
||||
"嗯哼,在此刻转动吧!命运!",
|
||||
f"在此祈愿,请为{user_name}降下指引...",
|
||||
]
|
||||
)
|
||||
)
|
||||
await asyncio.sleep(1)
|
||||
x = random.choice(msg)
|
||||
await roll.send(
|
||||
random.choice(
|
||||
[
|
||||
f"让{NICKNAME}看看是什么结果!答案是:‘{x}’",
|
||||
f"根据命运的指引,接下来{user_name} ‘{x}’ 会比较好",
|
||||
f"祈愿被回应了!是 ‘{x}’!",
|
||||
f"结束了,{user_name},命运之轮停在了 ‘{x}’!",
|
||||
]
|
||||
)
|
||||
)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, "
|
||||
f"GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 发送roll:{msg}"
|
||||
)
|
||||
from nonebot import on_command
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
|
||||
from utils.utils import get_message_text
|
||||
from services.log import logger
|
||||
from configs.config import NICKNAME
|
||||
import random
|
||||
import asyncio
|
||||
|
||||
|
||||
__zx_plugin_name__ = "roll"
|
||||
__plugin_usage__ = """
|
||||
usage:
|
||||
随机数字 或 随机选择事件
|
||||
指令:
|
||||
roll: 随机 0-100 的数字
|
||||
roll *[文本]: 随机事件
|
||||
示例:roll 吃饭 睡觉 打游戏
|
||||
""".strip()
|
||||
__plugin_des__ = "犹豫不决吗?那就让我帮你决定吧"
|
||||
__plugin_cmd__ = ["roll", "roll *[文本]"]
|
||||
__plugin_version__ = 0.1
|
||||
__plugin_author__ = "HibiKier"
|
||||
__plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["roll"],
|
||||
}
|
||||
|
||||
|
||||
roll = on_command("roll", priority=5, block=True)
|
||||
|
||||
|
||||
@roll.handle()
|
||||
async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
msg = get_message_text(event.json()).split()
|
||||
if not msg:
|
||||
await roll.finish(f"roll: {random.randint(0, 100)}", at_sender=True)
|
||||
user_name = event.sender.card if event.sender.card else event.sender.nickname
|
||||
await roll.send(
|
||||
random.choice(
|
||||
[
|
||||
"转动命运的齿轮,拨开眼前迷雾...",
|
||||
f"启动吧,命运的水晶球,为{user_name}指引方向!",
|
||||
"嗯哼,在此刻转动吧!命运!",
|
||||
f"在此祈愿,请为{user_name}降下指引...",
|
||||
]
|
||||
)
|
||||
)
|
||||
await asyncio.sleep(1)
|
||||
x = random.choice(msg)
|
||||
await roll.send(
|
||||
random.choice(
|
||||
[
|
||||
f"让{NICKNAME}看看是什么结果!答案是:‘{x}’",
|
||||
f"根据命运的指引,接下来{user_name} ‘{x}’ 会比较好",
|
||||
f"祈愿被回应了!是 ‘{x}’!",
|
||||
f"结束了,{user_name},命运之轮停在了 ‘{x}’!",
|
||||
]
|
||||
)
|
||||
)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, "
|
||||
f"GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 发送roll:{msg}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user