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
2b293902
Commit
2b293902
authored
Jul 09, 2015
by
LONGMAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs
parent
25c689b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
DateCommand.php
src/Commands/DateCommand.php
+8
-5
Telegram.php
src/Telegram.php
+1
-1
Bootstrap.php
tests/Bootstrap.php
+1
-1
No files found.
src/Commands/DateCommand.php
View file @
2b293902
...
@@ -20,7 +20,7 @@ class DateCommand extends Command
...
@@ -20,7 +20,7 @@ class DateCommand extends Command
protected
$name
=
'date'
;
protected
$name
=
'date'
;
protected
$description
=
'Show date/time by location'
;
protected
$description
=
'Show date/time by location'
;
protected
$usage
=
'/date <location>'
;
protected
$usage
=
'/date <location>'
;
protected
$version
=
'1.
1
.0'
;
protected
$version
=
'1.
2
.0'
;
protected
$enabled
=
true
;
protected
$enabled
=
true
;
private
$base_url
=
'https://maps.googleapis.com/maps/api'
;
private
$base_url
=
'https://maps.googleapis.com/maps/api'
;
...
@@ -32,8 +32,10 @@ class DateCommand extends Command
...
@@ -32,8 +32,10 @@ class DateCommand extends Command
$url
=
$this
->
base_url
.
'/geocode/json?'
;
$url
=
$this
->
base_url
.
'/geocode/json?'
;
$params
=
'address='
.
urlencode
(
$location
);
$params
=
'address='
.
urlencode
(
$location
);
if
(
!
empty
(
$google_api_key
=
$this
->
getConfig
(
'google_api_key'
)))
{
$params
.=
'&key='
.
$google_api_key
;
$google_api_key
=
$this
->
getConfig
(
'google_api_key'
);
if
(
!
empty
(
$google_api_key
))
{
$params
.=
'&key='
.
$google_api_key
;
}
}
$data
=
$this
->
request
(
$url
.
$params
);
$data
=
$this
->
request
(
$url
.
$params
);
...
@@ -62,13 +64,14 @@ class DateCommand extends Command
...
@@ -62,13 +64,14 @@ class DateCommand extends Command
{
{
$url
=
$this
->
base_url
.
'/timezone/json?'
;
$url
=
$this
->
base_url
.
'/timezone/json?'
;
$date_utc
=
new
\DateTime
(
null
,
new
\DateTimeZone
(
"UTC"
));
$date_utc
=
new
\DateTime
(
null
,
new
\DateTimeZone
(
"UTC"
));
$timestamp
=
$date_utc
->
format
(
'U'
);
$timestamp
=
$date_utc
->
format
(
'U'
);
$params
=
'location='
.
urlencode
(
$lat
)
.
','
.
urlencode
(
$lng
)
.
'×tamp='
.
urlencode
(
$timestamp
);
$params
=
'location='
.
urlencode
(
$lat
)
.
','
.
urlencode
(
$lng
)
.
'×tamp='
.
urlencode
(
$timestamp
);
if
(
!
empty
(
$google_api_key
=
$this
->
getConfig
(
'google_api_key'
)))
{
$google_api_key
=
$this
->
getConfig
(
'google_api_key'
);
if
(
!
empty
(
$google_api_key
))
{
$params
.=
'&key='
.
$google_api_key
;
$params
.=
'&key='
.
$google_api_key
;
}
}
...
...
src/Telegram.php
View file @
2b293902
...
@@ -30,7 +30,7 @@ class Telegram
...
@@ -30,7 +30,7 @@ class Telegram
*
*
* @var string
* @var string
*/
*/
protected
$version
=
'0.0.
5
'
;
protected
$version
=
'0.0.
7
'
;
/**
/**
* Telegram API key
* Telegram API key
...
...
tests/Bootstrap.php
View file @
2b293902
...
@@ -25,7 +25,7 @@ $root = realpath(dirname(dirname(__FILE__)));
...
@@ -25,7 +25,7 @@ $root = realpath(dirname(dirname(__FILE__)));
* Check that --dev composer installation was done
* Check that --dev composer installation was done
*/
*/
if
(
!
file_exists
(
$root
.
'/vendor/autoload.php'
))
{
if
(
!
file_exists
(
$root
.
'/vendor/autoload.php'
))
{
throw
new
Exception
(
throw
new
\
Exception
(
'Please run "php composer.phar install --dev" in root directory '
'Please run "php composer.phar install --dev" in root directory '
.
'to setup unit test dependencies before running the tests'
.
'to setup unit test dependencies before running the tests'
);
);
...
...
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