Answer the question
In order to leave comments, you need to log in
I wrote a python code to create a telegram bot. When I run it, there are no errors, but the bot does not respond to messages. What could be the problem?
Here is my code:
from pyowm import OWM
from pyowm.utils import config
from pyowm.utils import timestamps
import telebot
owm = OWM('bcc70df13d1999079af2bef1bddab1b8')
bot = telebot.TeleBot('token')
@bot.message_handler(content_types=['text'])
def send_echo(message):
mgr = owm.weather_manager()
observation = mgr.weather_at_place( message.text )
w = observation.weather
answer = "В городе " + message.text + " сейчас " + str(temp) + '\n'
temp=w.temperature('celsius')["temp"]
bot.send_message(message.chat.id, answer)
bot.polling( non_stop =True)
Answer the question
In order to leave comments, you need to log in
When I run it, there are no errors.
non_stop
there is no parameter, it is callednone_stop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question