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
1d4ae42c
Unverified
Commit
1d4ae42c
authored
Apr 21, 2018
by
Avtandil Kikabidze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change method of initializing container
parent
c863f701
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
16 deletions
+20
-16
Kernel.php
src/Http/Kernel.php
+1
-5
Telegram.php
src/Telegram.php
+18
-10
TelegramTest.php
tests/unit/TelegramTest.php
+1
-1
No files found.
src/Http/Kernel.php
View file @
1d4ae42c
...
...
@@ -49,10 +49,6 @@ class Kernel
$update
=
new
Update
(
$params
->
all
(),
$this
->
app
->
getBotUsername
());
if
(
$response
=
$this
->
app
->
processUpdate
(
$update
))
{
return
$response
->
isOk
();
}
return
$response
;
return
$this
->
app
->
processUpdate
(
$update
);
}
}
src/Telegram.php
View file @
1d4ae42c
...
...
@@ -28,7 +28,7 @@ use RecursiveDirectoryIterator;
use
RecursiveIteratorIterator
;
use
RegexIterator
;
class
Telegram
extends
Container
class
Telegram
{
/**
* Version
...
...
@@ -188,7 +188,7 @@ class Telegram extends Container
$this
->
bot_username
=
$bot_username
;
}
$this
->
register
BaseBindings
();
$this
->
register
Container
();
//Add default system commands path
$this
->
addCommandsPath
(
TB_BASE_COMMANDS_PATH
.
'/SystemCommands'
);
...
...
@@ -197,17 +197,25 @@ class Telegram extends Container
}
/**
* Register the
basic bindings into the
container.
* Register the container.
*
* @return void
*/
protected
function
register
BaseBindings
()
protected
function
register
Container
()
{
static
::
setInstance
(
$this
);
$this
->
container
=
Container
::
getInstance
(
);
$this
->
instance
(
'app'
,
$this
);
$this
->
container
->
instance
(
Telegram
::
class
,
$this
);
}
$this
->
instance
(
Telegram
::
class
,
$this
);
/**
* Get container instance.
*
* @return \Illuminate\Container\Container
*/
public
function
getContainer
()
{
return
$this
->
container
;
}
/**
...
...
@@ -364,7 +372,7 @@ class Telegram extends Container
}
/** @var \Longman\TelegramBot\Console\Kernel $kernel */
$kernel
=
$this
->
make
(
ConsoleKernel
::
class
);
$kernel
=
$this
->
getContainer
()
->
make
(
ConsoleKernel
::
class
);
$response
=
$kernel
->
handle
(
Request
::
capture
(),
$limit
,
$timeout
);
...
...
@@ -374,7 +382,7 @@ class Telegram extends Container
/**
* Handle bot request from webhook
*
* @return
bool
* @return
\Longman\TelegramBot\Http\Response
*
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
...
...
@@ -385,7 +393,7 @@ class Telegram extends Container
}
/** @var \Longman\TelegramBot\Http\Kernel $kernel */
$kernel
=
$this
->
make
(
Kernel
::
class
);
$kernel
=
$this
->
getContainer
()
->
make
(
Kernel
::
class
);
$response
=
$kernel
->
handle
(
Request
::
capture
());
...
...
tests/unit/TelegramTest.php
View file @
1d4ae42c
...
...
@@ -149,7 +149,7 @@ class TelegramTest extends TestCase
{
$telegram
=
new
Telegram
(
self
::
$dummy_api_key
,
'testbot'
);
$this
->
assertInstanceOf
(
\Illuminate\Container\Container
::
class
,
$telegram
);
$this
->
assertInstanceOf
(
\Illuminate\Container\Container
::
class
,
$telegram
->
getContainer
()
);
}
public
function
testCustom
()
...
...
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