M
M
mozfo2020-08-19 12:38:01
Python
mozfo, 2020-08-19 12:38:01

The bot in the telegram does not work, although it seems to be written correctly? bot doesn't send text message but image sends?

import telebot
bot = telebot.TeleBot('1232702417:AAF5j6YSgwuI0Qehx81Rm3pbUCap4cWFO8Q')

@bot.message_handler(commands=['/start'])
def send_welcome(message):
pic = open('pictures/01.png', 'rb')
bot.send_photo(message.from_user.id, pic)
bot.send_message(message.from_user.id, 'Welcome, {0.first_name}!\nI am {1.first_name} , bot:).'.format(message .from_user, bot.get_me))

@bot.message_handler(content_types=['text'])
def get_text_messages(message):
pass

bot.polling(none_stop=True, interval=0)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-08-19
@mozfo

Not right.
1. Commands are specified without /
2. message.from_user is an object, not a person's name.
3. Why do we need 0. and 1.?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question