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
fe721e02
Commit
fe721e02
authored
Feb 09, 2018
by
Jack'lul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require user to manually enable non-DB mode using seperated method
parent
7a34308d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
Telegram.php
src/Telegram.php
+20
-4
No files found.
src/Telegram.php
View file @
fe721e02
...
...
@@ -137,6 +137,13 @@ class Telegram
*/
protected
$run_commands
=
false
;
/**
* Is running getUpdates without DB enabled
*
* @var bool
*/
protected
$getupdates_without_database
=
false
;
/**
* Last update ID
* Only used when running getUpdates without a database
...
...
@@ -318,22 +325,21 @@ class Telegram
*
* @param int|null $limit
* @param int|null $timeout
* @param bool $no_database
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
handleGetUpdates
(
$limit
=
null
,
$timeout
=
null
,
$no_database
=
false
)
public
function
handleGetUpdates
(
$limit
=
null
,
$timeout
=
null
)
{
if
(
empty
(
$this
->
bot_username
))
{
throw
new
TelegramException
(
'Bot Username is not defined!'
);
}
if
(
!
DB
::
isDbConnected
()
&&
!
$
no
_database
)
{
if
(
!
DB
::
isDbConnected
()
&&
!
$
this
->
getupdates_without
_database
)
{
return
new
ServerResponse
(
[
'ok'
=>
false
,
'description'
=>
'getUpdates needs MySQL connection!'
,
'description'
=>
'getUpdates needs MySQL connection!
(This can be overridden - see documentation)
'
,
],
$this
->
bot_username
);
...
...
@@ -984,4 +990,14 @@ class Telegram
{
return
$this
->
run_commands
;
}
/**
* Switch to enable running getUpdates without a database
*
* @param bool $enable
*/
public
function
useGetUpdatesWithoutDatabase
(
$enable
=
true
)
{
$this
->
getupdates_without_database
=
$enable
;
}
}
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