diff options
| author | 2019-03-25 22:52:09 +1000 | |
|---|---|---|
| committer | 2019-03-25 22:52:09 +1000 | |
| commit | 8baeec50cde8672df9b46503ed55119dec492a34 (patch) | |
| tree | d6a80ffeff4059de70ca7333149d5c308fb8d7a2 | |
| parent | Merge pull request #151 from python-discord/pride (diff) | |
| parent | Save the Date - changed constant variable naming (diff) | |
Merge pull request #148 from Suhail6inkling/save-the-date-fix
Save the Date - Static Resource Load
Diffstat (limited to '')
| -rw-r--r-- | bot/seasons/valentines/savethedate.py | 23 | 
1 files changed, 12 insertions, 11 deletions
| diff --git a/bot/seasons/valentines/savethedate.py b/bot/seasons/valentines/savethedate.py index b9484be9..f460283a 100644 --- a/bot/seasons/valentines/savethedate.py +++ b/bot/seasons/valentines/savethedate.py @@ -12,6 +12,9 @@ log = logging.getLogger(__name__)  HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"] +with open(Path('bot', 'resources', 'valentines', 'date_ideas.json'), 'r', encoding="utf8") as f: +    VALENTINES_DATES = load(f) +  class SaveTheDate:      """ @@ -26,17 +29,15 @@ class SaveTheDate:          """          Gives you ideas for what to do on a date with your valentine.          """ -        with open(Path('bot', 'resources', 'valentines', 'date_ideas.json'), 'r', encoding="utf8") as f: -            valentine_dates = load(f) -            random_date = random.choice(valentine_dates['ideas']) -            emoji_1 = random.choice(HEART_EMOJIS) -            emoji_2 = random.choice(HEART_EMOJIS) -            embed = discord.Embed( -                title=f"{emoji_1}{random_date['name']}{emoji_2}", -                description=f"{random_date['description']}", -                colour=Colours.pink -            ) -            await ctx.send(embed=embed) +        random_date = random.choice(VALENTINES_DATES['ideas']) +        emoji_1 = random.choice(HEART_EMOJIS) +        emoji_2 = random.choice(HEART_EMOJIS) +        embed = discord.Embed( +            title=f"{emoji_1}{random_date['name']}{emoji_2}", +            description=f"{random_date['description']}", +            colour=Colours.pink +        ) +        await ctx.send(embed=embed)  def setup(bot): | 
