diff options
author | 2019-04-09 22:17:14 +0530 | |
---|---|---|
committer | 2019-04-09 22:17:14 +0530 | |
commit | 592cd2826b865e8abe1bea15fb48fd736a7c3f53 (patch) | |
tree | f030665331e0be8f670a163173f0e99405bce292 | |
parent | done with the easter egg fact cmd and background task (diff) |
fixed lint errors
-rw-r--r-- | bot/seasons/easter/egg_facts.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/bot/seasons/easter/egg_facts.py b/bot/seasons/easter/egg_facts.py index 1080f6c6..dcc15078 100644 --- a/bot/seasons/easter/egg_facts.py +++ b/bot/seasons/easter/egg_facts.py @@ -1,26 +1,30 @@ -from discord.ext import commands -import discord import asyncio -from pathlib import Path -from json import load import random +from json import load +from pathlib import Path + +import discord +from discord.ext import commands + from bot.constants import Colours class EasterFacts(commands.Cog): - + """A cog for easter egg facts.""" def __init__(self, bot): self.bot = bot self.facts = self.load_json() @staticmethod def load_json(): + """Loading the json data""" p = Path('bot', 'resources', 'easter', 'easter_egg_facts.json') with p.open(encoding="utf8") as f: facts = load(f) return facts async def background(self): + """A background task that sends a easter egg fact.""" channel = self.bot.get_channel(426566445124812815) while True: embed = self.make_embed() @@ -29,10 +33,12 @@ class EasterFacts(commands.Cog): @commands.command(name='eggfact', aliases=['fact']) async def easter_facts(self, ctx): + """Get easter egg facts.""" embed = self.make_embed() await ctx.send(embed=embed) def make_embed(self): + """Makes a nice embed for the message to be sent.""" embed = discord.Embed() embed.colour = Colours.soft_red embed.title = 'Easter Egg Fact' @@ -42,5 +48,6 @@ class EasterFacts(commands.Cog): def setup(bot): + """Loading the cog""" bot.loop.create_task(EasterFacts(bot).background()) bot.add_cog(EasterFacts(bot)) |