diff options
| author | 2020-10-01 16:21:38 -0700 | |
|---|---|---|
| committer | 2020-10-01 16:21:38 -0700 | |
| commit | a5a032ff351c6c636955c518598e3819a675ef93 (patch) | |
| tree | 89fab387fca5c38e20929f8bb1ca7350256bf4c2 /bot/exts | |
| parent | Add Cog and add a couple responses (diff) | |
Fix errors
Diffstat (limited to 'bot/exts')
| -rw-r--r-- | bot/exts/easter/save_the_planet.py | 49 | 
1 files changed, 24 insertions, 25 deletions
| diff --git a/bot/exts/easter/save_the_planet.py b/bot/exts/easter/save_the_planet.py index 1a20134e..84bd44ab 100644 --- a/bot/exts/easter/save_the_planet.py +++ b/bot/exts/easter/save_the_planet.py @@ -6,31 +6,6 @@ import json  embeds = [] -with open(Path("bot/resources/easter/save_the_planet.json"), 'r', encoding="utf8") as f: -    responses = json.load(f) - -# convert what's in the json to discord embed objects https://discord.com/developers/docs/resources/channel#embed-object -for response in responses["embeds"]: -    response["title"] = f"Save the Planet: {response['topic']}" -    response["footer"] = "The best thing you can do is sharing this information!" -    response["image"] = { -        "url": response["image_url"] -    } -    response["fields"] = [ -        { -            "name": "The Problem", -            "value": response["problem"], -            "inline": False -        }, -        { -            "name": "What you can do", -            "value": response["solution"] -        } -    ] - -    embeds.append(Embed.from_dict(response)) - -  # cog  class SaveThePlanet(commands.Cog):      """A cog that teaches users how they can help our planet.""" @@ -48,4 +23,28 @@ class SaveThePlanet(commands.Cog):  def setup(bot: commands.Bot) -> None:      """save_the_planet Cog load.""" +         +    with open(Path("bot/resources/easter/save_the_planet.json"), 'r', encoding="utf8") as f: +        responses = json.load(f) + +    # convert what's in the json to discord embed objects https://discord.com/developers/docs/resources/channel#embed-object +    for response in responses["embeds"]: +        response["title"] = f"Save the Planet: {response['topic']}" +        response["footer"] = {"text": "The best thing you can do is sharing this information!"} +        response["image"] = { +            "url": response["image_url"] +        } +        response["fields"] = [ +            { +                "name": "The Problem", +                "value": response["problem"], +                "inline": False +            }, +            { +                "name": "What you can do", +                "value": response["solution"] +            } +        ] + +        embeds.append(Embed.from_dict(response))      bot.add_cog(SaveThePlanet(bot))
\ No newline at end of file | 
