S
S
SHADRIN2020-12-12 12:27:44
Python
SHADRIN, 2020-12-12 12:27:44

How to send geolocation again?

Hello, I send the location to the bot 1 time, everything is fine, but it doesn’t send it 2 times, it doesn’t even send a point on the map, it just thinks and gives an error in the telegram, in the code the decorator doesn’t catch the request for the location (it just doesn’t exist)
What should I do? How to be? I repeat 1 time sends only
Here is the code if necessary:

@bot.message_handler(commands=["start"])
def start(message):

    
    keyboard = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
    button_geo = types.KeyboardButton(text="Отправить местоположение", request_location=True)
    keyboard.add(button_geo)
    bot.send_message(message.chat.id, "Отправь мне свой номер телефона или поделись местоположением, жалкий человечишка!", reply_markup=keyboard)





@bot.message_handler(content_types=["location"])
def location(message):
    if message.location is not None:

        print(message.location)
        print("latitude: %s; longitude: %s" % (message.location.latitude, message.location.longitude))
        
        keyboard = types.ReplyKeyboardRemove()
        bot.send_message(message.chat.id, 'Отлично', reply_markup=keyboard)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question