Int-Button va tez va oson ishledigan varyatlar, chiroyli kod yozish


Download 16.08 Kb.
Sana06.04.2023
Hajmi16.08 Kb.
#1329860
Bog'liq
telegram bot 4


Int-Button va tez va oson ishledigan varyatlar, chiroyli kod yozish
4: [MessageHandler(Filters.regex('^(🍴 Menyu)$'), menu_min)],--- Bitta bosganda birdan malumotni tekshishir uchun ishlatamiz
def menu(updete: Update, context: CallbackContext):
button_info = [
[KeyboardButton("🍴 Menyu")],
[KeyboardButton("🛍 Mening buyurtmalarim")],
[KeyboardButton("✍️ Fikr bildirish")],
[KeyboardButton("⚙️ Sozlamalar")]
]
updete.message.reply_text("Uzizngizga qulay bulgan bulimni tanlang!",
reply_markup=ReplyKeyboardMarkup(button_info, resize_keyboard=True))
return 4

Rasm quyishlarni ham boshqa usullarni kuramiz
def menu_min(updete: Update, context: CallbackContext):
msg = updete.message.text

updete.message.reply_photo(photo=open("code.jpg", "rb"),
caption="Assalomu alaykum oka",
reply_markup=InlineKeyboardMarkup(button_in))

5: [CallbackQueryHandler(inline_button)] --- inline_button bosganda qushimcha malumotlar chiqaradi
def inline_button(updete: Update, context: CallbackContext):
query = updete.callback_query
# print(query)
data = query.data.split('_')
# print(data)
if data[0] == "1":
query.message.reply_photo(photo=open("code.jpg", "rb"),
caption="Juda aniq tanlov buldi oka",
reply_markup=InlineKeyboardMarkup(button_lavash))
elif data[0] == "2":
query.message.reply_photo(photo=open("code.jpg", "rb"),
caption="Juda aniq tanlov buldi aka",
reply_markup=InlineKeyboardMarkup(button_dasert))

Download 16.08 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling