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
e797f65a
Commit
e797f65a
authored
Aug 24, 2015
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix] check if is a command before tock
parent
4eef4d40
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
278 additions
and
273 deletions
+278
-273
Message.php
src/Entities/Message.php
+278
-273
No files found.
src/Entities/Message.php
View file @
e797f65a
...
@@ -140,8 +140,11 @@ class Message extends Entity
...
@@ -140,8 +140,11 @@ class Message extends Entity
//return the entire command like /echo or /echo@bot1 if specified
//return the entire command like /echo or /echo@bot1 if specified
public
function
getFullCommand
()
public
function
getFullCommand
()
{
{
if
(
substr
(
$this
->
text
,
0
,
1
)
===
'/'
)
{
return
strtok
(
$this
->
text
,
' '
);
return
strtok
(
$this
->
text
,
' '
);
}
else
{
return
null
;
}
}
}
public
function
getCommand
()
public
function
getCommand
()
...
@@ -248,8 +251,10 @@ class Message extends Entity
...
@@ -248,8 +251,10 @@ class Message extends Entity
$text
=
$this
->
text
;
$text
=
$this
->
text
;
if
(
$without_cmd
)
{
if
(
$without_cmd
)
{
$command
=
$this
->
getFullCommand
();
$command
=
$this
->
getFullCommand
();
if
(
!
empty
(
$command
)){
$text
=
substr
(
$text
,
strlen
(
$command
.
' '
),
strlen
(
$text
));
$text
=
substr
(
$text
,
strlen
(
$command
.
' '
),
strlen
(
$text
));
}
}
}
return
$text
;
return
$text
;
}
}
...
...
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