From afaa15d3dc6e81f09ccf9e0d4cb33715aae8aedc Mon Sep 17 00:00:00 2001 From: Chris Gallardo Date: Mon, 5 Oct 2020 14:54:50 -0700 Subject: apply @Den4200's suggestions Co-Authored-By: Dennis Pham --- bot/exts/easter/save_the_planet.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'bot') diff --git a/bot/exts/easter/save_the_planet.py b/bot/exts/easter/save_the_planet.py index 99f06bbc..8f644259 100644 --- a/bot/exts/easter/save_the_planet.py +++ b/bot/exts/easter/save_the_planet.py @@ -4,9 +4,11 @@ from pathlib import Path from discord import Embed from discord.ext import commands -from bot.utils import RandomCycle +from bot.utils.randomization import RandomCycle -EMBED_DATA = [] + +with Path("bot/resources/easter/save_the_planet.json").open('r', encoding='utf8') as f: + EMBED_DATA = RandomCycle(json.load(f)) class SaveThePlanet(commands.Cog): @@ -15,10 +17,6 @@ class SaveThePlanet(commands.Cog): def __init__(self, bot: commands.Bot) -> None: self.bot = bot - with Path("bot/resources/easter/save_the_planet.json").open('r', encoding='utf8') as f: - global EMBED_DATA - EMBED_DATA = RandomCycle(json.load(f)) - @commands.command(aliases=('savetheearth', 'saveplanet', 'saveearth')) async def savetheplanet(self, ctx: commands.Context) -> None: """Responds with a random tip on how to be eco-friendly and help our planet.""" -- cgit v1.2.3