Skip to content

Commit bacaa63

Browse files
author
markeloff
authored
fix number 3
1 parent a262822 commit bacaa63

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

vk_api/keyboard.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import six
1111

12-
from .utils import sjson_dumps
12+
1313

1414

1515
class VkKeyboardColor(Enum):
@@ -99,10 +99,12 @@ def add_button(self, label, color=VkKeyboardColor.DEFAULT, payload=None):
9999
if payload is not None and not isinstance(payload, six.string_types):
100100
payload = sjson_dumps(payload)
101101

102+
button_type = VkKeyboardButton.TEXT
103+
102104
current_line.append({
103105
'color': color_value,
104106
'action': {
105-
'type': VkKeyboardButton.TEXT,
107+
'type': button_type,
106108
'payload': payload,
107109
'label': label,
108110
}
@@ -124,9 +126,11 @@ def add_location_button(self, payload=None):
124126
if payload is not None and not isinstance(payload, six.string_types):
125127
payload = sjson_dumps(payload)
126128

129+
button_type = VkKeyboardButton.LOCATION
130+
127131
current_line.append({
128132
'action': {
129-
'type': VkKeyboardButton.LOCATION,
133+
'type': button_type,
130134
'payload': payload
131135
}
132136
})
@@ -150,9 +154,11 @@ def add_vkpay_button(self, hash, payload=None):
150154
if payload is not None and not isinstance(payload, six.string_types):
151155
payload = sjson_dumps(payload)
152156

157+
button_type = VkKeyboardButton.VKPAY
158+
153159
current_line.append({
154160
'action': {
155-
'type': VkKeyboardButton.VKPAY,
161+
'type': button_type,
156162
'payload': payload,
157163
'hash': hash
158164
}
@@ -184,9 +190,11 @@ def add_vkapps_button(self, app_id, owner_id, label, hash, payload=None):
184190
if payload is not None and not isinstance(payload, six.string_types):
185191
payload = sjson_dumps(payload)
186192

193+
button_type = VkKeyboardButton.VKAPPS
194+
187195
current_line.append({
188196
'action': {
189-
'type': VkKeyboardButton.VKAPPS,
197+
'type': button_type,
190198
'app_id': app_id,
191199
'owner_id': owner_id,
192200
'label': label,

0 commit comments

Comments
 (0)