Added NASA APOD. Added Config Module
This commit is contained in:
parent
06cd25eb96
commit
d2622e25e8
6 changed files with 83 additions and 15 deletions
|
@ -2,6 +2,7 @@ import discord
|
|||
|
||||
from discord.ext import commands
|
||||
from api import inspirobot
|
||||
from util import config
|
||||
|
||||
class Inspirobot(commands.Cog):
|
||||
|
||||
|
@ -15,7 +16,7 @@ class Inspirobot(commands.Cog):
|
|||
if image is None:
|
||||
await ctx.message.add_reaction("⚠️")
|
||||
else:
|
||||
embed = discord.Embed(title="InspiroBot", color=0x111387)
|
||||
embed = discord.Embed(title="InspiroBot", color=int(config.settings["color"], 16))
|
||||
embed.set_image(url=image)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
|
22
cogs/api/nasa.py
Normal file
22
cogs/api/nasa.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from api import nasa
|
||||
from util import config
|
||||
|
||||
class Nasa(commands.Cog):
|
||||
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@commands.command(name="APOD", description="Posts NASA's picture of the day.")
|
||||
@commands.cooldown(1, 30)
|
||||
async def apod(self, ctx):
|
||||
url = nasa.image_of_the_day()
|
||||
embed = discord.Embed(title="Astronomy Picture of the day", color=int(config.settings["color"], 16))
|
||||
embed.set_image(url=url)
|
||||
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(Nasa(client))
|
Loading…
Add table
Add a link
Reference in a new issue