L
L
Ls_of_stress2021-09-17 11:05:40
Python
Ls_of_stress, 2021-09-17 11:05:40

The python dictionary is not displayed in the telegram bot?

I created a dictionary in python that stores: first name, last name, number, etc. But when I want him to display all this, only the name of the first element is displayed without its value

import telebot
from telebot import types
from contact import *
TOKEN = "1995038896:AAFVvcJgkih5Q85cFkBaRroHm2YEiNKUwRQ"
bot = telebot.TeleBot(TOKEN)


@bot.message_handler(commands=['start'])
def start(message):
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
    item1 = types.KeyboardButton('Найти человека')
    item2 = types.KeyboardButton('Другое')
    markup.add(item1, item2)

    bot.send_message(message.chat.id, 'Привет, {0.first_name}! '.format(message.from_user), reply_markup=markup)


@bot.message_handler(content_types=['text'])
def bot_message(message):
    if message.chat.type == 'private':
        if message.text == 'Список':
            pass
        elif message.text == 'Фамилия Имя':
            bot.send_message(message.chat.id, contact1)
bot.polling(none_stop=True)

contact1 = {
            "Имя": "Имя",
            "Фамилия": "Фамилия",
            "Дата рождения": "Засекреченно",
            "Номер телефона": "Засекреченно",
            "Место жительства": "Засекреченно",
            "Имя родител(ей/я)": "Засекреченно",
            "Страница в ВК": "Засекреченно",
}

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