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
1afa177b
Commit
1afa177b
authored
Jan 05, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating Update for inline
parent
1d02c86f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
6 deletions
+138
-6
ChosenInlineResult.php
src/Entities/ChosenInlineResult.php
+53
-0
InlineQuery.php
src/Entities/InlineQuery.php
+58
-0
Update.php
src/Entities/Update.php
+27
-6
No files found.
src/Entities/ChosenInlineResult.php
0 → 100644
View file @
1afa177b
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
use
Longman\TelegramBot\Exception\TelegramException
;
class
ChosenInlineResult
extends
Entity
{
protected
$result_id
;
protected
$from
;
protected
$query
;
public
function
__construct
(
array
$data
)
{
$this
->
result_id
=
isset
(
$data
[
'result_id'
])
?
$data
[
'result_id'
]
:
null
;
if
(
empty
(
$this
->
result_id
))
{
throw
new
TelegramException
(
'result_id is empty!'
);
}
$this
->
=
isset
(
$data
[
'from'
])
?
$data
[
'from'
]
:
null
;
if
(
empty
(
$this
->
from
))
{
throw
new
TelegramException
(
'from is empty!'
);
}
$this
->
from
=
new
User
(
$this
->
from
);
$this
->
query
=
isset
(
$data
[
'query'
])
?
$data
[
'query'
]
:
null
;
$this
->
offset
=
isset
(
$data
[
'offset'
])
?
$data
[
'offset'
]
:
null
;
}
public
function
getId
()
{
return
$this
->
id
;
}
public
function
geFrom
()
{
return
$this
->
from
;
}
public
function
getQuery
()
{
return
$this
->
query
;
}
}
src/Entities/InlineQuery.php
0 → 100644
View file @
1afa177b
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
use
Longman\TelegramBot\Exception\TelegramException
;
class
InlineQuery
extends
Entity
{
protected
$id
;
protected
$from
;
protected
$query
;
protected
$offset
;
public
function
__construct
(
array
$data
)
{
$this
->
id
=
isset
(
$data
[
'id'
])
?
$data
[
'id'
]
:
null
;
if
(
empty
(
$this
->
id
))
{
throw
new
TelegramException
(
'id is empty!'
);
}
$this
->
=
isset
(
$data
[
'from'
])
?
$data
[
'from'
]
:
null
;
if
(
empty
(
$this
->
from
))
{
throw
new
TelegramException
(
'from is empty!'
);
}
$this
->
from
=
new
User
(
$this
->
from
);
$this
->
query
=
isset
(
$data
[
'query'
])
?
$data
[
'query'
]
:
null
;
$this
->
offset
=
isset
(
$data
[
'offset'
])
?
$data
[
'offset'
]
:
null
;
}
public
function
getId
()
{
return
$this
->
id
;
}
public
function
geFrom
()
{
return
$this
->
from
;
}
public
function
getQuery
()
{
return
$this
->
query
;
}
public
function
getOffset
()
{
return
$this
->
offset
;
}
}
src/Entities/Update.php
View file @
1afa177b
...
...
@@ -17,32 +17,53 @@ class Update extends Entity
protected
$update_id
;
protected
$message
;
protected
$inline_query
;
protected
$chosen_inline_result
;
public
function
__construct
(
array
$data
,
$bot_name
,
$let_update_id_empty
=
0
)
{
$this
->
bot_name
=
$bot_name
;
$update_id
=
isset
(
$data
[
'update_id'
])
?
$data
[
'update_id'
]
:
null
;
$this
->
update_id
=
$update_id
;
$message
=
isset
(
$data
[
'message'
])
?
$data
[
'message'
]
:
null
;
$this
->
message
=
isset
(
$data
[
'message'
])
?
$data
[
'message'
]
:
null
;
if
(
!
empty
(
$this
->
message
))
{
$this
->
message
=
new
Message
(
$this
->
message
,
$bot_name
);
}
if
(
empty
(
$update_id
)
&&
!
$let_update_id_empty
)
{
throw
new
TelegramException
(
'update_id is empty!'
);
}
$this
->
bot_name
=
$bot_name
;
$this
->
update_id
=
$update_id
;
$this
->
message
=
new
Message
(
$message
,
$bot_name
);
$this
->
inline_query
=
isset
(
$data
[
'inline_query'
])
?
$data
[
'inline_query'
]
:
null
;
if
(
!
empty
(
$this
->
inline_query
))
{
$this
->
inline_query
=
new
InlineQuery
(
$this
->
inline_query
);
}
$this
->
chosen_inline_result
=
isset
(
$data
[
'chosen_inline_result'
])
?
$data
[
'chosen_inline_result'
]
:
null
;
if
(
!
empty
(
$this
->
chosen_inline_result
))
{
$this
->
chosen_inline_result
=
new
ChosenInlineResult
(
$this
->
chosen_inline_result
);
}
}
public
function
getUpdateId
()
{
return
$this
->
update_id
;
}
public
function
getMessage
()
{
return
$this
->
message
;
}
public
function
getInlineQuery
()
{
return
$this
->
inline_query
;
}
public
function
getChosenInlineResult
()
{
return
$this
->
chosen_inline_result
;
}
}
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