aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/evergreen/fun.py
diff options
context:
space:
mode:
authorGravatar Rohan_Iceman <[email protected]>2019-03-27 21:09:23 +0530
committerGravatar GitHub <[email protected]>2019-03-27 21:09:23 +0530
commit463e7f9d757ce8142f23f67f55f3c41d4336ba56 (patch)
treefc3e6484b77907bc0158c271af26261d013ae508 /bot/seasons/evergreen/fun.py
parentMerge pull request #99 from python-discord/config-update (diff)
parentMerge pull request #132 from python-discord/dpy-cog-changes (diff)
Merge pull request #1 from python-discord/master
syncing fork
Diffstat (limited to 'bot/seasons/evergreen/fun.py')
-rw-r--r--bot/seasons/evergreen/fun.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/bot/seasons/evergreen/fun.py b/bot/seasons/evergreen/fun.py
new file mode 100644
index 00000000..9ef47331
--- /dev/null
+++ b/bot/seasons/evergreen/fun.py
@@ -0,0 +1,38 @@
+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)
+
+
+# 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.info("Fun cog loaded")