Не работает стартовая строка в боте
Мне нужно получать user.id или chat.id чтобы отдельным людям присылать сообщения но нужная переменная выделяется KeyEror
вот текст ошибки
File "C:\Users\пк\Desktop\BOT 2.0\bas.py", line 103, in <module>
bot.polling(none_stop=True)
File "C:\Users\пк\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1044, in polling
logger_level=logger_level, allowed_updates=allowed_updates)
File "C:\Users\пк\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1118, in __threaded_polling
raise e
File "C:\Users\пк\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1074, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\пк\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\util.py", line 156, in raise_exceptions
raise self.exception_info
File "C:\Users\пк\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\util.py", line 100, in run
task(*args, **kwargs)
File "C:\Users\пк\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 6308, in _run_middlewares_and_handler
result = handler['function'](message)
File "C:\Users\пк\Desktop\BOT 2.0\bas.py", line 35, in start
bot.send_message(config.myId, text='@{0.username} его id {asd}'.format(message.from_user, reply_markup=markup))
KeyError: 'asd'
def start(message):
asd = (message.chat.id)
sti = open('static\welcome.webp', 'rb')
bot.send_sticker(message.chat.id, sti)
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
btn1 = types.KeyboardButton("Хочу получить 100 рублей")
btn2 = types.KeyboardButton("❓ Задать вопрос")
btn3 = types.KeyboardButton('?Магазин?')
markup.add(btn1, btn2, btn3)
bot.send_message(message.chat.id, text="Привет, {0.first_name}! я бот который может тебе помочь!".format(message.from_user), reply_markup=markup)
#bot.send_message(message.chat.id, text='{0.username}'.format(message.from_user, reply_markup=markup))
bot.send_message(config.myId, text='@{0.username} по имени {0.first_name} открыл бота'.format(message.from_user, reply_markup=markup))
bot.send_message(config.myId, text='@{0.username} его id {asd}'.format(message.from_user, reply_markup=markup))[![введите сюда описание изображения][1]][1]