added weather base
This commit is contained in:
parent
f69271e14c
commit
eeed5b8e03
@ -3,7 +3,7 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from weather import OpenWeatherMapAPIClient
|
from weather import OpenWeatherMapAPIClient
|
||||||
|
|
||||||
DISCORD_TOKEN = os.getenv('MTQ4MDkxODI5Mzk5MTc4ODYzNQ.GQ4P7l.uqYM-awr8zAp6eun9iJr0ziDhscv3XiByqSMpw')
|
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
||||||
WEATHER_TOKEN = os.getenv("WEATHER_TOKEN")
|
WEATHER_TOKEN = os.getenv("WEATHER_TOKEN")
|
||||||
|
|
||||||
weather_client = OpenWeatherMapAPIClient(WEATHER_TOKEN, "MyDiscordWeatherBot")
|
weather_client = OpenWeatherMapAPIClient(WEATHER_TOKEN, "MyDiscordWeatherBot")
|
||||||
@ -37,7 +37,7 @@ async def current_weather(interaction: discord.Interaction, location: str):
|
|||||||
icon = current_weather['weather'][0]['icon']
|
icon = current_weather['weather'][0]['icon']
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=f"Current weather in {location}",
|
title=f"Current weather in {location}",
|
||||||
description=f"Temperature: {temp}°C\n Sky: {weather_condition}",
|
description=f"Temperature: {temp}°C\nSky: {weather_condition}",
|
||||||
)
|
)
|
||||||
embed.set_thumbnail(url=f"https://openweathermap.org/img/wn/{icon}.png")
|
embed.set_thumbnail(url=f"https://openweathermap.org/img/wn/{icon}.png")
|
||||||
|
|
||||||
@ -63,4 +63,4 @@ async def on_ready():
|
|||||||
for command in commands:
|
for command in commands:
|
||||||
print(f"- {command.name}")
|
print(f"- {command.name}")
|
||||||
|
|
||||||
bot.run(DISCORD_TOKEN)
|
bot.run(DISCORD_TOKEN)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user