how to add/ change the text followed by a boom.
-
pyTelegramBotAPI can't use other libraries because I've already done a lot of functions for this bot. I need to add a function in the bot where the text from the user can be can be retained and then change the text as best as to keep it all in.txt. Please, if you can help me.
-
What do you mean to keep the text? To get some text from the user, use @bot.message_handler or bot.register_next_handler to change the message using bot.edit_message_texttt
If you want to just get his message and write it down, use @bot.message_handler:
@bot.message_handler(content_types=["text"]) def write(message): text = message.text
f = open("writes.txt", "a") f.write(text) f.close()