aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/constants.py2
-rw-r--r--bot/exts/evergreen/pythonfacts.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/bot/constants.py b/bot/constants.py
index bb538487..3aec6ba3 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -156,6 +156,8 @@ class Colours:
soft_orange = 0xf9cb54
soft_red = 0xcd6d6d
yellow = 0xf9f586
+ python_blue = 0x4B8BBE
+ python_yellow = 0xFFD43B
class Emojis:
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)