Space Slash Command with NASA's APOD API | Discord.py

Опубликовано: 14 Февраль 2026
на канале: Digiwind
904
17

In this video, we make a space slash command in Discord.py to get random images related to space and astronomy with NASA's APOD API (the U.S. National Aeronautics and Space Administration's Astronomy Picture of the Day Application Programming Interface - yes, Americans love acronyms).

Special thanks to Panqueko.py # 0007 for their help with the thumbnail!

If you found this video helpful, please consider liking the video and subscribing (for future content) - this will help the video gain traction! If you think someone might find this video useful, please share feel free to share it with them!

If you have any questions or comments feel free to comment below!

Dependencies: AIOHTTP (an asynchronous HTTP Client/Server for asyncio and Python), JSON (built into Python), datetime (for our timestamps), and Discord.py.

Get Started with AIOHTTP: https://docs.aiohttp.org/en/stable/

See today's Astronomy Picture of the Day: https://apod.nasa.gov
NASA APIs (get your API key here): https://api.nasa.gov
NASA APOD API Endpoint (used in this video): https://api.nasa.gov/planetary/apod?a...

The rate limits for the DEMO_KEY are:
Hourly Limit: 30 requests per IP address per hour
Daily Limit: 50 requests per IP address per day

Article about Asynchronous HTTP Requests in Python with aiohttp and asyncio (referenced in this video): https://www.twilio.com/blog/asynchron...

Developer Portal:   / discord  
Discord.py GitHub: https://github.com/Rapptz/discord.py
Discord.py Discord:   / discord  
Clone the Discord.py GitHub: git clone https://github.com/Rapptz/discord.py

Discord.py 2.0 is now stable! You can use pip to install/upgrade it (pip install discord.py --upgrade).

Discord Server:   / discord  
Twitter (@Digiwind_YT):   / digiwind_yt  
Reddit (u/digiwind_yt):   / digiwind_yt  
Top.gg: https://top.gg/user/512025208542986241
Github (Digiwind): https://github.com/Digiwind
Official Discord.py Server: discord.gg/dpy

Chapters:
0:00-0:38 Intro & Demo
0:38-0:50 Imports/Dependencies
0:50-01:33 AIOHTTP: Why we use it & How to Install it
01:33-01:46 Other Imports
01:46-02:36 Basic Slash Command Code
02:36-0:3:18 Setting up the Space Slash Command
03:18-03:50 APOD API: API Key, Ratelimits, and Parameters
03:50-04:48 Getting JSON from the API and Converting it to a Dictionary
04:48-06:31 Creating and Sending the Embed
06:31-06:44 Running the Code
06:44-06:57 Testing the Slash Command
06:57-7:11 Outro

#SpaceCommand #Discordpy #DiscordpySlashCommands #Digiwind #SpaceSlashCommand #DiscordSpaceCommand