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
6a14dd05
Commit
6a14dd05
authored
Jul 03, 2015
by
LONGMAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed whoami command
parent
174ad22a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
CalcCommand.php
src/Commands/CalcCommand.php
+6
-6
WhoamiCommand.php
src/Commands/WhoamiCommand.php
+6
-4
No files found.
src/Commands/CalcCommand.php
View file @
6a14dd05
...
...
@@ -6,6 +6,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Written by Marco Boretto <marco.bore@gmail.com>
*/
namespace
Longman\TelegramBot\Commands
;
...
...
@@ -24,18 +25,17 @@ class CalcCommand extends Command
$chat_id
=
$message
->
getChat
()
->
getId
();
$message_id
=
$message
->
getMessageId
();
$text
=
$message
->
getText
(
true
);
#$elm = explode(" ",$text);
#array_shift($elm);
# $text = trim(implode(" ",$elm));
$text
=
preg_replace
(
'/[^0-9\+\-\*\/\(\) ]/i'
,
''
,
trim
(
$text
));
$text
=
preg_replace
(
'/[^0-9\+\-\*\/\(\) ]/i'
,
''
,
trim
(
$text
));
$compute
=
create_function
(
''
,
'return ('
.
trim
(
$text
)
.
');'
);
$data
=
array
();
$data
[
'chat_id'
]
=
$chat_id
;
$data
[
'reply_to_message_id'
]
=
$message_id
;
$data
[
'text'
]
=
0
+
$compute
();
...
...
src/Commands/WhoamiCommand.php
View file @
6a14dd05
...
...
@@ -6,7 +6,8 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* writteno by Marco Boretto <marco.bore@gmail.com>
*
* Written by Marco Boretto <marco.bore@gmail.com>
*/
namespace
Longman\TelegramBot\Commands
;
...
...
@@ -25,13 +26,14 @@ class WhoamiCommand extends Command
$chat_id
=
$message
->
getChat
()
->
getId
();
$message_id
=
$message
->
getMessageId
();
$text
=
$message
->
getText
(
true
);
$from
=
$message
->
getFrom
()
->
getFirstName
()
.
' '
.
$message
->
getFrom
()
->
getLastName
()
.
' '
.
$message
->
getFrom
()
->
getUsername
();
$data
=
array
();
$data
[
'chat_id'
]
=
$chat_id
;
$data
[
'text'
]
=
'Your name is: '
.
$from
;
$data
[
'reply_to_message_id'
]
=
$message_id
;
$data
[
'text'
]
=
'Your name is: '
.
$message
->
getFrom
()
->
getFirstName
()
.
' '
.
$message
->
getFrom
()
->
getLastName
();
$data
[
'text'
]
=
"
\n
"
.
'Username: '
.
$message
->
getFrom
()
->
getUsername
();
$result
=
Request
::
sendMessage
(
$data
);
...
...
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