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
0348c3a3
Commit
0348c3a3
authored
Dec 28, 2016
by
Jack'lul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional fixes and improvements (thanks to @noplanman)
parent
01893846
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
getUpdatesCLI.php
examples/getUpdatesCLI.php
+1
-1
hook.php
examples/hook.php
+1
-1
Botan.php
src/Botan.php
+14
-14
No files found.
examples/getUpdatesCLI.php
View file @
0348c3a3
...
@@ -62,7 +62,7 @@ try {
...
@@ -62,7 +62,7 @@ try {
//$telegram->setUploadPath('../Upload');
//$telegram->setUploadPath('../Upload');
// Botan.io integration
// Botan.io integration
// Second argument
is optional maximum timeout
// Second argument
are options
//$telegram->enableBotan('your_token');
//$telegram->enableBotan('your_token');
//$telegram->enableBotan('your_token', ['timeout' => 3]);
//$telegram->enableBotan('your_token', ['timeout' => 3]);
...
...
examples/hook.php
View file @
0348c3a3
...
@@ -61,7 +61,7 @@ try {
...
@@ -61,7 +61,7 @@ try {
//$telegram->setUploadPath('../Upload');
//$telegram->setUploadPath('../Upload');
// Botan.io integration
// Botan.io integration
// Second argument
is optional maximum timeout
// Second argument
are options
//$telegram->enableBotan('your_token');
//$telegram->enableBotan('your_token');
//$telegram->enableBotan('your_token', ['timeout' => 3]);
//$telegram->enableBotan('your_token', ['timeout' => 3]);
...
...
src/Botan.php
View file @
0348c3a3
...
@@ -187,17 +187,17 @@ class Botan
...
@@ -187,17 +187,17 @@ class Botan
]
]
);
);
$res
ponse
=
(
string
)
$response
->
getBody
();
$res
ult
=
(
string
)
$response
->
getBody
();
}
catch
(
RequestException
$e
)
{
}
catch
(
RequestException
$e
)
{
$res
ponse
=
(
$e
->
getResponse
())
?
(
string
)
$e
->
getResponse
()
->
getBody
()
:
''
;
$res
ult
=
$e
->
getMessage
()
;
}
finally
{
}
finally
{
$responseData
=
json_decode
(
$res
ponse
,
true
);
$responseData
=
json_decode
(
$res
ult
,
true
);
if
(
$responseData
[
'status'
]
!==
'accepted'
)
{
if
(
$responseData
[
'status'
]
!==
'accepted'
)
{
if
(
!
empty
(
$res
ponse
))
{
if
(
!
empty
(
$res
ult
))
{
TelegramLog
::
debug
(
"Botan.io stats report failed
, API reply:
$response
"
);
TelegramLog
::
debug
(
"Botan.io stats report failed
:
$result
\n\n
"
);
}
else
{
}
else
{
TelegramLog
::
debug
(
"Botan.io stats report failed
, API returned empty response!
"
);
TelegramLog
::
debug
(
"Botan.io stats report failed
: empty response!
\n\n
"
);
}
}
return
false
;
return
false
;
...
@@ -239,18 +239,18 @@ class Botan
...
@@ -239,18 +239,18 @@ class Botan
)
)
);
);
$res
ponse
=
(
string
)
$response
->
getBody
();
$res
ult
=
(
string
)
$response
->
getBody
();
}
catch
(
RequestException
$e
)
{
}
catch
(
RequestException
$e
)
{
$res
ponse
=
(
$e
->
getResponse
())
?
(
string
)
$e
->
getResponse
()
->
getBody
()
:
''
;
$res
ult
=
$e
->
getMessage
()
;
}
finally
{
}
finally
{
if
(
filter_var
(
$res
ponse
,
FILTER_VALIDATE_URL
)
!==
false
)
{
if
(
filter_var
(
$res
ult
,
FILTER_VALIDATE_URL
)
!==
false
)
{
BotanDB
::
insertShortUrl
(
$user_id
,
$url
,
$res
ponse
);
BotanDB
::
insertShortUrl
(
$user_id
,
$url
,
$res
ult
);
return
$res
ponse
;
return
$res
ult
;
}
else
{
}
else
{
if
(
!
empty
(
$res
ponse
))
{
if
(
!
empty
(
$res
ult
))
{
TelegramLog
::
debug
(
"Botan.io URL shortening failed for '
$url
'
, API reply:
$response
"
);
TelegramLog
::
debug
(
"Botan.io URL shortening failed for '
$url
'
:
$result
\n\n
"
);
}
else
{
}
else
{
TelegramLog
::
debug
(
"Botan.io URL shortening failed for '
$url
'
, API returned empty response!
"
);
TelegramLog
::
debug
(
"Botan.io URL shortening failed for '
$url
'
: empty response!
\n\n
"
);
}
}
return
$url
;
return
$url
;
...
...
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