@@ -28,7 +28,7 @@ class SurveyCommand extends UserCommand
28
28
protected $ name = 'survey ' ;
29
29
protected $ description = 'Survery for bot users ' ;
30
30
protected $ usage = '/survey ' ;
31
- protected $ version = '0.1.1 ' ;
31
+ protected $ version = '0.2.0 ' ;
32
32
protected $ need_mysql = true ;
33
33
/**#@-*/
34
34
@@ -150,9 +150,15 @@ public function execute()
150
150
if (is_null ($ message ->getLocation ())) {
151
151
$ this ->conversation ->notes ['state ' ] = 4 ;
152
152
$ this ->conversation ->update ();
153
-
154
- $ data ['text ' ] = 'Insert your home location (need location object): ' ;
155
- $ data ['reply_markup ' ] = new ReplyKeyBoardHide (['selective ' => true ]);
153
+ $ data ['reply_markup ' ] = new ReplyKeyboardMarkup ([
154
+ 'keyboard ' => [[
155
+ [ 'text ' => 'Share Location ' , 'request_location ' => true ],
156
+ ]],
157
+ 'resize_keyboard ' => true ,
158
+ 'one_time_keyboard ' => true ,
159
+ 'selective ' => true ,
160
+ ]);
161
+ $ data ['text ' ] = 'Share your location: ' ;
156
162
$ result = Request::sendMessage ($ data );
157
163
break ;
158
164
}
@@ -167,13 +173,35 @@ public function execute()
167
173
$ this ->conversation ->update ();
168
174
169
175
$ data ['text ' ] = 'Insert your picture: ' ;
176
+ $ data ['reply_markup ' ] = new ReplyKeyBoardHide (['selective ' => true ]);
170
177
$ result = Request::sendMessage ($ data );
171
178
break ;
172
179
}
173
180
$ this ->conversation ->notes ['photo_id ' ] = $ message ->getPhoto ()[0 ]->getFileId ();
174
181
175
182
// no break
176
183
case 6 :
184
+ if (is_null ($ message ->getContact ())) {
185
+ $ this ->conversation ->notes ['state ' ] = 6 ;
186
+ $ this ->conversation ->update ();
187
+
188
+ $ data ['text ' ] = 'Share your contact information: ' ;
189
+ $ data ['reply_markup ' ] = new ReplyKeyboardMarkup ([
190
+ 'keyboard ' => [[
191
+ [ 'text ' => 'Share Contact ' , 'request_contact ' => true ],
192
+ ]],
193
+ 'resize_keyboard ' => true ,
194
+ 'one_time_keyboard ' => true ,
195
+ 'selective ' => true ,
196
+ ]);
197
+ $ result = Request::sendMessage ($ data );
198
+ break ;
199
+ }
200
+ $ this ->conversation ->notes ['phone_number ' ] = $ message ->getContact ()->getPhoneNumber ();
201
+
202
+ // no break
203
+ case 7 :
204
+ $ this ->conversation ->update ();
177
205
$ out_text = '/Survey result: ' . "\n" ;
178
206
unset($ this ->conversation ->notes ['state ' ]);
179
207
foreach ($ this ->conversation ->notes as $ k => $ v ) {
0 commit comments