Answer the question
In order to leave comments, you need to log in
Function conflict using telegramBotApi, what to do?
My program should open a text document or a browser, depending on the command that I send to the bot in telegram, causing the execution, for example, of the process of creating a text document, and later, without reloading the bot, call the process of opening the browser by inserting a link to some site, by the text document still opens. It works the same way on the other side.
Here is my part of the code where the conflict occurs:
bot.message_handler(commands=['stx'])
def txt_likemsg(message):
bot.send_message(ID, "Введите содержание файла, для получателя!")
@bot.message_handler(content_types=['text'])
def txt_starter(message):
stx = message.text
f = open(r'C:\Users\USER\Desktop\sobchen.txt', 'w')
f.write(stx)
f.close()
os.system(r'C:\Users\USER\Desktop\sobchen.txt')
@bot.message_handler(commands=['bzv'])
def web_st(message):
bot.send_message(ID, "Введите ссылку на сайт для его открытия! ")
@bot.message_handler(content_types=["text"])
def browser_starter(message):
slk = message.text
webbrowser.open(slk, new=0)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question