for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
response = event.text.lower()
keyboard = create_keyboard(response)
if event.from_user and not event.from_me:
tm1 = False
if response == 'тм1':
tm1 = True
send_message(vk_session, 'user_id', event.user_id, message='123', keyboard=keyboard)
elif response == 'сегодня' and tm1:
today = datetime.now()
day = date.weekday(today)
if day == 0 :
workbook = xlrd.open_workbook(r"ras19-20_2s.xls")
sheet = workbook.sheet_by_index(0)
def get_cell_range(start_col, start_row, end_col, end_row):
return [sheet.row_slice(row, start_colx=start_col, end_colx=end_col + 1) for row in range(start_row, end_row + 1)]
data = get_cell_range(3, 7, 6, 26) # D8 to G27
print (data)
send_message(vk_session, 'user_id', event.user_id, message=data, keyboard=None)
elif day == 4 :
workbook = xlrd.open_workbook(r"ras19-20_2s.xls")
sheet = workbook.sheet_by_index(0)
def get_cell_range(start_col, start_row, end_col, end_row):
return [sheet.row_slice(row, start_colx=start_col, end_colx=end_col + 1) for row in range(start_row, end_row + 1)]
data = get_cell_range(3, 7, 6, 26) # D8 to G27
print (data)
send_message(vk_session, 'user_id', event.user_id, message=data, keyboard=None)