@nzarchii60

Почему не воспринимает переменую в тексте telebot?

i = ('text')

import telebot
import config
import random
 
from telebot import types
 
bot = telebot.TeleBot(config.TOKEN)
i = ('text')
x = ('text')
z = ('text')
y = ('text')
@bot.message_handler(commands=['start'])
def welcome(message):
    sti = open('avatar1459.jpg', 'rb')
    bot.send_sticker(message.chat.id, sti)

    # keyboard
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
    item1 = types.KeyboardButton(text='i')
    item2 = types.KeyboardButton(text='x')
    item3 = types.KeyboardButton(text='z')
    item4 = types.KeyboardButton(text='y')

  
    markup.add(items1, items2, items3, items4)
 
    bot.send_message(message.chat.id, "Добро пожаловать, {0.first_name}!\nЯ - <b>{1.first_name}</b>, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()),
        parse_mode='html', reply_markup=markup)
@bot.message_handler(func=lambda message: True)
  • Вопрос задан
  • 110 просмотров
Решения вопроса 1
hottabxp
@hottabxp Куратор тега Python
Сначала мы жили бедно, а потом нас обокрали..
item1 = types.KeyboardButton(text='i')
    item2 = types.KeyboardButton(text='x')
    item3 = types.KeyboardButton(text='z')
    item4 = types.KeyboardButton(text='y')

Кавычки уберите.
И
markup.add(items1, items2, items3, items4)
замените не:
markup.add(item1, item2, item3, item4)
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы