Л
import datetime
import pprint
import gspread
import telebot
from oauth2client.service_account import ServiceAccountCredentials
link = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
my_creds = ServiceAccountCredentials.from_json_keyfile_name('dad.json', link)
client = gspread.authorize(my_creds)
sheet = client.open('test').sheet1
print_p = pprint.PrettyPrinter()
get_data3 = sheet.cell(1, 1).value
get_data2 = sheet.cell(2, 1).value
hour = datetime.datetime.now().hour
bot = telebot.TeleBot('**')
morning = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
evening = [17, 18, 19, 20, 21, 22, 23, 24, 00, 1, 2, 3, 4]
@bot.message_handler(content_types=['text'])
def main(message): # функция смотрит какое там время стоит, исходя из времени даёт ответ
if datetime.datetime.now().hour in morning and message.text.lower() == "призвать техсап":
bot.send_message(message.chat.id, get_data3)
elif datetime.datetime.now().hour in evening and message.text.lower() == "призвать техсап":
bot.send_message(message.chat.id, get_data2)
elif message.text.lower() == "/help":
bot.send_message(message.chat.id, 'Напишите "призвать техсап"')
bot.polling(none_stop=True, interval=0)
