add dice module, give it a !choose
This commit is contained in:
parent
ef29f9f3e2
commit
3850595b14
9
dice/__init__.py
Normal file
9
dice/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
"""Roll dice and do other randomization type operations."""
|
||||||
|
from bot import hitomi
|
||||||
|
from dice import lib
|
||||||
|
|
||||||
|
|
||||||
|
@hitomi.command()
|
||||||
|
async def choose(*choices: str):
|
||||||
|
"""Randomly select one item from multiple choices."""
|
||||||
|
await hitomi.say(lib.choose(*choices))
|
7
dice/lib.py
Normal file
7
dice/lib.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"""Functions for use in the dice module."""
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
def choose(*choices: str):
|
||||||
|
"""Randomly choose an item from the provided multiple choices."""
|
||||||
|
return random.choice(choices)
|
@ -38,6 +38,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'bot',
|
'bot',
|
||||||
|
'dice',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user