blob: 05cf504ee4246284b364309673fdb9859fb925df (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 | import logging
import random
from discord.ext import commands
from bot.constants import Emojis
log = logging.getLogger(__name__)
class Fun(commands.Cog):
    """A collection of general commands for fun."""
    def __init__(self, bot):
        self.bot = bot
    @commands.command()
    async def roll(self, ctx, num_rolls: int = 1):
        """Outputs a number of random dice emotes (up to 6)."""
        output = ""
        if num_rolls > 6:
            num_rolls = 6
        elif num_rolls < 1:
            output = ":no_entry: You must roll at least once."
        for _ in range(num_rolls):
            terning = f"terning{random.randint(1, 6)}"
            output += getattr(Emojis, terning, '')
        await ctx.send(output)
def setup(bot):
    """Fun Cog load."""
    bot.add_cog(Fun(bot))
    log.info("Fun cog loaded")
 |