Advertisement
Guest User

pythonBOTvk

a guest
Mar 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import json
  2.  
  3.  
  4. def get_button(label, color, payload=""):
  5. return {
  6. "action": {
  7. "type": "text",
  8. "payload": json.dumps(payload),
  9. "label": label
  10. },
  11. "color": color
  12. }
  13.  
  14. keyboard = {
  15. "one_time": False,
  16. "buttons": [
  17.  
  18. [get_button(label="Кнопка 1", color="positive")],
  19. [get_button(label="Кнопка 2", color="negative")],
  20. [get_button(label="Кнопка 3", color="primary")],
  21. [get_button(label="Кнопка 4", color="default")]
  22.  
  23. ]
  24. }
  25.  
  26. keyboard = json.dumps(keyboard, ensure_ascii=False).encode('utf-8')
  27. keyboard = str(keyboard.decode('utf-8'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement