import telebot
from telebot import types
from telebot.types import LabeledPrice, ShippingOption
API_KEY = '6973247314:AAGeKghhUCyZL06Xtz_qXtMAkMClfFNRW34' # @BotFather -> New Bot
provider_token = '284685063:TEST:OTEyNjFkNjY1MDIz' # @BotFather -> Bot Settings -> Payments
# More about Payments: https://core.telegram.org/bots/payments
pizza = [
{'title':'Pizza Chicken','description':'want to eat Pizza ?','photo':'https://tmbidigitalassetsazure.blob.core.windows.net/rms3-prod/attachments/37/1200x1200/Chicken-Pizza_exps30800_FM143298B03_11_8bC_RMS.jpg','price':[LabeledPrice('pizza', 600)]},
{'title':'Pizza Fish','description':'want to eat Pizza ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT5j8d1Ytw07h4FOWHzTEJT5yq5Jhgk7adJQw&usqp=CAU','price':[LabeledPrice('pizza', 700)]},
{'title':'Pizza Marinara','description':'want to eat Pizza ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ79wBpDIQGbRKdyMeGGjzGpv4dJGJtgtuLww&usqp=CAU','price':[LabeledPrice('pizza', 800)]},
{'title':'Pizza Margherita','description':'want to eat Pizza ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSsFdurA4BY4h-Y3DZS2EIHMRHmnXDCSGfBXg&usqp=CAU','price':[LabeledPrice('pizza', 900)]},
]
chicken = [
{'title':'Chicken','description':'want to eat Chicken ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTD2v2Mq0kh6AKcwmxUwdD6dyf9n3mDVH5D5A&usqp=CAU','price':[LabeledPrice('Chicken', 600)]},
{'title':'chicken','description':'want to eat Chicken ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRSEbpHtvcr6gxP9BMCOmFFLeEgeAPZf6XAUQ&usqp=CAU','price':[LabeledPrice('Chicken', 700)]},
{'title':'chicken','description':'want to eat Chicken?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTStK_Bo_bWN2O3jVWD30PjNUbj5VfXF2-c8A&usqp=CAU','price':[LabeledPrice('Chicken', 800)]},
{'title':'Chicken','description':'want to eat Chicken ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSLH_kBR8ualXJ3SgFJPNuaSmz_ED8O06IGQ&usqp=CAU','price':[LabeledPrice('Chicken', 900)]},
]
meat = [
{'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSC8Bj_q_pUH8-C63NgGmz_xTuTLwia5YzbBg&usqp=CAU','price':[LabeledPrice('Meat', 600)]},
{'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTun33FqcafVdfmLrju-Ru_T2WSu0mHZT0Zfw&usqp=CAU','price':[LabeledPrice('Meat', 700)]},
{'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSh55daxhDKdA5GdvwHkKEzyiBplv3O7UOQaA&usqp=CAU','price':[LabeledPrice('Meat', 800)]},
{'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSmMSxzyMJ4of1uyvXv4fGvIsdgJtERQzhSlw&usqp=CAU','price':[LabeledPrice('Meat', 900)]},
]
tacos = [
{'title':'Tacos 1','description':'want to eat Tacos ?','photo':'https://img.cuisineaz.com/660x660/2019/04/17/i146583-tacos-poulet-curry.jpeg','price':[LabeledPrice('Tacos', 600)]},
{'title':'Tacos 2','description':'want to eat Tacos ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKmFDC4zsK3k9VBvx4gKyIZGECG4rQ5oLXRQ&usqp=CAU','price':[LabeledPrice('Tacos', 700)]},
{'title':'Tacos 3','description':'want to eat Tacos ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSE8MKGX9eAwSvHpY-Tqa27xU43zKM2GyiGYQ&usqp=CAU','price':[LabeledPrice('Tacos', 800)]},
{'title':'Tacos 4','description':'want to eat Tacos ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRw2tpE4jC21mnf914HXs4YqqXASsFJV9zCgg&usqp=CAU','price':[LabeledPrice('Tacos', 900)]},
]
shipping_options = [
ShippingOption(id='Glovo', title='Glovo').add_price(LabeledPrice('Glovo', 1000)),
ShippingOption(id='Teleporter', title='Our Teleporter').add_price(LabeledPrice('Our Teleporter', 300))]
bot = telebot.TeleBot(API_KEY)
markup = types.ReplyKeyboardMarkup(row_width=2)
itembtn1 = types.KeyboardButton(u"\U0001F355"+'Pizza')
itembtn2 = types.KeyboardButton(u"\U0001F32E"+'Tacos')
itembtn3 = types.KeyboardButton(u"\U0001F414"+'chicken')
itembtn4 = types.KeyboardButton(u"\U0001F356"+'meat')
markup.add(itembtn1, itembtn2, itembtn3,itembtn4)
@bot.message_handler(commands=['start', 'help'])
def exemple_keyboard(message):
cid = message.chat.id
bot.send_message(cid, "Choose a Categorie :",reply_markup=markup)
@bot.message_handler(commands=['startpay'])
def command_start(message):
bot.send_message(message.chat.id,
"Hello," +str(message.from_user.first_name)+str(message.from_user.last_name)+" I'm the merchant bot."
" I can sell you a pizza or tacos or everything in our store."
" Use /start to buy, /terms for Terms and Conditions")
@bot.message_handler(commands=['terms'])
def command_terms(message):
bot.send_message(message.chat.id,
'Thank you for shopping with our bot. We hope you like our store!\n'
'1. If your item was not delivered on time, kindly contact our service workshops on +212666666666.\n'
'2. If you would like a refund, kindly apply and we will have sent it to you immediately.\n')
السلام عليكم كنت احاول انشاء بوت تلغرام بمكتبة telebot
قمت بإنشاء ازرار
ولكن اريد انشاء زر داخل زر اي ان عند الضغط على زر ما يظهر المحتوى ومن ثم زر آخر داخل هذا الزر لعرض محتواه اضافي
السؤال
Waleed Alomar
import telebot from telebot import types from telebot.types import LabeledPrice, ShippingOption API_KEY = '6973247314:AAGeKghhUCyZL06Xtz_qXtMAkMClfFNRW34' # @BotFather -> New Bot provider_token = '284685063:TEST:OTEyNjFkNjY1MDIz' # @BotFather -> Bot Settings -> Payments # More about Payments: https://core.telegram.org/bots/payments pizza = [ {'title':'Pizza Chicken','description':'want to eat Pizza ?','photo':'https://tmbidigitalassetsazure.blob.core.windows.net/rms3-prod/attachments/37/1200x1200/Chicken-Pizza_exps30800_FM143298B03_11_8bC_RMS.jpg','price':[LabeledPrice('pizza', 600)]}, {'title':'Pizza Fish','description':'want to eat Pizza ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT5j8d1Ytw07h4FOWHzTEJT5yq5Jhgk7adJQw&usqp=CAU','price':[LabeledPrice('pizza', 700)]}, {'title':'Pizza Marinara','description':'want to eat Pizza ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ79wBpDIQGbRKdyMeGGjzGpv4dJGJtgtuLww&usqp=CAU','price':[LabeledPrice('pizza', 800)]}, {'title':'Pizza Margherita','description':'want to eat Pizza ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSsFdurA4BY4h-Y3DZS2EIHMRHmnXDCSGfBXg&usqp=CAU','price':[LabeledPrice('pizza', 900)]}, ] chicken = [ {'title':'Chicken','description':'want to eat Chicken ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTD2v2Mq0kh6AKcwmxUwdD6dyf9n3mDVH5D5A&usqp=CAU','price':[LabeledPrice('Chicken', 600)]}, {'title':'chicken','description':'want to eat Chicken ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRSEbpHtvcr6gxP9BMCOmFFLeEgeAPZf6XAUQ&usqp=CAU','price':[LabeledPrice('Chicken', 700)]}, {'title':'chicken','description':'want to eat Chicken?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTStK_Bo_bWN2O3jVWD30PjNUbj5VfXF2-c8A&usqp=CAU','price':[LabeledPrice('Chicken', 800)]}, {'title':'Chicken','description':'want to eat Chicken ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSLH_kBR8ualXJ3SgFJPNuaSmz_ED8O06IGQ&usqp=CAU','price':[LabeledPrice('Chicken', 900)]}, ] meat = [ {'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSC8Bj_q_pUH8-C63NgGmz_xTuTLwia5YzbBg&usqp=CAU','price':[LabeledPrice('Meat', 600)]}, {'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTun33FqcafVdfmLrju-Ru_T2WSu0mHZT0Zfw&usqp=CAU','price':[LabeledPrice('Meat', 700)]}, {'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSh55daxhDKdA5GdvwHkKEzyiBplv3O7UOQaA&usqp=CAU','price':[LabeledPrice('Meat', 800)]}, {'title':'Meat','description':'want to eat Meat ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSmMSxzyMJ4of1uyvXv4fGvIsdgJtERQzhSlw&usqp=CAU','price':[LabeledPrice('Meat', 900)]}, ] tacos = [ {'title':'Tacos 1','description':'want to eat Tacos ?','photo':'https://img.cuisineaz.com/660x660/2019/04/17/i146583-tacos-poulet-curry.jpeg','price':[LabeledPrice('Tacos', 600)]}, {'title':'Tacos 2','description':'want to eat Tacos ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKmFDC4zsK3k9VBvx4gKyIZGECG4rQ5oLXRQ&usqp=CAU','price':[LabeledPrice('Tacos', 700)]}, {'title':'Tacos 3','description':'want to eat Tacos ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSE8MKGX9eAwSvHpY-Tqa27xU43zKM2GyiGYQ&usqp=CAU','price':[LabeledPrice('Tacos', 800)]}, {'title':'Tacos 4','description':'want to eat Tacos ?','photo':'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRw2tpE4jC21mnf914HXs4YqqXASsFJV9zCgg&usqp=CAU','price':[LabeledPrice('Tacos', 900)]}, ] shipping_options = [ ShippingOption(id='Glovo', title='Glovo').add_price(LabeledPrice('Glovo', 1000)), ShippingOption(id='Teleporter', title='Our Teleporter').add_price(LabeledPrice('Our Teleporter', 300))] bot = telebot.TeleBot(API_KEY) markup = types.ReplyKeyboardMarkup(row_width=2) itembtn1 = types.KeyboardButton(u"\U0001F355"+'Pizza') itembtn2 = types.KeyboardButton(u"\U0001F32E"+'Tacos') itembtn3 = types.KeyboardButton(u"\U0001F414"+'chicken') itembtn4 = types.KeyboardButton(u"\U0001F356"+'meat') markup.add(itembtn1, itembtn2, itembtn3,itembtn4) @bot.message_handler(commands=['start', 'help']) def exemple_keyboard(message): cid = message.chat.id bot.send_message(cid, "Choose a Categorie :",reply_markup=markup) @bot.message_handler(commands=['startpay']) def command_start(message): bot.send_message(message.chat.id, "Hello," +str(message.from_user.first_name)+str(message.from_user.last_name)+" I'm the merchant bot." " I can sell you a pizza or tacos or everything in our store." " Use /start to buy, /terms for Terms and Conditions") @bot.message_handler(commands=['terms']) def command_terms(message): bot.send_message(message.chat.id, 'Thank you for shopping with our bot. We hope you like our store!\n' '1. If your item was not delivered on time, kindly contact our service workshops on +212666666666.\n' '2. If you would like a refund, kindly apply and we will have sent it to you immediately.\n')
السلام عليكم كنت احاول انشاء بوت تلغرام بمكتبة telebotقمت بإنشاء ازرار
ولكن اريد انشاء زر داخل زر اي ان عند الضغط على زر ما يظهر المحتوى ومن ثم زر آخر داخل هذا الزر لعرض محتواه اضافي
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.