aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-05-15 13:31:34 -0400
committerGravatar ToxicKidz <[email protected]>2021-05-15 13:31:34 -0400
commitf8a179df350eb3abb7f3595aaff3dbca312f540c (patch)
tree6868ae98b81b614f8d8d68f1a9bbc06c7cb94490 /bot/exts/evergreen
parentchore: Make all aliases in commands tuples (diff)
chore: Make things that are only used once constants
Diffstat (limited to 'bot/exts/evergreen')
-rw-r--r--bot/exts/evergreen/cheatsheet.py2
-rw-r--r--bot/exts/evergreen/magic_8ball.py7
-rw-r--r--bot/exts/evergreen/pythonfacts.py3
3 files changed, 6 insertions, 6 deletions
diff --git a/bot/exts/evergreen/cheatsheet.py b/bot/exts/evergreen/cheatsheet.py
index 7ee34b1d..ae7793c9 100644
--- a/bot/exts/evergreen/cheatsheet.py
+++ b/bot/exts/evergreen/cheatsheet.py
@@ -12,7 +12,7 @@ from bot.bot import Bot
from bot.constants import Categories, Channels, Colours, ERROR_REPLIES
from bot.utils.decorators import whitelist_override
-ERROR_MESSAGE = f"""\
+ERROR_MESSAGE = f"""
Unknown cheat sheet. Please try to reformulate your query.
**Examples**:
diff --git a/bot/exts/evergreen/magic_8ball.py b/bot/exts/evergreen/magic_8ball.py
index 4b3ed2a4..28ddcea0 100644
--- a/bot/exts/evergreen/magic_8ball.py
+++ b/bot/exts/evergreen/magic_8ball.py
@@ -9,18 +9,17 @@ from bot.bot import Bot
log = logging.getLogger(__name__)
+ANSWERS = json.loads(Path("bot/resources/evergreen/magic8ball.json").read_text("utf8"))
+
class Magic8ball(commands.Cog):
"""A Magic 8ball command to respond to a user's question."""
- def __init__(self):
- self.answers = json.loads(Path("bot/resources/evergreen/magic8ball.json").read_text("utf8"))
-
@commands.command(name="8ball")
async def output_answer(self, ctx: commands.Context, *, question: str) -> None:
"""Return a Magic 8ball answer from answers list."""
if len(question.split()) >= 3:
- answer = random.choice(self.answers)
+ answer = random.choice(ANSWERS)
await ctx.send(answer)
else:
await ctx.send("Usage: .8ball <question> (minimum length of 3 eg: `will I win?`)")
diff --git a/bot/exts/evergreen/pythonfacts.py b/bot/exts/evergreen/pythonfacts.py
index 606545ab..80a8da5d 100644
--- a/bot/exts/evergreen/pythonfacts.py
+++ b/bot/exts/evergreen/pythonfacts.py
@@ -10,6 +10,7 @@ with open("bot/resources/evergreen/python_facts.txt") as file:
FACTS = itertools.cycle(list(file))
COLORS = itertools.cycle([Colours.python_blue, Colours.python_yellow])
+PYFACTS_DISCUSSION = "https://github.com/python-discord/meta/discussions/93"
class PythonFacts(commands.Cog):
@@ -25,7 +26,7 @@ class PythonFacts(commands.Cog):
)
embed.add_field(
name="Suggestions",
- value="Suggest more facts [here!](https://github.com/python-discord/meta/discussions/93)"
+ value=f"Suggest more facts [here!]({PYFACTS_DISCUSSION})"
)
await ctx.send(embed=embed)