def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() dt = datetime.now(timezone(timedelta(hours=3))) eio.info_write(dt.date(), self.date, self.message, attachment) eio.save() return [("Сообщение успешно добавлено", "")]
def exec(self, message, attachment): eio = excel.ExcelIO() self.parse_args(message) old_cell = self._clear_cell(eio, self.date, self.num) self._write_cell(eio, self.new_date, self.new_num, old_cell) eio.save() return [("Пара успешно перенесена", "")]
def exec(self, message, attachment): eio = excel.ExcelIO() self.parse_args(message) self._write_cell(eio, self.date, self.num, self.subject \ + self.description + ", " + self.classroom) eio.save() return [("Пара успешно добавлена", "")]
def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() info = eio.info_read(self.id) if not info[1]: raise exceptions.NikolayException('Не удалось найти сообщение с id=%d' % self.id) eio.info_write(info[1], self.date, info[3], info[4], info[0]) eio.save() return [("Сообщение успешно перенесено", "")]
def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() cell_value = self._clear_cell(eio, self.date, self.num) lst = cell_value.split(", ") if len(lst) < 2: raise exceptions.NikolayException("Что-то не так с ячейкой в файле расписания") lst[-1] = self.classroom cell_value = ", ".join(lst) self._write_cell(eio, self.date, self.num, cell_value) eio.save() return [("Пара успешно обновлена", "")]
def exec(self, message, attachment): self.parse_args(message, attachment) eio = excel.ExcelIO() dt = datetime.now(timezone(timedelta(hours=3))) info = eio.info_read(self.id) if not info[1]: raise exceptions.NikolayException('Не удалось найти сообщение с id=%d' % self.id) if self.message: info[3] = self.message if attachment: info[4] = attachment eio.info_write(info[1], info[2], info[3], info[4], info[0]) eio.save() return [("Сообщение успешно обновлено", "")]
def exec(self, message, attachment): eio = excel.ExcelIO() dt = datetime.now(timezone(timedelta(hours=3))) t = dt.time() daily = eio.get_schedule(dt.date()) daily_lst = daily.split("\n") response = "" if "Выходной, отдыхаем" in daily: response = "Пары закончились, отдыхаем" else: start = int(daily_lst[1][0]) end = int(daily_lst[-3][0]) if t > utility.timetable[end][1]: response = "Пары закончились, отдыхаем" else: for i in range(start-1, end): if t > utility.timetable[i][1] and t < utility.timetable[i+1][1]: response = daily_lst[i-start+2] return [(response, "")]
def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() return [(eio.get_schedule(self.date, self.delta), "")]
def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() eio.info_delete(self.id) eio.save() return [("Сообщение успешно удалено", "")]
def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() return eio.get_info(self.q, self.date)
def exec(self, message, attachment): eio = excel.ExcelIO() subj_lst = eio.get_subjects() return [('Список предметов:\n' + '\n'.join(subj_lst), "")]
def exec(self, message, attachment): self.parse_args(message) eio = excel.ExcelIO() self._clear_cell(eio, self.date, self.num) eio.save() return [("Пара успешно удалена", "")]