aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/holidays/valentines
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/holidays/valentines')
-rw-r--r--bot/exts/holidays/valentines/be_my_valentine.py14
-rw-r--r--bot/exts/holidays/valentines/lovecalculator.py4
-rw-r--r--bot/exts/holidays/valentines/myvalenstate.py5
-rw-r--r--bot/exts/holidays/valentines/valentine_zodiac.py8
4 files changed, 13 insertions, 18 deletions
diff --git a/bot/exts/holidays/valentines/be_my_valentine.py b/bot/exts/holidays/valentines/be_my_valentine.py
index 3a2beef3..c2dd8bb6 100644
--- a/bot/exts/holidays/valentines/be_my_valentine.py
+++ b/bot/exts/holidays/valentines/be_my_valentine.py
@@ -126,15 +126,14 @@ class BeMyValentine(commands.Cog):
if valentine_type is None:
return self.random_valentine()
- elif valentine_type.lower() in ["p", "poem"]:
+ if valentine_type.lower() in ["p", "poem"]:
return self.valentine_poem(), "A poem dedicated to"
- elif valentine_type.lower() in ["c", "compliment"]:
+ if valentine_type.lower() in ["c", "compliment"]:
return self.valentine_compliment(), "A compliment for"
- else:
- # in this case, the user decides to type his own valentine.
- return valentine_type, "A message for"
+ # in this case, the user decides to type his own valentine.
+ return valentine_type, "A message for"
@staticmethod
def random_emoji() -> tuple[str, str]:
@@ -148,10 +147,7 @@ class BeMyValentine(commands.Cog):
valentine_poem = random.choice(self.valentines["valentine_poems"])
valentine_compliment = random.choice(self.valentines["valentine_compliments"])
random_valentine = random.choice([valentine_compliment, valentine_poem])
- if random_valentine == valentine_poem:
- title = "A poem dedicated to"
- else:
- title = "A compliment for "
+ title = "A poem dedicated to" if random_valentine == valentine_poem else "A compliment for "
return random_valentine, title
def valentine_poem(self) -> str:
diff --git a/bot/exts/holidays/valentines/lovecalculator.py b/bot/exts/holidays/valentines/lovecalculator.py
index eab3d083..9b363c5e 100644
--- a/bot/exts/holidays/valentines/lovecalculator.py
+++ b/bot/exts/holidays/valentines/lovecalculator.py
@@ -3,8 +3,8 @@ import hashlib
import json
import logging
import random
+from collections.abc import Coroutine
from pathlib import Path
-from typing import Coroutine, Optional
import discord
from discord import Member
@@ -27,7 +27,7 @@ class LoveCalculator(Cog):
@in_month(Month.FEBRUARY)
@commands.command(aliases=("love_calculator", "love_calc"))
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
- async def love(self, ctx: commands.Context, who: Member, whom: Optional[Member] = None) -> None:
+ async def love(self, ctx: commands.Context, who: Member, whom: Member | None = None) -> None:
"""
Tells you how much the two love each other.
diff --git a/bot/exts/holidays/valentines/myvalenstate.py b/bot/exts/holidays/valentines/myvalenstate.py
index 8d8772d4..fcef24bc 100644
--- a/bot/exts/holidays/valentines/myvalenstate.py
+++ b/bot/exts/holidays/valentines/myvalenstate.py
@@ -47,7 +47,7 @@ class MyValenstate(commands.Cog):
else:
author = name.lower().replace(" ", "")
- for state in STATES.keys():
+ for state in STATES:
lower_state = state.lower().replace(" ", "")
eq_chars[state] = self.levenshtein(author, lower_state)
@@ -64,8 +64,7 @@ class MyValenstate(commands.Cog):
embed_text = f"You have another match, this being {matches[0]}."
else:
embed_title = "You have a true match!"
- embed_text = "This state is your true Valenstate! There are no states that would suit" \
- " you better"
+ embed_text = "This state is your true Valenstate! There are no states that would suit you better"
embed = discord.Embed(
title=f"Your Valenstate is {valenstate} \u2764",
diff --git a/bot/exts/holidays/valentines/valentine_zodiac.py b/bot/exts/holidays/valentines/valentine_zodiac.py
index 0a28a5c5..f0c8978d 100644
--- a/bot/exts/holidays/valentines/valentine_zodiac.py
+++ b/bot/exts/holidays/valentines/valentine_zodiac.py
@@ -2,9 +2,8 @@ import calendar
import json
import logging
import random
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
-from typing import Union
import discord
from discord.ext import commands
@@ -78,6 +77,7 @@ class ValentineZodiac(commands.Cog):
if zodiac_data["start_at"].date() <= query_date.date() <= zodiac_data["end_at"].date():
log.trace("Zodiac name sent.")
return zodiac_name
+ return None
@commands.group(name="zodiac", invoke_without_command=True)
async def zodiac(self, ctx: commands.Context, zodiac_sign: str) -> None:
@@ -87,7 +87,7 @@ class ValentineZodiac(commands.Cog):
log.trace("Embed successfully sent.")
@zodiac.command(name="date")
- async def date_and_month(self, ctx: commands.Context, date: int, month: Union[int, str]) -> None:
+ async def date_and_month(self, ctx: commands.Context, date: int, month: int | str) -> None:
"""Provides information about zodiac sign by taking month and date as input."""
if isinstance(month, str):
month = month.capitalize()
@@ -103,7 +103,7 @@ class ValentineZodiac(commands.Cog):
final_embed = self.zodiac_build_embed(zodiac)
else:
try:
- zodiac_sign_based_on_date = self.zodiac_date_verifier(datetime(2020, month, date))
+ zodiac_sign_based_on_date = self.zodiac_date_verifier(datetime(2020, month, date, tzinfo=UTC))
log.trace("zodiac sign based on month and date received.")
except ValueError as e:
final_embed = discord.Embed()