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
ebe87eca
Commit
ebe87eca
authored
May 13, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'newsurvey' into develop
parents
f5122a83
0d0bdb85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
4 deletions
+32
-4
SurveyCommand.php
src/Commands/UserCommands/SurveyCommand.php
+32
-4
No files found.
src/Commands/UserCommands/SurveyCommand.php
View file @
ebe87eca
...
...
@@ -28,7 +28,7 @@ class SurveyCommand extends UserCommand
protected
$name
=
'survey'
;
protected
$description
=
'Survery for bot users'
;
protected
$usage
=
'/survey'
;
protected
$version
=
'0.
1.1
'
;
protected
$version
=
'0.
2.0
'
;
protected
$need_mysql
=
true
;
/**#@-*/
...
...
@@ -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
;
}
...
...
@@ -167,6 +173,7 @@ class SurveyCommand extends UserCommand
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Insert your picture:'
;
$data
[
'reply_markup'
]
=
new
ReplyKeyBoardHide
([
'selective'
=>
true
]);
$result
=
Request
::
sendMessage
(
$data
);
break
;
}
...
...
@@ -174,6 +181,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