В ошибку выкидывает 'foo' missing 1 positional argument 'message'
import telebot
from telebot import types
import schedule
import time
import random
from threading import Thread
from schedule import repeat, every
bot = telebot.TeleBot("***")
def schedule_checker():
while True:
schedule.run_pending()
time.sleep(1)
@bot.message_handler(content_types=['text'])
def foo(message):
keyboard = types.InlineKeyboardMarkup()
url_button = types.InlineKeyboardButton(text="Перейти на опрос", url="https://docs.google.com/forms/d/e/***")
keyboard.add(url_button)
msg=bot.send_message(message.chat.id, "Привет! Нажми на кнопку и перейди в опрос.",reply_markup=keyboard)
return bot.register_next_step_handler(msg, chat)
def chat(message):
lines = open("test.txt", encoding="utf8").read().splitlines()
randomline1 = random.choice(lines)
time.sleep(5)
msg=bot.send_message(message.chat.id, text=randomline1)
print(randomline1)
return bot.register_next_step_handler(msg, doo)
def doo(message):
keyboard = types.InlineKeyboardMarkup()
url_button = types.InlineKeyboardButton(text="Перейти на опрос2",url="https://docs.google.com/forms/d/e/***")
keyboard.add(url_button)
msg=bot.send_message(message.chat.id, "Привет! Нажми на кнопку и перейди в опрос.2",reply_markup=keyboard)
return bot.register_next_step_handler(msg, chat2)
def chat2(message):
lines = open("test.txt", encoding="utf8").read().splitlines()
randomline1 = random.choice(lines)
time.sleep(5)
bot.send_message(message.chat.id, text=randomline1)
print(randomline1)
if __name__=="__main__":
schedule.every().day.at("19:11").do(foo) and schedule.every().day.at("19:12").do(doo)
Thread(target=schedule_checker).start()
while True:
schedule.run_pending()
bot.polling(none_stop=True)
time.sleep(1)