I use pytelegrambotapi library to make my bot in telegram.
Here is my code:
import config
import telebot
bot = telebot.TeleBot(config.token)
@bot.message_handler(commands=['start'])
def handle_start_message(message):
bot.send_message(message.chat.id, "Hello. I'm your bot")
print(message.text)
What I want to do is to return the message text in my command line. It returns nothing, however, the bot is working since it answers me in telegram.
2
Answers
Most probably, the code is running in separate Tread/Process, which does not have access to the console, and hence, not able to print something in it.
Use logging to file instead of print.
Here is a useful link – https://github.com/python-telegram-bot/python-telegram-bot#logging
This one works but it will simply spit out the entire content.
I am trying to find a better alternative hope I will make this process simple.
I have tested it.