from telebot.types import LabeledPrice from telebot.types import ShippingOption token = '1234567890:AAAABBBBCCCCDDDDeeeeFFFFgggGHHHH' provider_token = '1234567890:TEST:AAAABBBBCCCCDDDD' # @BotFather -> Bot Settings -> Payments bot = telebot.TeleBot(token) # More about Payments: https://core.telegram.org/bots/payments prices = [ LabeledPrice(label='Working Time Machine', amount=5750), LabeledPrice('Gift wrapping', 500) ] shipping_options = [ ShippingOption(id='instant', title='WorldWide Teleporter').add_price( LabeledPrice('Teleporter', 1000)), ShippingOption(id='pickup', title='Local pickup').add_price(LabeledPrice('Pickup', 300)) ] @bot.message_handler(commands=['start']) def command_start(message): bot.send_message( message.chat.id, "Hello, I'm the demo merchant bot." " I can sell you a Time Machine." " Use /buy to order one, /terms for Terms and Conditions") @bot.message_handler(commands=['terms']) def command_terms(message):
""" # e-mail & password for naviaddress map api email = '' password = '' # telegram token token = '' # telegram payment token payment_token = '' # global variables used in bot user_state = None navi_container, navi_naviaddress = '', '' event_name, event_link = '', '' event_money = '' user_name, user_mail = '', '' weights = [] step_description = '' steps = [] image_counter = 0 # additional payment variables settings_global = {"cluster_numbers": None} shipping_options = [ ShippingOption(id='instant', title='1').add_price(LabeledPrice('1', 1000)), ShippingOption(id='pickup', title='2').add_price(LabeledPrice('2', 300)) ]
from telebot.types import LabeledPrice, ShippingOption pickup = ShippingOption(id='first', title='pickup') pickup.add_price(LabeledPrice('count', 100)) pickup = obj.to_json() print(obj) shipping_options = [pickup] print(shipping_options)
menu_m.row(m3, m4) menu_m.row(m5) nazad1 = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True) n11 = types.KeyboardButton("🔙Назад") nazad1.row(n11) prices = [ LabeledPrice(label='Puma Thunder', amount=650000), LabeledPrice('Gift wrapping', 50000) ] price1 = [ LabeledPrice(label='Yeezy Boost 500', amount=1050000), LabeledPrice('Gift wrapping', 50000) ] price2 = [ LabeledPrice(label='NB me547', amount=400000), LabeledPrice('Gift wrapping', 50000) ] price3 = [ LabeledPrice(label='Raf Simons Ozweego', amount=800000), LabeledPrice('Gift wrapping', 50000) ] shipping_options = [ ShippingOption(id='instant', title='Puma Thunder').add_price(LabeledPrice('Shoes', 1000)), ShippingOption(id='pickup', title='Local pickup').add_price(LabeledPrice('Pickup', 300)) ]
def set_shipping_option(id, title, *price): shipping_option = ShippingOption(id=id, title=title) shipping_option.add_price(*price) return shipping_option
# GENERAL items = None settings = None text_reviews = None video_reviews = None questions_kids = None questions_adult = None # Payment data prices = [ LabeledPrice(label='Курсы по основам Java', amount=25000), LabeledPrice('Курсы по основам Java', 23000) ] shipping_options = [ ShippingOption(id='deep', title='Углублённое изучение C++(продолжение)').add_price( LabeledPrice('C++, продолжение', 12000)), ShippingOption( id='litedeep', title='Допонительные занятия по Java(продолжение)').add_price( LabeledPrice('Java, продолжение', 7000)) ] def SetBotActiveStatus(): try: f = open("database/stats.txt", "r") tmp = f.read() tmp = int(tmp) tmp += 1 f.close