Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a97bf7d55c |
12
konabot/plugins/roll_dice/__init__.py
Normal file
12
konabot/plugins/roll_dice/__init__.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from nonebot_plugin_alconna import Alconna, Args, Field, 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())
|
||||||
46
konabot/plugins/roll_dice/roll_dice.py
Normal file
46
konabot/plugins/roll_dice/roll_dice.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
number_arts = {
|
||||||
|
1: ''' _
|
||||||
|
/ |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
|_|
|
||||||
|
|
||||||
|
''',
|
||||||
|
2: ''' ____
|
||||||
|
|___ \
|
||||||
|
__) |
|
||||||
|
/ __/
|
||||||
|
|_____|
|
||||||
|
''',
|
||||||
|
3: ''' _____
|
||||||
|
|___ /
|
||||||
|
|_ \
|
||||||
|
___) |
|
||||||
|
|____/
|
||||||
|
''',
|
||||||
|
4: ''' _ _
|
||||||
|
| || |
|
||||||
|
| || |_
|
||||||
|
|__ _|
|
||||||
|
|_|
|
||||||
|
''',
|
||||||
|
5: ''' ____
|
||||||
|
| ___|
|
||||||
|
|___ \
|
||||||
|
___) |
|
||||||
|
|____/
|
||||||
|
''',
|
||||||
|
6: ''' __
|
||||||
|
/ /_
|
||||||
|
| '_ \
|
||||||
|
| (_) |
|
||||||
|
\___/
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
|
||||||
|
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()]
|
||||||
Reference in New Issue
Block a user