csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
789 stars 171 forks source link

telegram Bot #385

Closed ratdriftbot closed 2 years ago

ratdriftbot commented 2 years ago

escho 7.txt Where is my mistakes? Где мои ошибки?

Epy commented 2 years ago

Seems to be spam ?

ratdriftbot commented 2 years ago

What kind of spam in link is my code!

Sent from my iPhone

On 31 Oct 2021, at 18:36, Epy @.***> wrote:

 Seems to be spam ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

geofbaum commented 2 years ago

@ratdriftbot No offense to you or your code but I think @Epy isn't referring to the fact that you opened this issue asking for help with your mistake. It's more so about the fact that you opened another one solely to mention this one, and then mentioned this one again on two other issues. All of this is without any further information regarding your actual issue that doesn't require someone to click on a possibly dubious link. If you want help you need to put in the errors your seeing and your code into the actual Issue you're raising not simply adding a link and asking what's wrong.

All of the above screams spam and/or bot so if you'd like help you need to be able to post the appropriate errors and your code in this issue if you'd like help from others trying to fix it.

csparpa commented 2 years ago

@ratdriftbot @Epy @geofbaum I've been bold enough to click on the link.. a txt file is shown containing @ratdriftbot 's code. But yes, it'd be better not to post here links to external resources unless absolutely necessary: code can indeed be posted here

@ratdriftbot - please, remove your OWM and Telegram API keys from that file and change them in your production settings, as they might have been compromised then

As regards the code - here is the relevant part

@bot.message_handler(content_types=['text'])
def weather(message):
    mgr = owm.weather_manager()
    observation = mgr.weather_at_place(message.text)
    w = observation.weather()   # <-------
    temp = w.temperature('celsius')["temp"]

    answer = "In city" + message.text + "Now" + w.detailed_status +"\n"
   # ...

Seems like the error is when you get the weather object: it should be w = observation.weather instead of w = observation.weather()

Epy commented 2 years ago

Sorry for the mistake

You asked for help, no problem with that, but put a link to your post 3 times on unrelated or empty new subjects; these are spammers methods.

csparpa commented 2 years ago

@ratdriftbot is the code snippet working for you? Shall we close this issue ?