-
-
Save Deniallugo/1a4bc9769c69981f24f0409ef35ca67a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if full: | |
message = BotMessage.objects.get(type='order_message') | |
buttons = message.buttons.all() | |
updated_buttons = { | |
buttons.get('res_good'): dict( | |
type='res_good', | |
price=good_office.pk, | |
item="{}-{}-{}".format(good_office.pk, | |
good_office.branch_office.pk | |
or "", | |
chat_id or "")), | |
buttons.get('try_good'): dict( | |
type='res_good', | |
price=None, | |
item="{}-{}-{}".format(good_office.pk, | |
good_office.branch_office.pk | |
or "", | |
chat_id or "")), | |
buttons.get('good'): good_office.price | |
} | |
[markup.add(InlineKeyboardButton( | |
text=button.text.format(price=((0 if isinstance(value, dict) else | |
value) / 100)), | |
pay=button.pay, | |
callback_data=json.dumps(updated_buttons[button.type]) if | |
button.type in updated_buttons else "")) | |
for button in buttons] | |
labeled_price = [ | |
LabeledPrice(good_office.__str__(), int(buttons['Оплатить ']))] | |
print("Buttons: {}".format(markup.to_json())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment