Compare commits

...

8 Commits

Author SHA1 Message Date
1e19ebf08a add LICENSE 2023-03-20 23:16:25 +01:00
84d0447376 add solar wind command 2023-03-20 23:07:37 +01:00
a1b6e94e20 add kp index command 2023-03-20 20:43:40 +01:00
0ea6e64b44 fighting discord cache 2023-03-20 20:27:40 +01:00
54986c9ff0 .gitignore 2023-03-20 20:12:16 +01:00
f7acbf2d20 fix channel mention 2023-03-20 20:08:14 +01:00
5e51187199 __pycache__ 2023-03-20 19:59:58 +01:00
55952c3ab4 update gitignore 2023-03-20 19:57:53 +01:00
4 changed files with 38 additions and 2 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
config.py
__pycache__
nohup.out

5
LICENSE Normal file
View File

@ -0,0 +1,5 @@
"THE NON-ALCOHOLIC-BEVERAGE-WARE LICENSE":
<arnau.busom@pm.me> wrote this. As long as you retain this notice you can
do whatever you want with this stuff. If we meet some day, and you think this
stuff is worth it, you can buy me a non-alcoholic beverage in return Arnau Busom

Binary file not shown.

View File

@ -4,6 +4,8 @@
import discord
from discord.ext import commands
import config
import random
import requests
TOKEN = config.token
ID = config.channel_id
@ -14,9 +16,36 @@ bot = commands.Bot(command_prefix='!', intents=intents)
@bot.command(name='sky', help='Shows the latest image from the All Sky Camera in Kiruna')
async def ASC(ctx):
message = 'https://www.irf.se/alis/allsky/krn/latest.jpeg'
num = random.randint(1,100000)
message = f'https://www.irf.se/alis/allsky/krn/latest.jpeg?{num}'
if ctx.channel.id != ID:
await ctx.send(f"Please keep this stuff in <{ID}>")
await ctx.send(f"Please keep this stuff in <#{ID}>")
return
else:
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.command(name='solarWind', help='Shows graph with solar wind and magnetic field info')
async def ASC(ctx):
num = random.randint(1,100000)
message = f'https://www.spaceweather.se/content/irf-kp.png?{num}'
if ctx.channel.id != ID:
await ctx.send(f"Please keep this stuff in <#{ID}>")
return
else:
await ctx.send(message)