# Path: Cogs/PickList.py
# class PickList(commands.Cog):
#     def __init__(self, bot):
#         self.bot = bot
#     # Fluff class to post the reactions we need
#     @commands.Cog.listener()
#     async def on_reaction_add(self, reaction, user):
#         self.bot.dispatch("picklist_reaction", reaction, user)
# 
#     @commands.Cog.listener()
#     async def on_reaction_remove(self, reaction, user):
#         self.bot.dispatch("picklist_reaction", reaction, user)


import random, asyncio, discord, random
from discord.ext import commands
from Cogs import PickList

            roll_string += "{}{:,}".format("+" if roll["mod_sign"] else "-",roll["mod"])
        if roll["adv_dis"] != None: # We have either advantage or disadvantage - highlight which via *{}*
            roll_string += "\n\n"+"= {}".format("Advantage" if roll["adv_dis"] else "Disadvantage").ljust(self.print_pad,"=")+"\n"
            roll_string += "\n{}\n".format("-"*self.print_pad).join(["*{:,}*".format(x["total"]) if i == 0 else "{:,}".format(x["total"]) for i,x in enumerate(roll["rolls"])])
        # Print our final total and return the results
        roll_string += "\n\n"+"= Final Total ".ljust(self.print_pad,"=")+"\n"
        roll_string += "{:,}".format(roll["rolls"][0]["total"])
        return roll_string

def setup(bot):
    # Add the bot and deps
    settings = bot.get_cog("Settings")
    bot.add_cog(Dice())

class Dice(commands.Cog):
    '''
    The Dice class exists to roll dice for table top games like Dungeons and Dragons.
    '''
    @commands.command()
    async def roll(self, ctx, *, dice = None):
        """Performs up to 10 space-delimited dice rolls in NdN±Na|d format."""
        # Display the table then wait for a reaction
        d = Roller()
        r = d.roll(dice)
        if r == MAX_ROLLS: return await ctx.send("I can only perform {:,} roll{} at a time!".format(d.max_rolls,"" if d.max_rolls == 1 else "s"))
        if r == MAX_DICE:  return await ctx.send("I can only roll up to {:,} dice per roll!".format(d.max_dice))
        if r == MAX_SIDES: return await ctx.send("I can only roll dice with up to {:,} face{} per roll!".format(d.max_sides,"" if d.max_sides == 1 else "s"))
        if r == INVALID: return await ctx.send("Dice rolls must be in `NdN±Na|d` format!  Rolling a single d10 with a -5 modifier and disadvantage would look like: `{}roll 1d10-5d`".format(ctx.prefix))
        message = None
        while True:

# Path: Cogs/PickList.py
# class PickList(commands.Cog):
#     def __init__(self, bot):
#         self.bot = bot
#     # Fluff class to post the reactions we need
#     @commands.Cog.listener()
#     async def on_reaction_add(self, reaction, user):
#         self.bot.dispatch("picklist_reaction", reaction, user)
# 
#     @commands.Cog.listener()
#     async def on_reaction_remove(self, reaction, user):
#         self.bot.dispatch("picklist_reaction", reaction, user)


# Path: Cogs/Dice.py
import random, asyncio, discord, random
from discord.ext import commands
from Cogs import PickList

            roll_string += "{}{:,}".format("+" if roll["mod_sign"] else "-",roll["mod"])
        if roll["adv_dis"] != None: # We have either advantage or disadvantage - highlight which via *{}*
            roll_string += "\n\n"+"= {}".format("Advantage" if roll["adv_dis"] else "Disadvantage").ljust(self.print_pad,"=")+"\n"
            roll_string += "\n{}\n".format("-"*self.print_pad).join(["*{:,}*".format(x["total"]) if i == 0 else "{:,}".format(x["total"]) for i,x in enumerate(roll["rolls"])])
        # Print our final total and return the results
        roll_string += "\n\n"+"= Final Total ".ljust(self.print_pad,"=")+"\n"
        roll_string += "{:,}".format(roll["rolls"][0]["total"])
        return roll_string

def setup(bot):
    # Add the bot and deps
    settings = bot.get_cog("Settings")
    bot.add_cog(Dice())

class Dice(commands.Cog):
    '''
    The Dice class exists to roll dice for table top games like Dungeons and Dragons.
    '''
    @commands.command()
    async def roll(self, ctx, *, dice = None):
        """Performs up to 10 space-delimited dice rolls in NdN±Na|d format."""
        # Display the table then wait for a reaction
        d = Roller()
        r = d.roll(dice)
        if r == MAX_ROLLS: return await ctx.send("I can only perform {:,} roll{} at a time!".format(d.max_rolls,"" if d.max_rolls == 1 else "s"))
        if r == MAX_DICE:  return await ctx.send("I can only roll up to {:,} dice per roll!".format(d.max_dice))
        if r == MAX_SIDES: return await ctx.send("I can only roll dice with up to {:,} face{} per roll!".format(d.max_sides,"" if d.max_sides == 1 else "s"))
        if r == INVALID: return await ctx.send("Dice rolls must be in `NdN±Na|d` format!  Rolling a single d10 with a -5 modifier and disadvantage would look like: `{}roll 1d10-5d`".format(ctx.prefix))
        message = None
        while True:

            index, message = await PickList.Picker(list=d.rolls_list(r), title="Pick a roll to show details:", ctx=ctx, timeout=300, message=message).pick()
