fix: send VK keyboard payloads as JSON
This commit is contained in:
1 parent
3d58b4fc9b
commit
94665a24ad
2 files changed
+20
-1
No files matched your search
+11
-1
@@ -378,7 +378,17 @@ class BelkiDialog:
|
||||
|
||||
@staticmethod
|
||||
def _button(label: str, payload: str, color: str = "secondary") -> dict[str, Any]:
|
||||
return {"action": {"type": "text", "label": label, "payload": payload}, "color": color}
|
||||
# VK validates button payload as JSON, even though the API field is
|
||||
# documented as a string. Keep the command inside a small object; the
|
||||
# event parser already accepts this shape.
|
||||
return {
|
||||
"action": {
|
||||
"type": "text",
|
||||
"label": label,
|
||||
"payload": json.dumps({"command": payload}, ensure_ascii=False),
|
||||
},
|
||||
"color": color,
|
||||
}
|
||||
|
||||
def keyboard_for(self, actor_id: int) -> dict[str, Any]:
|
||||
"""Return a context-aware VK keyboard for the author's current dialog state."""
|
||||
|
||||
Reference in new issue
Block a user