Answer the question
In order to leave comments, you need to log in
How to combine form submission into 1 message?
Hello, I made a bot.
But submitting the form doesn't work for me.
They are shipped separately.
Script:
import telebot
import config
import random
from telebot import types # кнопки
from string import Template
bot = telebot.TeleBot('XXXXX20083:AAEWRdJyH6H_XXXXXXX_65O2KXXXXXQ0')
@bot.message_handler(commands=['start'])
def welcome(message):
sti = open('1/welcome.webp', 'rb')
bot.send_sticker(message.chat.id, sti)
# keyboard
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton(" Отправка Номера", request_contact = True)
item2 = types.KeyboardButton(" Отправить Местоположение", request_location = True)
markup.add(item1, item2)
bot.send_message(message.chat.id, "Добро пожаловать, {0.first_name}!\nЯ - <b>{1.first_name}</b>, бот Сиги для изучения создания ботов.\nДля начала пройди регистрацию!".format(message.from_user, bot.get_me()),
parse_mode='html', reply_markup=markup)
@bot.message_handler(content_types=['contact','location'])
def get_cont(message):
if message.content_type == 'contact':
bot.send_message(message.chat.id,("Вы прошли регистрацию\nОтправьте ваше местоположение."))
bot.send_message(-45XXXXX81,("Имя: "+str(message.from_user.first_name)))
bot.send_message(-45XXXXX81,("Nick: "+str(message.from_user.username)))
bot.send_message(-45XXXXX81,("Номер: "+str(message.contact.phone_number)))
else:
bot.send_message(message.chat.id,("❤️Вы отправили ваше местоположение {0.first_name}❤️\nДавайте дальше.".format(message.from_user)))
bot.send_message(-45XXXXX81,("Долгота: "+str(message.location.latitude)))
bot.send_message(-45XXXXX81,("Широта: "+str(message.location.longitude)))
# RUN
bot.polling(none_stop=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question