aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar quizzicaltrains <[email protected]>2019-10-19 10:40:47 -0700
committerGravatar quizzicaltrains <[email protected]>2019-10-19 10:40:47 -0700
commitc4a3601e47baeeadded927071313790daa3604b4 (patch)
treec544bb62d984072eb1492a187116057430b0690b
parentChanged several things. (diff)
Fixes the changes.
-rw-r--r--bot/seasons/halloween/monster.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/bot/seasons/halloween/monster.py b/bot/seasons/halloween/monster.py
index a54c7088..5a735b69 100644
--- a/bot/seasons/halloween/monster.py
+++ b/bot/seasons/halloween/monster.py
@@ -5,17 +5,20 @@ from pathlib import Path
import discord
from discord.ext import commands
-from constants import Colour
+
+from bot.constants import Colours
log = logging.getLogger(__name__)
with open(Path("bot/resources/halloween/monster.json"), "r", encoding="utf8") as f:
- TEXT_OPTIONS = json.load(f) # Data for a mad-lib style generation of text
+ TEXT_OPTIONS = json.load(f) # Data for a mad-lib style generation of text
+
class MonsterBio(commands.Cog):
"""A cog that generates a spooky monster biography."""
- def generate_name(length):
+ def generate_name(self, length: int) -> str:
+ """Generates a name (for either monster species or monster name)."""
return "".join([random.choice(TEXT_OPTIONS["monster_type"][i]) for i in range(length)])
@commands.command(brief="Sends your monster bio!")
@@ -23,7 +26,7 @@ class MonsterBio(commands.Cog):
"""Sends a description of a monster."""
random.seed(ctx.message.author.id)
name = self.generate_name(random.randint(2, len(TEXT_OPTIONS["monster_type"])))
- species = selfgenerate_name(random.randint(2, len(TEXT_OPTIONS["monster_type"])))
+ species = self.generate_name(random.randint(2, len(TEXT_OPTIONS["monster_type"])))
biography_text = random.choice(TEXT_OPTIONS["biography_text"])
words = {"monster_name": name, "monster_species": species}
for key, value in biography_text.items():
@@ -43,4 +46,4 @@ class MonsterBio(commands.Cog):
def setup(bot: commands.Bot) -> None:
"""Monster bio Cog load."""
bot.add_cog(MonsterBio(bot))
- log.info("MonsterBio cog loaded!")
+ log.info("MonsterBio cog loaded.")