aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/halloween
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/halloween')
-rw-r--r--bot/exts/halloween/8ball.py2
-rw-r--r--bot/exts/halloween/candy_collection.py18
-rw-r--r--bot/exts/halloween/hacktober-issue-finder.py2
-rw-r--r--bot/exts/halloween/hacktoberstats.py8
-rw-r--r--bot/exts/halloween/halloweenify.py4
-rw-r--r--bot/exts/halloween/monsterbio.py2
-rw-r--r--bot/exts/halloween/monstersurvey.py84
-rw-r--r--bot/exts/halloween/scarymovie.py22
-rw-r--r--bot/exts/halloween/spookygif.py6
-rw-r--r--bot/exts/halloween/spookynamerate.py2
-rw-r--r--bot/exts/halloween/spookyrating.py10
-rw-r--r--bot/exts/halloween/spookyreact.py14
12 files changed, 87 insertions, 87 deletions
diff --git a/bot/exts/halloween/8ball.py b/bot/exts/halloween/8ball.py
index 59d4acc5..d6c5a299 100644
--- a/bot/exts/halloween/8ball.py
+++ b/bot/exts/halloween/8ball.py
@@ -17,7 +17,7 @@ with Path("bot/resources/halloween/responses.json").open("r", encoding="utf8") a
class SpookyEightBall(commands.Cog):
"""Spooky Eightball answers."""
- @commands.command(aliases=('spooky8ball',))
+ @commands.command(aliases=("spooky8ball",))
async def spookyeightball(self, ctx: commands.Context, *, question: str) -> None:
"""Responds with a random response to a question."""
choice = random.choice(RESPONSES["responses"])
diff --git a/bot/exts/halloween/candy_collection.py b/bot/exts/halloween/candy_collection.py
index 5441d8a5..14efa1fb 100644
--- a/bot/exts/halloween/candy_collection.py
+++ b/bot/exts/halloween/candy_collection.py
@@ -22,11 +22,11 @@ EMOJIS = dict(
CANDY="\N{CANDY}",
SKULL="\N{SKULL}",
MEDALS=(
- '\N{FIRST PLACE MEDAL}',
- '\N{SECOND PLACE MEDAL}',
- '\N{THIRD PLACE MEDAL}',
- '\N{SPORTS MEDAL}',
- '\N{SPORTS MEDAL}',
+ "\N{FIRST PLACE MEDAL}",
+ "\N{SECOND PLACE MEDAL}",
+ "\N{THIRD PLACE MEDAL}",
+ "\N{SPORTS MEDAL}",
+ "\N{SPORTS MEDAL}",
),
)
@@ -106,7 +106,7 @@ class CandyCollection(commands.Cog):
await self.candy_records.decrement(user.id, lost)
if lost == prev_record:
- await CandyCollection.send_spook_msg(user, message.channel, 'all of your')
+ await CandyCollection.send_spook_msg(user, message.channel, "all of your")
else:
await CandyCollection.send_spook_msg(user, message.channel, lost)
else:
@@ -125,7 +125,7 @@ class CandyCollection(commands.Cog):
"""
if random.randint(1, ADD_SKULL_EXISTING_REACTION_CHANCE) == 1:
await self.skull_messages.set(message.id, "skull")
- await message.add_reaction(EMOJIS['SKULL'])
+ await message.add_reaction(EMOJIS["SKULL"])
elif random.randint(1, ADD_CANDY_EXISTING_REACTION_CHANCE) == 1:
await self.candy_messages.set(message.id, "candy")
@@ -173,7 +173,7 @@ class CandyCollection(commands.Cog):
)
top_five = top_sorted[:5]
- return '\n'.join(
+ return "\n".join(
f"{EMOJIS['MEDALS'][index]} <@{record[0]}>: {record[1]}"
for index, record in enumerate(top_five)
) if top_five else "No Candies"
@@ -185,7 +185,7 @@ class CandyCollection(commands.Cog):
inline=False
)
e.add_field(
- name='\u200b',
+ name="\u200b",
value="Candies will randomly appear on messages sent. "
"\nHit the candy when it appears as fast as possible to get the candy! "
"\nBut beware the ghosts...",
diff --git a/bot/exts/halloween/hacktober-issue-finder.py b/bot/exts/halloween/hacktober-issue-finder.py
index c88e2b6f..baee9612 100644
--- a/bot/exts/halloween/hacktober-issue-finder.py
+++ b/bot/exts/halloween/hacktober-issue-finder.py
@@ -102,7 +102,7 @@ class HacktoberIssues(commands.Cog):
labels = [label["name"] for label in issue["labels"]]
embed = discord.Embed(title=title)
- embed.description = body[:500] + '...' if len(body) > 500 else body
+ embed.description = body[:500] + "..." if len(body) > 500 else body
embed.add_field(name="labels", value="\n".join(labels))
embed.url = issue_url
embed.set_footer(text=issue_url)
diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py
index 9695ba2a..25da9ad5 100644
--- a/bot/exts/halloween/hacktoberstats.py
+++ b/bot/exts/halloween/hacktoberstats.py
@@ -138,7 +138,7 @@ class HacktoberStats(commands.Cog):
if prs:
stats_embed = await self.build_embed(github_username, prs)
- await ctx.send('Here are some stats!', embed=stats_embed)
+ await ctx.send("Here are some stats!", embed=stats_embed)
else:
await ctx.send(f"No valid Hacktoberfest PRs found for '{github_username}'")
@@ -355,7 +355,7 @@ class HacktoberStats(commands.Cog):
# loop through reviews and check for approval
for item in jsonresp2:
- if item.get('status') == "APPROVED":
+ if item.get("status") == "APPROVED":
return True
return False
@@ -387,9 +387,9 @@ class HacktoberStats(commands.Cog):
in_review = []
accepted = []
for pr in prs:
- if (pr['created_at'] + timedelta(REVIEW_DAYS)) > now:
+ if (pr["created_at"] + timedelta(REVIEW_DAYS)) > now:
in_review.append(pr)
- elif (pr['created_at'] <= oct3) or await self._is_accepted(pr):
+ elif (pr["created_at"] <= oct3) or await self._is_accepted(pr):
accepted.append(pr)
return in_review, accepted
diff --git a/bot/exts/halloween/halloweenify.py b/bot/exts/halloween/halloweenify.py
index 5a8f4ecc..47b20a2a 100644
--- a/bot/exts/halloween/halloweenify.py
+++ b/bot/exts/halloween/halloweenify.py
@@ -34,8 +34,8 @@ class Halloweenify(commands.Cog):
embed.colour = discord.Colour.dark_orange()
embed.title = "Not spooky enough?"
embed.description = (
- f"**{ctx.author.display_name}** wasn\'t spooky enough for you? That\'s understandable, "
- f"{ctx.author.display_name} isn\'t scary at all! "
+ f"**{ctx.author.display_name}** wasn't spooky enough for you? That's understandable, "
+ f"{ctx.author.display_name} isn't scary at all! "
"Let me think of something better. Hmm... I got it!\n\n "
)
embed.set_image(url=image)
diff --git a/bot/exts/halloween/monsterbio.py b/bot/exts/halloween/monsterbio.py
index f484305d..dbafa43f 100644
--- a/bot/exts/halloween/monsterbio.py
+++ b/bot/exts/halloween/monsterbio.py
@@ -37,7 +37,7 @@ class MonsterBio(commands.Cog):
continue
options = seeded_random.sample(TEXT_OPTIONS[key], value)
- words[key] = ' '.join(options)
+ words[key] = " ".join(options)
embed = discord.Embed(
title=f"{name}'s Biography",
diff --git a/bot/exts/halloween/monstersurvey.py b/bot/exts/halloween/monstersurvey.py
index 0610503d..486e8937 100644
--- a/bot/exts/halloween/monstersurvey.py
+++ b/bot/exts/halloween/monstersurvey.py
@@ -9,8 +9,8 @@ from discord.ext.commands import Bot, Cog, Context
log = logging.getLogger(__name__)
EMOJIS = {
- 'SUCCESS': u'\u2705',
- 'ERROR': u'\u274C'
+ "SUCCESS": u"\u2705",
+ "ERROR": u"\u274C"
}
@@ -25,63 +25,63 @@ class MonsterSurvey(Cog):
def __init__(self):
"""Initializes values for the bot to use within the voting commands."""
- self.registry_location = os.path.join(os.getcwd(), 'bot', 'resources', 'halloween', 'monstersurvey.json')
- with open(self.registry_location, 'r', encoding="utf8") as jason:
+ self.registry_location = os.path.join(os.getcwd(), "bot", "resources", "halloween", "monstersurvey.json")
+ with open(self.registry_location, "r", encoding="utf8") as jason:
self.voter_registry = json.load(jason)
def json_write(self) -> None:
"""Write voting results to a local JSON file."""
log.info("Saved Monster Survey Results")
- with open(self.registry_location, 'w', encoding="utf8") as jason:
+ with open(self.registry_location, "w", encoding="utf8") as jason:
json.dump(self.voter_registry, jason, indent=2)
def cast_vote(self, id: int, monster: str) -> None:
"""
- Cast a user's vote for the specified monster.
+ Cast a user"s vote for the specified monster.
If the user has already voted, their existing vote is removed.
"""
vr = self.voter_registry
for m in vr.keys():
- if id not in vr[m]['votes'] and m == monster:
- vr[m]['votes'].append(id)
+ if id not in vr[m]["votes"] and m == monster:
+ vr[m]["votes"].append(id)
else:
- if id in vr[m]['votes'] and m != monster:
- vr[m]['votes'].remove(id)
+ if id in vr[m]["votes"] and m != monster:
+ vr[m]["votes"].remove(id)
def get_name_by_leaderboard_index(self, n: int) -> str:
"""Return the monster at the specified leaderboard index."""
n = n - 1
vr = self.voter_registry
- top = sorted(vr, key=lambda k: len(vr[k]['votes']), reverse=True)
+ top = sorted(vr, key=lambda k: len(vr[k]["votes"]), reverse=True)
name = top[n] if n >= 0 else None
return name
@commands.group(
- name='monster',
- aliases=('mon',)
+ name="monster",
+ aliases=("mon",)
)
async def monster_group(self, ctx: Context) -> None:
"""The base voting command. If nothing is called, then it will return an embed."""
if ctx.invoked_subcommand is None:
async with ctx.typing():
default_embed = Embed(
- title='Monster Voting',
+ title="Monster Voting",
color=0xFF6800,
- description='Vote for your favorite monster!'
+ description="Vote for your favorite monster!"
)
default_embed.add_field(
- name='.monster show monster_name(optional)',
- value='Show a specific monster. If none is listed, it will give you an error with valid choices.',
+ name=".monster show monster_name(optional)",
+ value="Show a specific monster. If none is listed, it will give you an error with valid choices.",
inline=False)
default_embed.add_field(
- name='.monster vote monster_name',
- value='Vote for a specific monster. You get one vote, but can change it at any time.',
+ name=".monster vote monster_name",
+ value="Vote for a specific monster. You get one vote, but can change it at any time.",
inline=False
)
default_embed.add_field(
- name='.monster leaderboard',
- value='Which monster has the most votes? This command will tell you.',
+ name=".monster leaderboard",
+ value="Which monster has the most votes? This command will tell you.",
inline=False
)
default_embed.set_footer(text=f"Monsters choices are: {', '.join(self.voter_registry.keys())}")
@@ -89,7 +89,7 @@ class MonsterSurvey(Cog):
await ctx.send(embed=default_embed)
@monster_group.command(
- name='vote'
+ name="vote"
)
async def monster_vote(self, ctx: Context, name: str = None) -> None:
"""
@@ -110,37 +110,37 @@ class MonsterSurvey(Cog):
name = name.lower()
vote_embed = Embed(
- name='Monster Voting',
+ name="Monster Voting",
color=0xFF6800
)
m = self.voter_registry.get(name)
if m is None:
- vote_embed.description = f'You cannot vote for {name} because it\'s not in the running.'
+ vote_embed.description = f"You cannot vote for {name} because it's not in the running."
vote_embed.add_field(
- name='Use `.monster show {monster_name}` for more information on a specific monster',
- value='or use `.monster vote {monster}` to cast your vote for said monster.',
+ name="Use `.monster show {monster_name}` for more information on a specific monster",
+ value="or use `.monster vote {monster}` to cast your vote for said monster.",
inline=False
)
vote_embed.add_field(
- name='You may vote for or show the following monsters:',
- value=f"{', '.join(self.voter_registry.keys())}"
+ name="You may vote for or show the following monsters:",
+ value=", ".join(self.voter_registry.keys())
)
else:
self.cast_vote(ctx.author.id, name)
vote_embed.add_field(
- name='Vote successful!',
- value=f'You have successfully voted for {m["full_name"]}!',
+ name="Vote successful!",
+ value=f"You have successfully voted for {m['full_name']}!",
inline=False
)
- vote_embed.set_thumbnail(url=m['image'])
+ vote_embed.set_thumbnail(url=m["image"])
vote_embed.set_footer(text="Please note that any previous votes have been removed.")
self.json_write()
await ctx.send(embed=vote_embed)
@monster_group.command(
- name='show'
+ name="show"
)
async def monster_show(self, ctx: Context, name: str = None) -> None:
"""Shows the named monster. If one is not named, it sends the default voting embed instead."""
@@ -158,31 +158,31 @@ class MonsterSurvey(Cog):
m = self.voter_registry.get(name)
if not m:
- await ctx.send('That monster does not exist.')
+ await ctx.send("That monster does not exist.")
await ctx.invoke(self.monster_vote)
return
- embed = Embed(title=m['full_name'], color=0xFF6800)
- embed.add_field(name='Summary', value=m['summary'])
- embed.set_image(url=m['image'])
- embed.set_footer(text=f'To vote for this monster, type .monster vote {name}')
+ embed = Embed(title=m["full_name"], color=0xFF6800)
+ embed.add_field(name="Summary", value=m["summary"])
+ embed.set_image(url=m["image"])
+ embed.set_footer(text=f"To vote for this monster, type .monster vote {name}")
await ctx.send(embed=embed)
@monster_group.command(
- name='leaderboard',
- aliases=('lb',)
+ name="leaderboard",
+ aliases=("lb",)
)
async def monster_leaderboard(self, ctx: Context) -> None:
"""Shows the current standings."""
async with ctx.typing():
vr = self.voter_registry
- top = sorted(vr, key=lambda k: len(vr[k]['votes']), reverse=True)
- total_votes = sum(len(m['votes']) for m in self.voter_registry.values())
+ top = sorted(vr, key=lambda k: len(vr[k]["votes"]), reverse=True)
+ total_votes = sum(len(m["votes"]) for m in self.voter_registry.values())
embed = Embed(title="Monster Survey Leader Board", color=0xFF6800)
for rank, m in enumerate(top):
- votes = len(vr[m]['votes'])
+ votes = len(vr[m]["votes"])
percentage = ((votes / total_votes) * 100) if total_votes > 0 else 0
embed.add_field(name=f"{rank+1}. {vr[m]['full_name']}",
value=(
diff --git a/bot/exts/halloween/scarymovie.py b/bot/exts/halloween/scarymovie.py
index 48c9f53d..f4cf41db 100644
--- a/bot/exts/halloween/scarymovie.py
+++ b/bot/exts/halloween/scarymovie.py
@@ -47,7 +47,7 @@ class ScaryMovie(commands.Cog):
total_pages = data.get("total_pages")
# Get movie details from one random result on a random page
- params['page'] = random.randint(1, total_pages)
+ params["page"] = random.randint(1, total_pages)
async with self.bot.http_session.get(url=url, params=params, headers=headers) as response:
data = await response.json()
selection_id = random.choice(data.get("results")).get("id")
@@ -71,26 +71,26 @@ class ScaryMovie(commands.Cog):
# Get cast names
cast = []
- for actor in movie.get('credits', {}).get('cast', [])[:3]:
- cast.append(actor.get('name'))
+ for actor in movie.get("credits", {}).get("cast", [])[:3]:
+ cast.append(actor.get("name"))
# Get director name
- director = movie.get('credits', {}).get('crew', [])
+ director = movie.get("credits", {}).get("crew", [])
if director:
- director = director[0].get('name')
+ director = director[0].get("name")
# Determine the spookiness rating
- rating = ''
- rating_count = movie.get('vote_average', 0) / 2
+ rating = ""
+ rating_count = movie.get("vote_average", 0) / 2
for _ in range(int(rating_count)):
- rating += ':skull:'
+ rating += ":skull:"
if (rating_count % 1) >= .5:
- rating += ':bat:'
+ rating += ":bat:"
# Try to get year of release and runtime
- year = movie.get('release_date', [])[:4]
- runtime = movie.get('runtime')
+ year = movie.get("release_date", [])[:4]
+ runtime = movie.get("runtime")
runtime = f"{runtime} minutes" if runtime else None
# Not all these attributes will always be present
diff --git a/bot/exts/halloween/spookygif.py b/bot/exts/halloween/spookygif.py
index bfdf2128..ffb91b1b 100644
--- a/bot/exts/halloween/spookygif.py
+++ b/bot/exts/halloween/spookygif.py
@@ -19,11 +19,11 @@ class SpookyGif(commands.Cog):
async def spookygif(self, ctx: commands.Context) -> None:
"""Fetches a random gif from the GIPHY API and responds with it."""
async with ctx.typing():
- params = {'api_key': Tokens.giphy, 'tag': 'halloween', 'rating': 'g'}
+ params = {"api_key": Tokens.giphy, "tag": "halloween", "rating": "g"}
# Make a GET request to the Giphy API to get a random halloween gif.
- async with self.bot.http_session.get('http://api.giphy.com/v1/gifs/random', params=params) as resp:
+ async with self.bot.http_session.get("http://api.giphy.com/v1/gifs/random", params=params) as resp:
data = await resp.json()
- url = data['data']['image_url']
+ url = data["data"]["image_url"]
embed = discord.Embed(colour=0x9b59b6)
embed.title = "A spooooky gif!"
diff --git a/bot/exts/halloween/spookynamerate.py b/bot/exts/halloween/spookynamerate.py
index 9191f5f6..87172922 100644
--- a/bot/exts/halloween/spookynamerate.py
+++ b/bot/exts/halloween/spookynamerate.py
@@ -81,7 +81,7 @@ class SpookyNameRate(Cog):
# The data cache stores small information such as the current name that is going on and whether it is the first time
# the bot is running
data = RedisCache()
- debug = getenv('SPOOKYNAMERATE_DEBUG', False) # Enable if you do not want to limit the commands to October or if
+ debug = getenv("SPOOKYNAMERATE_DEBUG", False) # Enable if you do not want to limit the commands to October or if
# you do not want to wait till 12 UTC. Note: if debug is enabled and you run `.cogs reload spookynamerate`, it
# will automatically start the scoring and announcing the result (without waiting for 12, so do not expect it to.).
# Also, it won't wait for the two hours (when the poll closes).
diff --git a/bot/exts/halloween/spookyrating.py b/bot/exts/halloween/spookyrating.py
index dc398e2e..6c79fbed 100644
--- a/bot/exts/halloween/spookyrating.py
+++ b/bot/exts/halloween/spookyrating.py
@@ -46,16 +46,16 @@ class SpookyRating(commands.Cog):
_, data = SPOOKY_DATA[index]
embed = discord.Embed(
- title=data['title'],
- description=f'{who} scored {spooky_percent}%!',
+ title=data["title"],
+ description=f"{who} scored {spooky_percent}%!",
color=Colours.orange
)
embed.add_field(
- name='A whisper from Satan',
- value=data['text']
+ name="A whisper from Satan",
+ value=data["text"]
)
embed.set_thumbnail(
- url=data['image']
+ url=data["image"]
)
await ctx.send(embed=embed)
diff --git a/bot/exts/halloween/spookyreact.py b/bot/exts/halloween/spookyreact.py
index dabc3c1f..25e783f4 100644
--- a/bot/exts/halloween/spookyreact.py
+++ b/bot/exts/halloween/spookyreact.py
@@ -11,13 +11,13 @@ from bot.utils.decorators import in_month
log = logging.getLogger(__name__)
SPOOKY_TRIGGERS = {
- 'spooky': (r"\bspo{2,}ky\b", "\U0001F47B"),
- 'skeleton': (r"\bskeleton\b", "\U0001F480"),
- 'doot': (r"\bdo{2,}t\b", "\U0001F480"),
- 'pumpkin': (r"\bpumpkin\b", "\U0001F383"),
- 'halloween': (r"\bhalloween\b", "\U0001F383"),
- 'jack-o-lantern': (r"\bjack-o-lantern\b", "\U0001F383"),
- 'danger': (r"\bdanger\b", "\U00002620")
+ "spooky": (r"\bspo{2,}ky\b", "\U0001F47B"),
+ "skeleton": (r"\bskeleton\b", "\U0001F480"),
+ "doot": (r"\bdo{2,}t\b", "\U0001F480"),
+ "pumpkin": (r"\bpumpkin\b", "\U0001F383"),
+ "halloween": (r"\bhalloween\b", "\U0001F383"),
+ "jack-o-lantern": (r"\bjack-o-lantern\b", "\U0001F383"),
+ "danger": (r"\bdanger\b", "\U00002620")
}