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
fa88ab2b
Commit
fa88ab2b
authored
Jan 24, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new table schema works!
parent
820130b0
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
361 additions
and
109 deletions
+361
-109
DB.php
src/DB.php
+231
-48
ChosenInlineResult.php
src/Entities/ChosenInlineResult.php
+3
-3
Update.php
src/Entities/Update.php
+2
-3
Telegram.php
src/Telegram.php
+5
-6
structure.sql
structure.sql
+120
-49
No files found.
src/DB.php
View file @
fa88ab2b
This diff is collapsed.
Click to expand it.
src/Entities/ChosenInlineResult.php
View file @
fa88ab2b
...
...
@@ -37,12 +37,12 @@ class ChosenInlineResult extends Entity
$this
->
offset
=
isset
(
$data
[
'offset'
])
?
$data
[
'offset'
]
:
null
;
}
public
function
getId
()
public
function
get
Result
Id
()
{
return
$this
->
id
;
return
$this
->
result_
id
;
}
public
function
geFrom
()
public
function
ge
t
From
()
{
return
$this
->
from
;
}
...
...
src/Entities/Update.php
View file @
fa88ab2b
...
...
@@ -21,7 +21,7 @@ class Update extends Entity
protected
$chosen_inline_result
;
private
$update_type
;
public
function
__construct
(
array
$data
,
$bot_name
,
$let_update_id_empty
=
0
)
public
function
__construct
(
array
$data
,
$bot_name
)
{
$this
->
bot_name
=
$bot_name
;
...
...
@@ -35,11 +35,10 @@ class Update extends Entity
$this
->
update_type
=
'message'
;
}
if
(
empty
(
$update_id
)
&&
!
$let_update_id_empty
)
{
if
(
empty
(
$update_id
))
{
throw
new
TelegramException
(
'update_id is empty!'
);
}
$this
->
inline_query
=
isset
(
$data
[
'inline_query'
])
?
$data
[
'inline_query'
]
:
null
;
if
(
!
empty
(
$this
->
inline_query
))
{
$this
->
inline_query
=
new
InlineQuery
(
$this
->
inline_query
);
...
...
src/Telegram.php
View file @
fa88ab2b
...
...
@@ -29,7 +29,7 @@ class Telegram
*
* @var string
*/
protected
$version
=
'0.2
5
.0'
;
protected
$version
=
'0.2
6
.0'
;
/**
* Telegram API key
...
...
@@ -343,11 +343,11 @@ class Telegram
public
function
handleGetUpdates
(
$limit
=
null
,
$timeout
=
null
)
{
//DB Query
$last_
message
=
DB
::
selectMessages
(
1
);
$last_
update
=
DB
::
selectTelegramUpdate
(
1
);
if
(
isset
(
$last_
message
[
0
][
'update_
id'
]))
{
if
(
isset
(
$last_
update
[
0
][
'
id'
]))
{
//As explained in the telegram bot api documentation
$offset
=
$last_
message
[
0
][
'update_
id'
]
+
1
;
$offset
=
$last_
update
[
0
][
'
id'
]
+
1
;
}
else
{
$offset
=
null
;
}
...
...
@@ -418,8 +418,6 @@ class Telegram
}
}
DB
::
insertRequest
(
$update
);
// check type
$message
=
$update
->
getMessage
();
$type
=
$message
->
getType
();
...
...
@@ -475,6 +473,7 @@ class Telegram
$command
=
'Choseninlineresult'
;
}
DB
::
insertRequest
(
$update
);
$result
=
$this
->
executeCommand
(
$command
,
$update
);
return
$result
;
}
...
...
structure.sql
View file @
fa88ab2b
This diff is collapsed.
Click to expand it.
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