hitomi/hitomi/dice.py

28 lines
707 B
Python

"""Commands for dice rolling type behavior."""
import logging
from discord.ext import commands
from hitomi import bot
from hitomi.backends import dr_botzo
logger = logging.getLogger(__name__)
class Dice(commands.Cog):
"""Commands for rolling dice and whatnot."""
@commands.command()
async def roll(self, ctx, dice):
"""Roll a provided dice string.
Format: T#K/NdS+M; T = times, K = keep, N = number, S = sides, M = modifier
"""
logger.info("rolling dice: %s", dice)
result = dr_botzo.post('/dice/rpc/roll/', json={'dice': dice})
logger.debug(result)
await ctx.send(result.json())
bot.add_cog(Dice(bot))