Bot = telebot. TeleBot('1711149709: aahpbqEzqmpqlykagczYxxwSpT1ebquyQkQ')



Download 15,62 Kb.
Sana09.06.2022
Hajmi15,62 Kb.
#647884
Bog'liq
import telebot


import telebot

bot = telebot.TeleBot('1711149709:AAHPbqEzQMPQlYKAGczYxxwSpT1EBQuyQkQ')

def start_message_buttons():
reply_markup = telebot.types.ReplyKeyboardMarkup(row_width=2,resize_keyboard=True)
reply_markup.row(telebot.types.KeyboardButton('Locatsiya jonatish',request_location=True))
reply_markup.row(telebot.types.KeyboardButton('Telefon raqam yuborish', request_contact=True))
return reply_markup

@bot.message_handler(commands=['start'])


def start_message(message):
bot.send_message(message.from_user.id,
f" Salom {message.from_user.first_name}",
reply_markup=start_message_buttons())
@bot.message_handler(func=lambda m: True)
def all_message(message):
if message.text.lower() == 'salom':
bot.send_message(message.from_user.id,'Nima gap!')

bot.polling(none_stop=True)

import telebot

bot = telebot.TeleBot('1711149709:AAHPbqEzQMPQlYKAGczYxxwSpT1EBQuyQkQ')


PRODUCTS = "Maxsulotlar"


GEIDS = "Qullanma"
BUYURTMA = "Buyurtma berish"
LOCATSIA = "Locatsia yuborish"
CONTACT = "Contact yuborish"

products_data = [


{'id':1,'name':'Olma','price': 500,'photo':'olma.jpg'},
{'id':2,'name':'Banan','price': 700,'photo':'banan.jpg'},
{'id':3,'name':'Ananas','price': 1000,'photo':'Ananas.png'}
]

def get_photo(file_name):


f = open(f"img/{file_name}",'rb')
imega = f.read()
f.close()
return imega

def start_message_buttons():


reply_markup = telebot.types.ReplyKeyboardMarkup(row_width=2,resize_keyboard=True)
reply_markup.add(*[
telebot.types.KeyboardButton(text) for text in [PRODUCTS,GEIDS,BUYURTMA]
])
return reply_markup

@bot.message_handler(commands=['start'])


def start_message(message):
text = f"Salom {message.from_user.first_name} onlayn magazinga hush kelibsiz"
bot.send_message(message.from_user.id,text,reply_markup=start_message_buttons())

def buyurtma_buttons():


reply_markup = telebot.types.ReplyKeyboardMarkup(row_width=2,resize_keyboard=True)
reply_markup.add(*[
telebot.types.KeyboardButton('Locatsia yuborish',request_location=True),
telebot.types.KeyboardButton('Contact yuborish', request_contact=True),
telebot.types.KeyboardButton('Orqaga'),
])
return reply_markup

@bot.message_handler(func=lambda m: True)


def all_message(message):
if message.text == PRODUCTS:
for product in products_data:
caption = f"{product['name']}\n\n{product['price']} so'm"
bot.send_photo(photo=get_photo(product['photo']),chat_id=message.from_user.id,caption=caption)

if message.text == GEIDS:


text = f"https://www.youtube.com/watch?v=Zp-F68Fa-ps \n\n vedioni kuring"
bot.send_message(message.from_user.id,text)

if message.text == BUYURTMA:


text = 'Buyurmani yetkazish uchun lacatsia va contactlarni ulashing'
bot.send_message(message.from_user.id,text,reply_markup=buyurtma_buttons())

if message.text == 'Orqaga':


text = 'Buyurmani amalga oshirish uchun Buyurtma tugmasini bosing!'
bot.send_message(message.from_user.id,text,reply_markup=start_message_buttons())

bot.polling(none_stop=True)
Download 15,62 Kb.

Do'stlaringiz bilan baham:




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish