Compare commits

...

3 Commits

Author SHA1 Message Date
c8dae680a3 跨平台适配
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-09-29 00:41:29 +08:00
adebd51605 fix: 删掉前缀匹配
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-29 00:18:44 +08:00
f0fdc930d4 删除多余引用 2025-09-29 00:15:18 +08:00
4 changed files with 28 additions and 11 deletions

View File

@ -1,3 +1,4 @@
DRIVER=~fastapi+~httpx+~websockets
COMMAND_START=["!", "", "", "/"]
ALCONNA_USE_ORIGIN=true

View File

@ -1,3 +1,4 @@
DRIVER=~fastapi+~httpx+~websockets
COMMAND_START=["!", "", "", "/"]
ALCONNA_USE_ORIGIN=true

View File

@ -1,12 +1,19 @@
from nonebot_plugin_alconna import Alconna, Args, Field, UniMessage, on_alconna
from nonebot.adapters import Event as BaseEvent
from nonebot.adapters.console.event import MessageEvent as ConsoleMessageEvent
from nonebot.adapters.discord.event import MessageEvent as DiscordMessageEvent
from nonebot_plugin_alconna import Alconna, UniMessage, on_alconna
from konabot.plugins.roll_dice.roll_dice import roll_dice
from konabot.plugins.weather.fetcher import fetch_radar
evt = on_alconna(Alconna(
"摇骰子"
), use_cmd_start=True, use_cmd_sep=False, skip_for_unmatch=True)
@evt.handle()
async def _():
await evt.send(await UniMessage().text(await roll_dice()).export())
async def _(event: BaseEvent):
if isinstance(event, DiscordMessageEvent):
await evt.send(await UniMessage().text("```\n" + roll_dice() + "\n```").export())
elif isinstance(event, ConsoleMessageEvent):
await evt.send(await UniMessage().text(roll_dice()).export())
else:
await evt.send(await UniMessage().text(roll_dice(wide=True)).export())

View File

@ -7,14 +7,14 @@ number_arts = {
''',
2: ''' ____
|___ \
|___ \\
__) |
/ __/
|_____|
''',
3: ''' _____
|___ /
|_ \
|_ \\
___) |
|____/
''',
@ -26,15 +26,15 @@ number_arts = {
''',
5: ''' ____
| ___|
|___ \
|___ \\
___) |
|____/
''',
6: ''' __
/ /_
| '_ \
| '_ \\
| (_) |
\___/
\\___/
'''
}
@ -42,5 +42,13 @@ def get_random_number(min: int = 1, max: int = 6) -> int:
import random
return random.randint(min, max)
async def roll_dice() -> str:
return number_arts[get_random_number()]
def roll_dice(wide: bool = False) -> str:
raw = number_arts[get_random_number()]
if wide:
raw = (raw
.replace("/", "")
.replace("\\", "")
.replace("_", "_")
.replace("|", "")
.replace(" ", " "))
return raw