aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Gallardo <[email protected]>2020-10-02 07:41:50 -0700
committerGravatar GitHub <[email protected]>2020-10-02 07:41:50 -0700
commitdd4b79873b8ea001dd3f343763fcab7821a107ca (patch)
treee83bb8c509ff21cb938336fbad34bf8fd3c85599
parentTake @thomaspet's suggestion for SaveThePlanetCog (diff)
Fix styling
-rw-r--r--bot/exts/easter/save_the_planet.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bot/exts/easter/save_the_planet.py b/bot/exts/easter/save_the_planet.py
index 4ea7a5fb..6019304d 100644
--- a/bot/exts/easter/save_the_planet.py
+++ b/bot/exts/easter/save_the_planet.py
@@ -1,11 +1,14 @@
-from discord.ext import commands
+import json
+import random
from pathlib import Path
+
from discord import Embed
-import random
-import json
+from discord.ext import commands
+
embeds = []
+
class SaveThePlanet(commands.Cog):
"""A cog that teaches users how they can help our planet."""
@@ -13,6 +16,7 @@ class SaveThePlanet(commands.Cog):
self.bot = bot
def get_response(self) -> Embed:
+ """Return a random Embed from the list of embeds."""
return random.choice(embeds)
@commands.command(aliases=('save_the_earth',))
@@ -20,13 +24,13 @@ class SaveThePlanet(commands.Cog):
"""Responds with a random tip on how to be ecofriendly and help our planet."""
await ctx.send(embed=self.get_response())
+
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
+ # convert what's in the json to discord embed objects
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!"}