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
a477aad2
Commit
a477aad2
authored
Jun 01, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a few minor adjustments to the date command
parent
96ee5e5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
DateCommand.php
src/Commands/UserCommands/DateCommand.php
+10
-9
No files found.
src/Commands/UserCommands/DateCommand.php
View file @
a477aad2
...
...
@@ -38,7 +38,7 @@ class DateCommand extends UserCommand
private
$client
;
/**
* Base UR
L
for Google Maps API
* Base UR
I
for Google Maps API
*
* @var string
*/
...
...
@@ -70,17 +70,17 @@ class DateCommand extends UserCommand
$path
=
'geocode/json'
;
$query
=
[
'address'
=>
urlencode
(
$location
)];
if
(
$this
->
google_api_key
!==
''
)
{
if
(
$this
->
google_api_key
!==
null
)
{
$query
[
'key'
]
=
$this
->
google_api_key
;
}
try
{
$response
=
$this
->
client
->
get
(
$path
,
[
'query'
=>
$query
])
->
getBody
()
;
$response
=
$this
->
client
->
get
(
$path
,
[
'query'
=>
$query
]);
}
catch
(
RequestException
$e
)
{
throw
new
TelegramException
(
$e
->
getMessage
());
}
if
(
!
(
$result
=
$this
->
validateResponseData
(
$response
)))
{
if
(
!
(
$result
=
$this
->
validateResponseData
(
$response
->
getBody
()
)))
{
return
false
;
}
...
...
@@ -113,17 +113,17 @@ class DateCommand extends UserCommand
'timestamp'
=>
urlencode
(
$timestamp
)
];
if
(
$this
->
google_api_key
!==
''
)
{
if
(
$this
->
google_api_key
!==
null
)
{
$query
[
'key'
]
=
$this
->
google_api_key
;
}
try
{
$response
=
$this
->
client
->
get
(
$path
,
[
'query'
=>
$query
])
->
getBody
()
;
$response
=
$this
->
client
->
get
(
$path
,
[
'query'
=>
$query
]);
}
catch
(
RequestException
$e
)
{
throw
new
TelegramException
(
$e
->
getMessage
());
}
if
(
!
(
$result
=
$this
->
validateResponseData
(
$response
)))
{
if
(
!
(
$result
=
$this
->
validateResponseData
(
$response
->
getBody
()
)))
{
return
false
;
}
...
...
@@ -190,12 +190,13 @@ class DateCommand extends UserCommand
{
//First we set up the necessary member variables.
$this
->
client
=
new
Client
([
'base_uri'
=>
$this
->
google_api_base_uri
]);
$this
->
google_api_key
=
$this
->
getConfig
(
'google_api_key'
);
if
((
$this
->
google_api_key
=
trim
(
$this
->
getConfig
(
'google_api_key'
)))
===
''
)
{
$this
->
google_api_key
=
null
;
}
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$message_id
=
$message
->
getMessageId
();
$location
=
$message
->
getText
(
true
);
if
(
empty
(
$location
))
{
...
...
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