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
33dd4a80
Commit
33dd4a80
authored
Mar 08, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reintroduced update()
parent
f302c734
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
17 deletions
+12
-17
SendtochannelCommand.php
src/Commands/AdminCommands/SendtochannelCommand.php
+6
-6
SurveyCommand.php
src/Commands/UserCommands/SurveyCommand.php
+6
-0
Conversation.php
src/Conversation.php
+0
-11
No files found.
src/Commands/AdminCommands/SendtochannelCommand.php
View file @
33dd4a80
...
...
@@ -69,7 +69,7 @@ class SendtochannelCommand extends AdminCommand
// getConfig has not been configured asking for channel to administer
if
(
$type
!=
'Message'
||
empty
(
$text
))
{
$this
->
conversation
->
notes
[
'state'
]
=
-
1
;
//
$this->conversation->update();
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Insert the channel name: (@yourchannel)'
;
$data
[
'reply_markup'
]
=
new
ReplyKeyBoardHide
([
'selective'
=>
true
]);
...
...
@@ -88,7 +88,7 @@ class SendtochannelCommand extends AdminCommand
// getConfig has been configured choose channel
if
(
$type
!=
'Message'
||
!
in_array
(
$text
,
$channels
))
{
$this
->
conversation
->
notes
[
'state'
]
=
0
;
//
$this->conversation->update();
$this
->
conversation
->
update
();
$keyboard
=
[];
foreach
(
$channels
as
$channel
)
{
...
...
@@ -118,7 +118,7 @@ class SendtochannelCommand extends AdminCommand
insert
:
if
(
$this
->
conversation
->
notes
[
'last_message_id'
]
==
$message
->
getMessageId
()
||
(
$type
==
'Message'
&&
empty
(
$text
)))
{
$this
->
conversation
->
notes
[
'state'
]
=
1
;
//
$this->conversation->update();
$this
->
conversation
->
update
();
$data
[
'reply_markup'
]
=
new
ReplyKeyBoardHide
([
'selective'
=>
true
]);
$data
[
'text'
]
=
'Insert the content you want to share: text, photo, audio...'
;
...
...
@@ -133,7 +133,7 @@ class SendtochannelCommand extends AdminCommand
case
2
:
if
(
$this
->
conversation
->
notes
[
'last_message_id'
]
==
$message
->
getMessageId
()
||
!
(
$text
==
'Yes'
||
$text
==
'No'
))
{
$this
->
conversation
->
notes
[
'state'
]
=
2
;
//
$this->conversation->update();
$this
->
conversation
->
update
();
// Execute this just with object that allow caption
if
(
$this
->
conversation
->
notes
[
'message_type'
]
==
'Video'
||
$this
->
conversation
->
notes
[
'message_type'
]
==
'Photo'
)
{
...
...
@@ -165,7 +165,7 @@ class SendtochannelCommand extends AdminCommand
case
3
:
if
((
$this
->
conversation
->
notes
[
'last_message_id'
]
==
$message
->
getMessageId
()
||
$type
!=
'Message'
)
&&
$this
->
conversation
->
notes
[
'set_caption'
])
{
$this
->
conversation
->
notes
[
'state'
]
=
3
;
//
$this->conversation->update();
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Insert caption:'
;
$data
[
'reply_markup'
]
=
new
ReplyKeyBoardHide
([
'selective'
=>
true
]);
...
...
@@ -178,7 +178,7 @@ class SendtochannelCommand extends AdminCommand
case
4
:
if
(
$this
->
conversation
->
notes
[
'last_message_id'
]
==
$message
->
getMessageId
()
||
!
(
$text
==
'Yes'
||
$text
==
'No'
))
{
$this
->
conversation
->
notes
[
'state'
]
=
4
;
//
$this->conversation->update();
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Message will look like this:'
;
$result
=
Request
::
sendMessage
(
$data
);
...
...
src/Commands/UserCommands/SurveyCommand.php
View file @
33dd4a80
...
...
@@ -79,6 +79,7 @@ class SurveyCommand extends UserCommand
case
0
:
if
(
empty
(
$text
))
{
$this
->
conversation
->
notes
[
'state'
]
=
0
;
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Type your name:'
;
$data
[
'reply_markup'
]
=
new
ReplyKeyBoardHide
([
'selective'
=>
true
]);
...
...
@@ -91,6 +92,7 @@ class SurveyCommand extends UserCommand
case
1
:
if
(
empty
(
$text
))
{
$this
->
conversation
->
notes
[
'state'
]
=
1
;
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Type your surname:'
;
$result
=
Request
::
sendMessage
(
$data
);
...
...
@@ -104,6 +106,7 @@ class SurveyCommand extends UserCommand
case
2
:
if
(
empty
(
$text
)
||
!
is_numeric
(
$text
))
{
$this
->
conversation
->
notes
[
'state'
]
=
2
;
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Type your age:'
;
if
(
!
empty
(
$text
)
&&
!
is_numeric
(
$text
))
{
...
...
@@ -119,6 +122,7 @@ class SurveyCommand extends UserCommand
case
3
:
if
(
empty
(
$text
)
||
!
(
$text
==
'M'
||
$text
==
'F'
))
{
$this
->
conversation
->
notes
[
'state'
]
=
3
;
$this
->
conversation
->
update
();
$keyboard
=
[[
'M'
,
'F'
]];
$reply_keyboard_markup
=
new
ReplyKeyboardMarkup
(
...
...
@@ -144,6 +148,7 @@ class SurveyCommand extends UserCommand
case
4
:
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
]);
...
...
@@ -158,6 +163,7 @@ class SurveyCommand extends UserCommand
case
5
:
if
(
is_null
(
$message
->
getPhoto
()))
{
$this
->
conversation
->
notes
[
'state'
]
=
5
;
$this
->
conversation
->
update
();
$data
[
'text'
]
=
'Insert your picture:'
;
$result
=
Request
::
sendMessage
(
$data
);
...
...
src/Conversation.php
View file @
33dd4a80
...
...
@@ -89,17 +89,6 @@ class Conversation
}
}
/**
* Conversation destructor updates the conversation
*/
public
function
__destruct
()
{
//Perform the update when the object goes out of the stage and notes have changed after load()
if
(
$this
->
command_is_provided
&&
$this
->
notes
!==
$this
->
protected_notes
)
{
$this
->
update
();
}
}
/**
* Load the conversation from the database
*
...
...
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