def get_day(self, bot, call, location, lang, index_location): chat_id = call.message.chat.id # myClass.work.current_shown_dates.get(chat_id) saved_date = self.current_shown_dates.get(chat_id) if (saved_date is not None): day = call.data[13:] # день на который нажал юзер date = datetime.datetime( int(saved_date[0]), int(saved_date[1]), int(day), self.some_group[self.edit_note_work]['time']['hour'], self.some_group[self.edit_note_work]['time']['minute']) self.some_group[self.edit_note_work]['time']['year'] = str( saved_date[0]) self.some_group[self.edit_note_work]['time']['month'] = str( saved_date[1]) self.some_group[self.edit_note_work]['time']['day'] = str(day) bot.send_message(chat_id, str(date)) bot.answer_callback_query(call.id, text="") # fitcha if location[index_location] == 'add_note_time1': location[index_location] = 'add_note_time2' # get_watch() if lang == 'ru': bot.send_message(call.from_user.id, "Выберете время", reply_markup=create_watch( self.some_group[self.edit_note_work] ['time']['hour'], self.some_group[self.edit_note_work] ['time']['minute'])) user_markup = telebot.types.ReplyKeyboardMarkup(True, True) user_markup.row("Дальше") bot.send_message(call.from_user.id, "И нажмите на кнопку \"Дальше\"", reply_markup=user_markup) else: bot.send_message(call.from_user.id, "Select the time", reply_markup=create_watch( self.some_group[self.edit_note_work] ['time']['hour'], self.some_group[self.edit_note_work] ['time']['minute'])) user_markup = telebot.types.ReplyKeyboardMarkup(True, True) user_markup.row("OK") bot.send_message(call.from_user.id, "And click on the button \"OK\"", reply_markup=user_markup) else: # Do something to inform of the error pass return location
def minut_decrement(call): global hours, minutes minutes -= 10 if minutes < 0: minutes += 60 # обнуление счетчика bot.edit_message_reply_markup(chat_id=call.from_user.id, message_id=call.message.message_id, reply_markup=create_watch(hours, minutes))
def hours_increment(call): global hours, minutes hours += 1 if hours >= 24: hours -= 24 print("hours and minutes:", hours, minutes) bot.edit_message_reply_markup(chat_id=call.from_user.id, message_id=call.message.message_id, reply_markup=create_watch(hours, minutes))
def minut_decrement(self, bot, call): self.some_group[self.edit_note_work]['time']['minute'] -= 10 if self.some_group[self.edit_note_work]['time']['minute'] < 0: self.some_group[self.edit_note_work]['time'][ 'minute'] += 60 # обнуление счетчика bot.edit_message_reply_markup( chat_id=call.from_user.id, message_id=call.message.message_id, reply_markup=create_watch( self.some_group[self.edit_note_work]['time']['hour'], self.some_group[self.edit_note_work]['time']['minute']))
def hours_decrement(self, bot, call): self.some_group[self.edit_note_work]['time']['hour'] -= 1 if self.some_group[self.edit_note_work]['time'][ 'hour'] < 0: # 0 -> ... -> 23 -> 0 self.some_group[self.edit_note_work]['time']['hour'] += 24 bot.edit_message_reply_markup( chat_id=call.from_user.id, message_id=call.message.message_id, reply_markup=create_watch( self.some_group[self.edit_note_work]['time']['hour'], self.some_group[self.edit_note_work]['time']['minute']))
def get_calendar(message): global hours, minutes hours, minutes = 12, 0 now = datetime.datetime.now() # Current date chat_id = message.chat.id date = (now.year, now.month) current_shown_dates[chat_id] = date # Saving the current date in a dict markup = create_calendar(now.year, now.month) bot.send_message(message.chat.id, "Please, choose a date", reply_markup=markup) markup = create_watch(hours, minutes) bot.send_message(message.chat.id, "Chose hourse", reply_markup=markup)