🗓 Har hafta yoki 🔂 Bir martalik tartibidan foydalaning",
reply_markup=keyboard_l,parse_mode="html")
else:
session = Session()
session.query(Rejim).filter(Rejim.user_id == chat_id).filter(Rejim.finish == 0).update(
{Rejim.day: m_text}, synchronize_session=False)
session.commit()
session.close()
keyboard_l = types.InlineKeyboardMarkup()
btn1 = types.InlineKeyboardButton("✅ Ha, vaqtni belgilash", callback_data="yes_time")
btn2 = types.InlineKeyboardButton("🙅♂️ Yo\'q, qayta tanlash", callback_data="only_one_date")
keyboard_l.add(btn1)
keyboard_l.add(btn2)
bot.send_message(chat_id, "📌 Xabarnomani har oyning " + m_text + "-sanasiga o'rnatmoqchimisiz? 🧐",
parse_mode="html", reply_markup=keyboard_l)
else:
msg = bot.send_message(chat_id, "📝 1Sanani namunadagi ko\'rinishda kiriting")
bot.register_next_step_handler(msg, data_date_step)
except Exception as e:
msg = bot.send_message(chat_id, "📝 Sanani namunadagi ko\'rinishda kiriting")
bot.send_message(config.admin_id,e)
bot.register_next_step_handler(msg, data_date_step)
def data_sana_step(message):
chat_id = message.chat.id
m_text = message.text
tz = pytz.timezone('Asia/Tashkent')
now = datetime.now(tz)
today_date = str(now.strftime('%d.%m.%Y'))
sana = struct_time(localtime())
try:
if m_text == "🔙Ortga":
keyboard_l = types.InlineKeyboardMarkup()
btn1 = types.InlineKeyboardButton("🗓 Har hafta", callback_data="hafta_kun")
btn2 = types.InlineKeyboardButton("📅 Har oyda", callback_data="only_one_date")
btn3 = types.InlineKeyboardButton("🔂 Bir martalik", callback_data="only_one")
back = types.InlineKeyboardButton("🔙Ortga", callback_data="back")
keyboard_l.add(btn1)
keyboard_l.add(btn2)
keyboard_l.add(btn3)
keyboard_l.add(back)
msg = bot.send_message(chat_id, "🎯 Xabarnoma turini tanlang",
reply_markup=keyboard_l)
bot.delete_message(message.chat.id,message.message_id)
#26.05.2020
elif m_text[2] == "." and m_text[5] == "." and int(m_text[0]) <= 3 and int(m_text[1]) <= 9 and not (int(m_text[0]) == 3 and int(m_text[1]) >= 1) and int(m_text[3]) <= 1 and int(m_text[4]) <= 9 and not (int(m_text[3]) == 1 and int(m_text[4]) >= 2) and int(m_text[6:10]) >= 2020:
if strptime(m_text, '%d.%m.%Y') > sana or m_text == today_date:
print(str(strptime(m_text, '%d.%m.%Y')))
session = Session()
session.query(Rejim).filter(Rejim.user_id == chat_id).filter(Rejim.finish == 0).update(
{Rejim.day: m_text}, synchronize_session=False)
session.commit()
session.close()
keyboard_l = types.InlineKeyboardMarkup()
btn1 = types.InlineKeyboardButton("✅ Ha, vaqtni belgilash", callback_data="yes_time")
btn2 = types.InlineKeyboardButton("🙅♂️ Yo\'q, qayta tanlash", callback_data="only_one")
keyboard_l.add(btn1)
keyboard_l.add(btn2)
bot.send_message(chat_id, "📌 Xabarnomani
Do'stlaringiz bilan baham: |