diff --git a/auroraBot.py b/auroraBot.py index 81091c4..57b1ff3 100644 --- a/auroraBot.py +++ b/auroraBot.py @@ -5,6 +5,7 @@ import discord from discord.ext import commands import config import random +import requests TOKEN = config.token ID = config.channel_id @@ -24,4 +25,18 @@ async def ASC(ctx): await ctx.send(message) return +@bot.command(name='kp', help='Shows the current Kp index') +async def kp(ctx): + response = requests.get('https://services.swpc.noaa.gov/products/noaa-planetary-k-index.json') + data = response.json() + kp = data[-1][1] + message = f'The current Kp index is {kp}' + + if ctx.channel.id != ID: + await ctx.send(f"Please keep this stuff in <#{ID}>") + return + else: + await ctx.send(message) + return + bot.run(TOKEN) \ No newline at end of file