diff options
Diffstat (limited to 'bot/exts/valentines/whoisvalentine.py')
| -rw-r--r-- | bot/exts/valentines/whoisvalentine.py | 29 | 
1 files changed, 13 insertions, 16 deletions
diff --git a/bot/exts/valentines/whoisvalentine.py b/bot/exts/valentines/whoisvalentine.py index 0ff9186c..211b1f27 100644 --- a/bot/exts/valentines/whoisvalentine.py +++ b/bot/exts/valentines/whoisvalentine.py @@ -6,47 +6,44 @@ from random import choice  import discord  from discord.ext import commands +from bot.bot import Bot  from bot.constants import Colours  log = logging.getLogger(__name__) -with open(Path("bot/resources/valentines/valentine_facts.json"), "r", encoding="utf8") as file: -    FACTS = json.load(file) +FACTS = json.loads(Path("bot/resources/valentines/valentine_facts.json").read_text("utf8"))  class ValentineFacts(commands.Cog):      """A Cog for displaying facts about Saint Valentine.""" -    def __init__(self, bot: commands.Bot): -        self.bot = bot - -    @commands.command(aliases=('whoisvalentine', 'saint_valentine')) +    @commands.command(aliases=("whoisvalentine", "saint_valentine"))      async def who_is_valentine(self, ctx: commands.Context) -> None:          """Displays info about Saint Valentine."""          embed = discord.Embed(              title="Who is Saint Valentine?", -            description=FACTS['whois'], +            description=FACTS["whois"],              color=Colours.pink          )          embed.set_thumbnail( -            url='https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Saint_Valentine_-_' -                'facial_reconstruction.jpg/1024px-Saint_Valentine_-_facial_reconstruction.jpg' +            url="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Saint_Valentine_-_" +                "facial_reconstruction.jpg/1024px-Saint_Valentine_-_facial_reconstruction.jpg"          ) -        await ctx.channel.send(embed=embed) +        await ctx.send(embed=embed)      @commands.command()      async def valentine_fact(self, ctx: commands.Context) -> None:          """Shows a random fact about Valentine's Day."""          embed = discord.Embed( -            title=choice(FACTS['titles']), -            description=choice(FACTS['text']), +            title=choice(FACTS["titles"]), +            description=choice(FACTS["text"]),              color=Colours.pink          ) -        await ctx.channel.send(embed=embed) +        await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: -    """Who is Valentine Cog load.""" -    bot.add_cog(ValentineFacts(bot)) +def setup(bot: Bot) -> None: +    """Load the Who is Valentine Cog.""" +    bot.add_cog(ValentineFacts())  |