A
A
andriy71122019-02-04 17:34:55
Python
andriy7112, 2019-02-04 17:34:55

How to replace input() in this code so that the value can be entered through the bot?

How to replace input() in this code so that the title can be entered through the bot?

def duplicate_sheet(message: types.Message):
    wks_start = gc.open ('Test').get_worksheet (0)
    bot.send_message (message.chat.id, 'Введите название листа: ')
    new_sheet_name = input ('Input sheet name:')
   # new_sheet_name = message.text
    while new_sheet_name in list_sheets ():
        bot.send_message (message.chat.id,'Таблица "{0}" уже существует. Введите другое название.'.format (new_sheet_name))
        new_sheet_name = input ('Input sheet name:')
        bot.send_message (message.chat.id,'Таблица "{0}" создана .'.format (new_sheet_name))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BJlaDuMup, 2019-02-04
@BJlaDuMup

Insert at the beginning, and enter / start in the telegram

@bot.message_handler(commands=['start'])
def start(message):
    bot.send_message (message.chat.id, 'Введите название листа: ')

And remove duplicate_sheet from the function:
bot.send_message (message.chat.id, 'Введите название листа: ')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question