diff options
author | 2021-02-22 11:13:01 -0800 | |
---|---|---|
committer | 2021-02-22 11:13:01 -0800 | |
commit | 16476ab7b4d5efe36a9e101b382f7be24888dec5 (patch) | |
tree | 6621f2d1c66d5606ba4d800e6fad3c596d0e58cf /bot/exts/evergreen/pythonfacts.py | |
parent | Add colors and move embed out of send statement; add more info about Monty Py... (diff) |
Switch to itertools.cycle and add colors to constants.py
Diffstat (limited to 'bot/exts/evergreen/pythonfacts.py')
-rw-r--r-- | bot/exts/evergreen/pythonfacts.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bot/exts/evergreen/pythonfacts.py b/bot/exts/evergreen/pythonfacts.py index 734782b8..8e6d300b 100644 --- a/bot/exts/evergreen/pythonfacts.py +++ b/bot/exts/evergreen/pythonfacts.py @@ -1,13 +1,16 @@ -import random +import itertools import discord from discord.ext import commands +from bot.constants import Colours with open('bot/resources/evergreen/python_facts.txt') as file: FACTS = list(file) + FACT_CYCLE = itertools.cycle(FACTS) -COLORS = [0x4B8BBE, 0xFFD43B, ] +COLORS = [Colours.python_blue, Colours.python_yellow] +COLOR_CYCLE = itertools.cycle(COLORS) class PythonFacts(commands.Cog): @@ -19,7 +22,7 @@ class PythonFacts(commands.Cog): @commands.command(name='pythonfact', aliases=['pyfact']) async def get_python_fact(self, ctx: commands.Context) -> None: """Sends a Random fun fact about Python.""" - embed = discord.Embed(title='Python Facts', description=random.choice(FACTS), colour=random.choice(COLORS)) + embed = discord.Embed(title='Python Facts', description=next(FACT_CYCLE), colour=next(COLOR_CYCLE)) await ctx.send(embed=embed) |