✅ Namuna: 16:00",
parse_mode='html',reply_markup=markup)
bot.register_next_step_handler(msg, data_time_step)
bot.delete_message(call.message.chat.id, call.message.message_id)
elif call.data == "yes_text":
bot.answer_callback_query(call.id, "Endi xabarnoma uchun matnni yuboring")
msg = bot.send_message(chat_id,
"🎯 Xabarnomada ko'rsatilishi zarur bo\'lgan xabar matnini yuboring.",
parse_mode='html')
bot.register_next_step_handler(msg, data_text_step)
bot.delete_message(call.message.chat.id, call.message.message_id)
elif call.data == "save":
session = Session()
days = session.query(Rejim).filter(Rejim.user_id == chat_id).filter(Rejim.finish == 0).order_by(Rejim.id.desc()).first()
need_str = days.day
need = need_str.split(" ")
for j in need:
second = Second_db()
second.user_id = days.user_id
second.group_id = days.group_id
second.day = j
second.days_id = days.id
second.time = days.time
second.text = days.text
second.finish = 0
session.add(second)
up_id = session.query(Rejim).filter(Rejim.user_id == chat_id).filter(Rejim.finish == 0).order_by(Rejim.id.desc()).first().id
session.query(Rejim).filter(Rejim.id == up_id).update({Rejim.finish: 1}, synchronize_session=False)
session.commit()
session.close()
bot.answer_callback_query(call.id, "🟢 Xabarnoma tartibi o\'rnatildi")
bot.delete_message(call.message.chat.id, call.message.message_id)
if (call.data)[0:3] == "del":
try:
bot.answer_callback_query(call.id,"O\'chirildi")
del_id = int((call.data)[3:])
session = Session()
x = session.query(Rejim).filter(Rejim.id == del_id).one()
session.delete(x)
session.commit()
session.close()
bot.send_message(chat_id,"Tanlangan xabarnoma o\'chirildi")
bot.delete_message(call.message.chat.id, call.message.message_id)
except Exception as e:
bot.send_message(config.admin_id, e)
@bot.message_handler(commands=['start','help','soat'])
def phone(message):
if(message.text == "/start"):
_count = session.query(User).filter(User.user_id == message.chat.id).count()
if (_count == 0):
keyboard = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
button_phone = types.KeyboardButton(text="Telefon raqamni yuborish", request_contact=True)
keyboard.add(button_phone)
bot.send_message(message.chat.id, "Iltimos botdan to\'liq foydalanish uchun telefon raqamingizni yuboring",
reply_markup=keyboard)
else:
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup.row('📣 Yangi xabarnomani qo\'shish')
markup.row('🔕 O\'rnatilgan xabarnomani o\'chirish')
bot.send_message(message.chat.id, "Men Grootman 🌱",
reply_markup=markup, parse_mode="html")
if(message.text == "/help"):
text = "🌱 Men
Do'stlaringiz bilan baham: |