add dice module, give it a !choose
This commit is contained in:
parent
ef29f9f3e2
commit
3850595b14
|
@ -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))
|
|
@ -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.staticfiles',
|
||||
'bot',
|
||||
'dice',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
Loading…
Reference in New Issue