Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
bd74eea7
Commit
bd74eea7
authored
May 02, 2016
by
Juanan Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add location and contact buttons to the Survey example
parent
a29336e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
SurveyCommand.php
src/Commands/UserCommands/SurveyCommand.php
+30
-3
No files found.
src/Commands/UserCommands/SurveyCommand.php
View file @
bd74eea7
...
...
@@ -150,9 +150,15 @@ class SurveyCommand extends UserCommand
if
(
is_null
(
$message
->
getLocation
()))
{
$this
->
conversation
->
notes
[
'state'
]
=
4
;
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Insert your home location (need location object):'
;
$data
[
'reply_markup'
]
=
new
ReplyKeyBoardHide
([
'selective'
=>
true
]);
$data
[
'reply_markup'
]
=
new
ReplyKeyboardMarkup
([
'keyboard'
=>
[[
[
'text'
=>
'Share Location'
,
'request_location'
=>
true
],
]],
'resize_keyboard'
=>
true
,
'one_time_keyboard'
=>
true
,
'selective'
=>
true
,
]);
$data
[
'text'
]
=
'Share your location:'
;
$result
=
Request
::
sendMessage
(
$data
);
break
;
}
...
...
@@ -174,6 +180,27 @@ class SurveyCommand extends UserCommand
// no break
case
6
:
if
(
is_null
(
$message
->
getContact
()))
{
$this
->
conversation
->
notes
[
'state'
]
=
6
;
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Share your contact information:'
;
$data
[
'reply_markup'
]
=
new
ReplyKeyboardMarkup
([
'keyboard'
=>
[[
[
'text'
=>
'Share Contact'
,
'request_contact'
=>
true
],
]],
'resize_keyboard'
=>
true
,
'one_time_keyboard'
=>
true
,
'selective'
=>
true
,
]);
$result
=
Request
::
sendMessage
(
$data
);
break
;
}
$this
->
conversation
->
notes
[
'phone_number'
]
=
$message
->
getContact
()
->
getPhoneNumber
();
// no break
case
7
:
$this
->
conversation
->
update
();
$out_text
=
'/Survey result:'
.
"
\n
"
;
unset
(
$this
->
conversation
->
notes
[
'state'
]);
foreach
(
$this
->
conversation
->
notes
as
$k
=>
$v
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment