Home>
import telebot
import random
from telebot import types
sl= 'E: \ telegrambot \ 1.jpg'
sk= {
'1': 'text1',
'2': 'text2',
'3': 'text3',
'4': 'text4',
'5': 'text5',
'6': 'text6',
'7': 'text7',
'8': 'text8',
'9': 'text9'
}
bot= telebot.TeleBot ('TOKEN');
def callback (call):
if call.message:
if call.data== 'yes':
bot.send_photo (messege.chat.id, open (sl))
elif call.data== 'no':
bot.edit_message_text (chat_id= call.message.chat.id, message_id= call.message.id, text= sk [str (random.randint (1,9))])
bot.polling (none_stop= True, interval= 0)
Writes an error bot.send_photo (messege.chat.id, open (sl)) NameError: name 'messege' is not defined
Related questions
- How to randomly open photos in Telegram Bot in Python?
- python : How to transfer the value of a variable from one handler to another. Using FSM
- number of keyboard buttons per line in keyboard under telebot python telegram message
- How to make the bot respond to commands in the telegram channel. Python, Telebot
- python : Telegram bot listening to another bot
- python : Sending messages to Telegram
- Trouble running telegram bot in Python!
- python : TypeError: object of type 'function' has no len()
- python : How to embed an image in a message with text for telegram
- python : Getting data from invoice payment PyTelegramBotAPI
your spelling is not correct, change it to message, and + you have already entered the callback, so write call before message, you should get call.message.chat.id
DisanD_082021-12-30 19:15:12