S
S
sola-boat2021-05-09 19:19:47
Python
sola-boat, 2021-05-09 19:19:47

I want to display the weather in the chat using PyOWM, it gives an error, how to solve it?

Instead of API KEY, my key is hidden, just in case

Error:
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: arg is a required argument that is missing.

The code:

# weather
@client.command()
async def w( ctx, *, arg ):
    owm = pyowm.OWM( 'API KEY' )
    city = arg
 
    observation = owm.weather_at_place( city )
    w = observation.get_weather()
    temperature = w.get_temperature( 'celsius' )[ 'temp' ]
 
    await ctx.send( f'Температура в { city } : { temperature }' )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-05-09
@SoreMix

What command do you send to discord?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question