diff options
author | 2019-02-17 14:16:26 +1000 | |
---|---|---|
committer | 2019-02-17 14:16:26 +1000 | |
commit | e2b175bbfdee41bc518f40e430af94e28396966d (patch) | |
tree | 3dfbeee44d415059788f67a06a07dfd9a356dbf8 | |
parent | Merge pull request #114 from 3bodyZZ/master (diff) | |
parent | 3rd code review. Added docstring. (diff) |
Merge pull request #111 from astieman/RollMethod
Readded fun.py file to evergreen and added roll command.
-rw-r--r-- | bot/seasons/evergreen/fun.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bot/seasons/evergreen/fun.py b/bot/seasons/evergreen/fun.py new file mode 100644 index 00000000..afe37b75 --- /dev/null +++ b/bot/seasons/evergreen/fun.py @@ -0,0 +1,35 @@ +import logging +import random + +from discord.ext import commands + +log = logging.getLogger(__name__) + + +class Fun: + """ + 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): + output += ":terning%d: " % random.randint(1, 6) + await ctx.send(output) + + +# Required in order to load the cog, use the class name in the add_cog function. +def setup(bot): + bot.add_cog(Fun(bot)) + log.debug("Fun cog loaded") |