telegram - Python TelegramBot save contacts -


hello have code code sends contact

    keyboard = types.replykeyboardmarkup(one_time_keyboard=false)     reg_button = types.keyboardbutton(text="...", request_contact=true)     keyboard.add(reg_button)     keyboard.row('...')     response = bot.send_message(message.chat.id,'...',                                 reply_markup=keyboard)     print(response.contact)  # response.contact = none here 

why save contact in file or database. please :)

#bot sends received data channel

@bot.message_handler(content_types=['contact','location']) def send_welcome(message): first_name = message.from_user.first_name.decode("utf-8") user_id = message.from_user.id username = message.chat.username chat_id = message.chat.id if message.contact: pn = message.contact.phone_number cf = message.contact.first_name bot.send_message(your_channel_id, "#contact [{0}](https://telegram.me/{1})".format(user_id, username), parse_mode="markdown", disable_web_page_preview=true) bot.send_contact(your_channel_id, phone_number=pn, first_name=cf) if message.location: bot.send_message(your_channel_id, "#location [{0}](https://telegram.me/{1})".format(user_id, username), parse_mode="markdown", disable_web_page_preview=true) bot.send_location(your_channel_id, message.location.latitude, message.location.longitude)


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -