add kp index command
This commit is contained in:
parent
0ea6e64b44
commit
a1b6e94e20
15
auroraBot.py
15
auroraBot.py
|
@ -5,6 +5,7 @@ import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import config
|
import config
|
||||||
import random
|
import random
|
||||||
|
import requests
|
||||||
|
|
||||||
TOKEN = config.token
|
TOKEN = config.token
|
||||||
ID = config.channel_id
|
ID = config.channel_id
|
||||||
|
@ -24,4 +25,18 @@ async def ASC(ctx):
|
||||||
await ctx.send(message)
|
await ctx.send(message)
|
||||||
return
|
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)
|
bot.run(TOKEN)
|
Loading…
Reference in New Issue
Block a user