D
D
DaniPyzinski2019-11-24 23:49:46
Python
DaniPyzinski, 2019-11-24 23:49:46

Can you help with integrating the schedule library into the code?

There is a code in which I tried to implement this library with a piece of code, but because of this, the whole code stopped working. Please help someone who understands this

import telebot
import schedule
import time

bot = telebot.TeleBot('745742569:AAF04KfSFa8')
keyboard1 = telebot.types.ReplyKeyboardMarkup(True, True)
keyboard1.row('1', '2')

def job():
    print("Ура,работает.")
    bot.send_message(461402431, 'Вот ссылка на фото -')
schedule.every(1).minutes.do(job)


@bot.message_handler(commands=['start'])
def start_message(message):
    bot.send_message(message.chat.id, '111', reply_markup=keyboard1)

@bot.message_handler(content_types=['text'])
def send_text(message):
    if message.text.lower() == '1':
        bot.send_message(message.chat.id, '1')
    elif message.text.lower() == '2':
        bot.send_message(message.chat.id, '2')
    elif message.text.lower() == '3':
        bot.send_sticker(message.chat.id, '3')

while True:
    schedule.run_pending()
    time.sleep(1)        

bot.polling()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question