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
da0dd39c
Unverified
Commit
da0dd39c
authored
Aug 27, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up insertMessageRequest method.
parent
3d50e036
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
DB.php
src/DB.php
+22
-21
No files found.
src/DB.php
View file @
da0dd39c
...
...
@@ -16,6 +16,7 @@ use Longman\TelegramBot\Entities\Chat;
use
Longman\TelegramBot\Entities\ChosenInlineResult
;
use
Longman\TelegramBot\Entities\InlineQuery
;
use
Longman\TelegramBot\Entities\Message
;
use
Longman\TelegramBot\Entities\ReplyToMessage
;
use
Longman\TelegramBot\Entities\Update
;
use
Longman\TelegramBot\Entities\User
;
use
Longman\TelegramBot\Exception\TelegramException
;
...
...
@@ -699,13 +700,13 @@ class DB
self
::
insertUser
(
$from
,
$date
,
$chat
);
//Insert the forwarded message user in users table
if
(
is_object
(
$forward_from
)
)
{
if
(
$forward_from
instanceof
User
)
{
$forward_date
=
self
::
getTimestamp
(
$message
->
getForwardDate
());
self
::
insertUser
(
$forward_from
,
$forward_date
);
$forward_from
=
$forward_from
->
getId
();
}
if
(
is_object
(
$forward_from_chat
)
)
{
if
(
$forward_from_chat
instanceof
Chat
)
{
$forward_date
=
self
::
getTimestamp
(
$message
->
getForwardDate
());
self
::
insertChat
(
$forward_from_chat
,
$forward_date
);
$forward_from_chat
=
$forward_from_chat
->
getId
();
...
...
@@ -723,7 +724,8 @@ class DB
}
try
{
$sth
=
self
::
$pdo
->
prepare
(
'INSERT IGNORE INTO `'
.
TB_MESSAGE
.
'`
$sth
=
self
::
$pdo
->
prepare
(
'
INSERT IGNORE INTO `'
.
TB_MESSAGE
.
'`
(
`id`, `user_id`, `chat_id`, `date`, `forward_from`, `forward_from_chat`,
`forward_date`, `reply_to_chat`, `reply_to_message`, `text`, `entities`, `audio`, `document`,
...
...
@@ -732,8 +734,7 @@ class DB
`new_chat_title`,`new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
`supergroup_chat_created`, `channel_chat_created`,
`migrate_from_chat_id`, `migrate_to_chat_id`, `pinned_message`
)
VALUES (
) VALUES (
:message_id, :user_id, :chat_id, :date, :forward_from, :forward_from_chat,
:forward_date, :reply_to_chat, :reply_to_message, :text, :entities, :audio, :document,
:photo, :sticker, :video, :voice, :caption, :contact,
...
...
@@ -749,7 +750,7 @@ class DB
$reply_to_message
=
$message
->
getReplyToMessage
();
$reply_to_message_id
=
null
;
if
(
is_object
(
$reply_to_message
)
)
{
if
(
$reply_to_message
instanceof
ReplyToMessage
)
{
$reply_to_message_id
=
$reply_to_message
->
getMessageId
();
// please notice that, as explained in the documentation, reply_to_message don't contain other
// reply_to_message field so recursion deep is 1
...
...
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