aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar quizzicaltrains <[email protected]>2019-10-18 18:39:46 -0700
committerGravatar quizzicaltrains <[email protected]>2019-10-18 18:39:46 -0700
commitda4c08b60a8e9f25fb24ed4c094010dbdcddcc41 (patch)
tree1a0ef8d6a134f1c9aa4b66715bd825c668f6c491
parentAdds the monsterbio command! (diff)
Changed several things.
-rw-r--r--Pipfile.lock91
-rw-r--r--bot/constants.py1
-rw-r--r--bot/resources/halloween/monster.json2
-rw-r--r--bot/seasons/halloween/monster.py31
4 files changed, 59 insertions, 66 deletions
diff --git a/Pipfile.lock b/Pipfile.lock
index 19ca0618..f792e645 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -68,19 +68,19 @@
},
"attrs": {
"hashes": [
- "sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79",
- "sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399"
+ "sha256:ec20e7a4825331c1b5ebf261d111e16fa9612c1f7a5e1f884f12bd53a664dfd2",
+ "sha256:f913492e1663d3c36f502e5e9ba6cd13cf19d7fab50aa13239e420fef95e1396"
],
- "version": "==19.1.0"
+ "version": "==19.2.0"
},
"beautifulsoup4": {
"hashes": [
- "sha256:05668158c7b85b791c5abde53e50265e16f98ad601c402ba44d70f96c4159612",
- "sha256:25288c9e176f354bf277c0a10aa96c782a6a18a17122dba2e8cec4a97e03343b",
- "sha256:f040590be10520f2ea4c2ae8c3dae441c7cfff5308ec9d58a0ec0c1b8f81d469"
+ "sha256:5279c36b4b2ec2cb4298d723791467e3000e5384a43ea0cdf5d45207c7e97169",
+ "sha256:6135db2ba678168c07950f9a16c4031822c6f4aec75a65e0a97bc5ca09789931",
+ "sha256:dcdef580e18a76d54002088602eba453eec38ebbcafafeaabd8cab12b6155d57"
],
"index": "pypi",
- "version": "==4.8.0"
+ "version": "==4.8.1"
},
"cffi": {
"hashes": [
@@ -180,35 +180,35 @@
},
"pillow": {
"hashes": [
- "sha256:0804f77cb1e9b6dbd37601cee11283bba39a8d44b9ddb053400c58e0c0d7d9de",
- "sha256:0ab7c5b5d04691bcbd570658667dd1e21ca311c62dcfd315ad2255b1cd37f64f",
- "sha256:0b3e6cf3ea1f8cecd625f1420b931c83ce74f00c29a0ff1ce4385f99900ac7c4",
- "sha256:365c06a45712cd723ec16fa4ceb32ce46ad201eb7bbf6d3c16b063c72b61a3ed",
- "sha256:38301fbc0af865baa4752ddae1bb3cbb24b3d8f221bf2850aad96b243306fa03",
- "sha256:3aef1af1a91798536bbab35d70d35750bd2884f0832c88aeb2499aa2d1ed4992",
- "sha256:3fe0ab49537d9330c9bba7f16a5f8b02da615b5c809cdf7124f356a0f182eccd",
- "sha256:45a619d5c1915957449264c81c008934452e3fd3604e36809212300b2a4dab68",
- "sha256:49f90f147883a0c3778fd29d3eb169d56416f25758d0f66775db9184debc8010",
- "sha256:571b5a758baf1cb6a04233fb23d6cf1ca60b31f9f641b1700bfaab1194020555",
- "sha256:5ac381e8b1259925287ccc5a87d9cf6322a2dc88ae28a97fe3e196385288413f",
- "sha256:6153db744a743c0c8c91b8e3b9d40e0b13a5d31dbf8a12748c6d9bfd3ddc01ad",
- "sha256:6fd63afd14a16f5d6b408f623cc2142917a1f92855f0df997e09a49f0341be8a",
- "sha256:70acbcaba2a638923c2d337e0edea210505708d7859b87c2bd81e8f9902ae826",
- "sha256:70b1594d56ed32d56ed21a7fbb2a5c6fd7446cdb7b21e749c9791eac3a64d9e4",
- "sha256:76638865c83b1bb33bcac2a61ce4d13c17dba2204969dedb9ab60ef62bede686",
- "sha256:7b2ec162c87fc496aa568258ac88631a2ce0acfe681a9af40842fc55deaedc99",
- "sha256:7cee2cef07c8d76894ebefc54e4bb707dfc7f258ad155bd61d87f6cd487a70ff",
- "sha256:7d16d4498f8b374fc625c4037742fbdd7f9ac383fd50b06f4df00c81ef60e829",
- "sha256:b50bc1780681b127e28f0075dfb81d6135c3a293e0c1d0211133c75e2179b6c0",
- "sha256:bd0582f831ad5bcad6ca001deba4568573a4675437db17c4031939156ff339fa",
- "sha256:cfd40d8a4b59f7567620410f966bb1f32dc555b2b19f82a91b147fac296f645c",
- "sha256:e3ae410089de680e8f84c68b755b42bc42c0ceb8c03dbea88a5099747091d38e",
- "sha256:e9046e559c299b395b39ac7dbf16005308821c2f24a63cae2ab173bd6aa11616",
- "sha256:ef6be704ae2bc8ad0ebc5cb850ee9139493b0fc4e81abcc240fb392a63ebc808",
- "sha256:f8dc19d92896558f9c4317ee365729ead9d7bbcf2052a9a19a3ef17abbb8ac5b"
+ "sha256:00fdeb23820f30e43bba78eb9abb00b7a937a655de7760b2e09101d63708b64e",
+ "sha256:01f948e8220c85eae1aa1a7f8edddcec193918f933fb07aaebe0bfbbcffefbf1",
+ "sha256:08abf39948d4b5017a137be58f1a52b7101700431f0777bec3d897c3949f74e6",
+ "sha256:099a61618b145ecb50c6f279666bbc398e189b8bc97544ae32b8fcb49ad6b830",
+ "sha256:2c1c61546e73de62747e65807d2cc4980c395d4c5600ecb1f47a650c6fa78c79",
+ "sha256:2ed9c4f694861642401f27dc3cb99772be67cd190e84845c749dae0a06c3bfae",
+ "sha256:338581b30b908e111be578f0297255f6b57a51358cd16fa0e6f664c9a1f88bff",
+ "sha256:38c7d48a21cd06fdeee93987147b9b1c55b73b4cfcbf83240568bfbd5adee447",
+ "sha256:43fd026f613c8e48a25eba1a92f4d2ad7f3903c95d8c33a11611a7717d2ab654",
+ "sha256:4548236844327a718ce3bb182ab32a16fa2050c61e334e959f554cac052fb0df",
+ "sha256:5090857876c58885cfa388dc649e5db30aae98a068c26f3fd0ac9d7d9a4d9572",
+ "sha256:5bbba34f97a26a93f5e8dec469ca4ddd712451418add43da946dbaed7f7a98d2",
+ "sha256:65a28969a025a0eb4594637b6103201dc4ed2a9508bdab56ac33e43e3081c404",
+ "sha256:892bb52b70bd5ea9dbbc3ac44f38e84f5a04e9d8b1bff48159d96cb795b81159",
+ "sha256:8a9becd5cbd5062f973bcd2e7bc79483af310222de112b6541f8af1f93a3cc42",
+ "sha256:972a7aaeb7c4a2795b52eef52ee991ef040b31009f36deca6207a986607b55f3",
+ "sha256:97b119c436bfa96a92ac2ca525f7025836d4d4e64b1c9f9eff8dbaf3ff1d86f3",
+ "sha256:9ba37698e242223f8053cc158f130aee046a96feacbeab65893dbe94f5530118",
+ "sha256:b1b0e1f626a0f079c0d3696db70132fb1f29aa87c66aecb6501a9b8be64ce9f7",
+ "sha256:c14c1224fd1a5be2733530d648a316974dbbb3c946913562c6005a76f21ca042",
+ "sha256:c79a8546c48ae6465189e54e3245a97ddf21161e33ff7eaa42787353417bb2b6",
+ "sha256:ceb76935ac4ebdf6d7bc845482a4450b284c6ccfb281e34da51d510658ab34d8",
+ "sha256:e22bffaad04b4d16e1c091baed7f2733fc1ebb91e0c602abf1b6834d17158b1f",
+ "sha256:ec883b8e44d877bda6f94a36313a1c6063f8b1997aa091628ae2f34c7f97c8d5",
+ "sha256:f1baa54d50ec031d1a9beb89974108f8f2c0706f49798f4777df879df0e1adb6",
+ "sha256:f53a5385932cda1e2c862d89460992911a89768c65d176ff8c50cddca4d29bed"
],
"index": "pypi",
- "version": "==6.1.0"
+ "version": "==6.2.0"
},
"pycares": {
"hashes": [
@@ -243,11 +243,11 @@
},
"pytz": {
"hashes": [
- "sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32",
- "sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7"
+ "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d",
+ "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"
],
"index": "pypi",
- "version": "==2019.2"
+ "version": "==2019.3"
},
"six": {
"hashes": [
@@ -316,10 +316,10 @@
},
"attrs": {
"hashes": [
- "sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79",
- "sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399"
+ "sha256:ec20e7a4825331c1b5ebf261d111e16fa9612c1f7a5e1f884f12bd53a664dfd2",
+ "sha256:f913492e1663d3c36f502e5e9ba6cd13cf19d7fab50aa13239e420fef95e1396"
],
- "version": "==19.1.0"
+ "version": "==19.2.0"
},
"cfgv": {
"hashes": [
@@ -361,11 +361,11 @@
},
"flake8-docstrings": {
"hashes": [
- "sha256:1666dd069c9c457ee57e80af3c1a6b37b00cc1801c6fde88e455131bb2e186cd",
- "sha256:9c0db5a79a1affd70fdf53b8765c8a26bf968e59e0252d7f2fc546b41c0cda06"
+ "sha256:3d5a31c7ec6b7367ea6506a87ec293b94a0a46c0bce2bb4975b7f1d09b6f3717",
+ "sha256:a256ba91bc52307bef1de59e2a009c3cf61c3d0952dbe035d6ff7208940c2edc"
],
"index": "pypi",
- "version": "==1.4.0"
+ "version": "==1.5.0"
},
"flake8-import-order": {
"hashes": [
@@ -488,9 +488,10 @@
},
"snowballstemmer": {
"hashes": [
- "sha256:713e53b79cbcf97bc5245a06080a33d54a77e7cce2f789c835a143bcdb5c033e"
+ "sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0",
+ "sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"
],
- "version": "==1.9.1"
+ "version": "==2.0.0"
},
"toml": {
"hashes": [
diff --git a/bot/constants.py b/bot/constants.py
index 0d4321c8..749af1d0 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -72,6 +72,7 @@ class Colours:
soft_green = 0x68c290
soft_red = 0xcd6d6d
yellow = 0xf9f586
+ purple = 0xb734eb
class Emojis:
diff --git a/bot/resources/halloween/monster.json b/bot/resources/halloween/monster.json
index f68ae840..5958dc9c 100644
--- a/bot/resources/halloween/monster.json
+++ b/bot/resources/halloween/monster.json
@@ -34,7 +34,7 @@
"year": [
"1996", "1594", "1330", "1700"
],
- "format": [
+ "biography_text": [
{"scientist_first_name": 1, "scientist_last_name": 1, "verb": 1, "adjective": 1, "attribute": 1, "ability": 1, "color": 1, "year": 1, "time": 1, "physical_adjective": 1, "text": "Your name is {monster_name}, a member of the {adjective} species {monster_species}. The first {monster_species} was {verb} by {scientist_first_name} {scientist_last_name} in {year} at {time}. The species {monster_species} is known for its {physical_adjective} {color} {attribute}. It is said to even be able to {ability}!"},
{"scientist_first_name": 1, "scientist_last_name": 1, "adjective": 1, "attribute": 1, "physical_adjective": 1, "ingredients": 2, "time": 1, "ability": 1, "verb": 1, "color": 1, "year": 1, "text": "The {monster_species} is an {adjective} species, and you, {monster_name}, are no exception. {monster_species} is famed for its {physical_adjective} {attribute}. Whispers say that when brewed with {ingredients[0]} and {ingredients[1]} at {time}, a foul, {color} brew will be produced, granting it's drinker the ability to {ability}! This species was {verb} by {scientist_first_name} {scientist_last_name} in {year}."}
]
diff --git a/bot/seasons/halloween/monster.py b/bot/seasons/halloween/monster.py
index a068d02c..a54c7088 100644
--- a/bot/seasons/halloween/monster.py
+++ b/bot/seasons/halloween/monster.py
@@ -5,46 +5,37 @@ from pathlib import Path
import discord
from discord.ext import commands
+from constants import Colour
log = logging.getLogger(__name__)
with open(Path("bot/resources/halloween/monster.json"), "r", encoding="utf8") as f:
- data = json.load(f)
-
-PUMPKIN_ORANGE = discord.Color(0xFF7518)
-OTHER_PURPLE = discord.Color(0xB734EB)
-
+ 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 __init__(self, bot: commands.Bot):
- self.bot = bot
- self.channel = None
+ def generate_name(length):
+ return "".join([random.choice(TEXT_OPTIONS["monster_type"][i]) for i in range(length)])
@commands.command(brief="Sends your monster bio!")
async def monsterbio(self, ctx: commands.Context) -> None:
"""Sends a description of a monster."""
random.seed(ctx.message.author.id)
- name_length = random.randint(2, len(data["monster_type"]))
- species_length = random.randint(2, len(data["monster_type"]))
- name = species = ""
- for i in range(name_length):
- name += random.choice(data["monster_type"][i])
- for i in range(species_length):
- species += random.choice(data["monster_type"][i])
- format = random.choice(data["format"])
+ name = self.generate_name(random.randint(2, len(TEXT_OPTIONS["monster_type"])))
+ species = selfgenerate_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 format.items():
+ for key, value in biography_text.items():
if key == "text":
continue
if value > 1:
- words[key] = random.sample(data[key], value)
+ words[key] = random.sample(TEXT_OPTIONS[key], value)
else:
- words[key] = random.choice(data[key])
+ words[key] = random.choice(TEXT_OPTIONS[key])
embed = discord.Embed(
title=f"{name}'s Biography",
- color=random.choice([PUMPKIN_ORANGE, OTHER_PURPLE]), description=format["text"].format(**words)
+ color=random.choice([Colours.orange, Colours.purple]), description=biography_text["text"].format(**words)
)
await ctx.send(embed=embed)