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
03e1ac14
Commit
03e1ac14
authored
Apr 10, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Plain Diff
merge conflicts resolved
parents
6a131d3c
18f9215b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
27 deletions
+105
-27
MigratefromchatidCommand.php
src/Commands/SystemCommands/MigratefromchatidCommand.php
+36
-0
MigratetochatidCommand.php
src/Commands/SystemCommands/MigratetochatidCommand.php
+36
-0
SupergroupchatcreatedCommand.php
src/Commands/SystemCommands/SupergroupchatcreatedCommand.php
+4
-19
DB.php
src/DB.php
+21
-8
Message.php
src/Entities/Message.php
+6
-0
Telegram.php
src/Telegram.php
+2
-0
No files found.
src/Commands/SystemCommands/MigratefromchatidCommand.php
0 → 100644
View file @
03e1ac14
<?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\Commands\SystemCommands
;
use
Longman\TelegramBot\Commands\SystemCommand
;
/**
* Migrate from chat id command
*/
class
MigratefromchatidCommand
extends
SystemCommand
{
/**#@+
* {@inheritdoc}
*/
protected
$name
=
'Migratefromchatid'
;
protected
$description
=
'Migrate from chat id'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
* {@inheritdoc}
*/
/*public function execute()
{
//$message = $this->getMessage();
//$migrate_from_chat_id = $message->getMigrateFromChatId();
}*/
}
src/Commands/SystemCommands/MigratetochatidCommand.php
0 → 100644
View file @
03e1ac14
<?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\Commands\SystemCommands
;
use
Longman\TelegramBot\Commands\SystemCommand
;
/**
* Migrate to chat id command
*/
class
MigratetochatidCommand
extends
SystemCommand
{
/**#@+
* {@inheritdoc}
*/
protected
$name
=
'Migratetochatid'
;
protected
$description
=
'Migrate to chat id'
;
protected
$version
=
'1.0.1'
;
/**#@-*/
/**
* {@inheritdoc}
*/
/*public function execute()
{
//$message = $this->getMessage();
//$migrate_to_chat_id = $message->getMigrateToChatId();
}*/
}
src/Commands/SystemCommands/SupergroupchatcreatedCommand.php
View file @
03e1ac14
...
...
@@ -11,7 +11,6 @@
namespace
Longman\TelegramBot\Commands\SystemCommands
;
use
Longman\TelegramBot\Commands\SystemCommand
;
use
Longman\TelegramBot\Request
;
/**
* Super group chat created command
...
...
@@ -29,23 +28,9 @@ class SupergroupchatcreatedCommand extends SystemCommand
/**
* {@inheritdoc}
*/
public
function
execute
()
/*
public function execute()
{
$message
=
$this
->
getMessage
();
$chat_id
=
$message
->
getChat
()
->
getId
();
$text
=
''
;
if
(
$message
->
getSuperGroupChatCreated
())
{
$text
=
'Your group has become a Supergroup!'
.
"
\n
"
;
$text
.=
'Chat id has changed from '
.
$message
->
getMigrateFromChatId
()
.
' to '
.
$message
->
getMigrateToChatId
();
}
$data
=
[
'chat_id'
=>
$chat_id
,
'text'
=>
$text
,
];
return
Request
::
sendMessage
(
$data
);
}
//$message = $this->getMessage();
//$supergroup_chat_created = $message->getSuperGroupChatCreated();
}*/
}
src/DB.php
View file @
03e1ac14
...
...
@@ -506,6 +506,7 @@ class DB
$left_chat_participant
=
$message
->
getLeftChatParticipant
();
$migrate_from_chat_id
=
$message
->
getMigrateFromChatId
();
$migrate_to_chat_id
=
$message
->
getMigrateToChatId
();
try
{
//chat table
...
...
@@ -522,11 +523,22 @@ class DB
$chat_title
=
$chat
->
getTitle
();
$type
=
$chat
->
getType
();
$sth2
->
bindParam
(
':id'
,
$chat_id
,
\PDO
::
PARAM_INT
);
$sth2
->
bindParam
(
':type'
,
$type
,
\PDO
::
PARAM_STR
);
if
(
$migrate_to_chat_id
)
{
$type
=
'supergroup'
;
$sth2
->
bindParam
(
':id'
,
$migrate_to_chat_id
,
\PDO
::
PARAM_INT
);
$sth2
->
bindParam
(
':oldid'
,
$chat_id
,
\PDO
::
PARAM_INT
);
}
else
{
$sth2
->
bindParam
(
':id'
,
$chat_id
,
\PDO
::
PARAM_INT
);
$sth2
->
bindParam
(
':oldid'
,
$migrate_to_chat_id
,
\PDO
::
PARAM_INT
);
}
$sth2
->
bindParam
(
':type'
,
$type
,
\PDO
::
PARAM_INT
);
$sth2
->
bindParam
(
':title'
,
$chat_title
,
\PDO
::
PARAM_STR
,
255
);
$sth2
->
bindParam
(
':date'
,
$date
,
\PDO
::
PARAM_STR
);
$sth2
->
bindParam
(
':oldid'
,
$migrate_from_chat_id
,
\PDO
::
PARAM_INT
);
$status
=
$sth2
->
execute
();
...
...
@@ -543,7 +555,7 @@ class DB
self
::
insertUser
(
$forward_from
,
$forward_date
);
$forward_from
=
$forward_from
->
getId
();
}
if
(
$new_chat_participant
)
{
//Insert the new chat user
self
::
insertUser
(
$new_chat_participant
,
$date
,
$chat
);
...
...
@@ -603,6 +615,7 @@ class DB
$supergroup_chat_created
=
$message
->
getSupergroupChatCreated
();
$channel_chat_created
=
$message
->
getChannelChatCreated
();
$migrate_from_chat_id
=
$message
->
getMigrateFromChatId
();
$migrate_to_chat_id
=
$message
->
getMigrateToChatId
();
$sth
->
bindParam
(
':message_id'
,
$message_id
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':user_id'
,
$from_id
,
\PDO
::
PARAM_INT
);
...
...
@@ -652,10 +665,10 @@ class DB
$sth
->
bindParam
(
':new_chat_photo'
,
$new_chat_photo
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':delete_chat_photo'
,
$delete_chat_photo
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':group_chat_created'
,
$group_chat_created
,
\PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':supergroup_chat_created'
,
$
migrate_from_chat_i
d
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':channel_chat_created'
,
$
supergroup
_chat_created
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':migrate_from_chat_id'
,
$
channel_chat_create
d
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':migrate_to_chat_id'
,
$migrate_
from
_chat_id
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':supergroup_chat_created'
,
$
supergroup_chat_create
d
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':channel_chat_created'
,
$
channel
_chat_created
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':migrate_from_chat_id'
,
$
migrate_from_chat_i
d
,
\PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':migrate_to_chat_id'
,
$migrate_
to
_chat_id
,
\PDO
::
PARAM_INT
);
$status
=
$sth
->
execute
();
}
catch
(
PDOException
$e
)
{
...
...
src/Entities/Message.php
View file @
03e1ac14
...
...
@@ -229,7 +229,13 @@ class Message extends Entity
}
$this
->
migrate_to_chat_id
=
isset
(
$data
[
'migrate_to_chat_id'
])
?
$data
[
'migrate_to_chat_id'
]
:
null
;
if
(
$this
->
migrate_to_chat_id
)
{
$this
->
type
=
'migrate_to_chat_id'
;
}
$this
->
migrate_from_chat_id
=
isset
(
$data
[
'migrate_from_chat_id'
])
?
$data
[
'migrate_from_chat_id'
]
:
null
;
if
(
$this
->
migrate_from_chat_id
)
{
$this
->
type
=
'migrate_from_chat_id'
;
}
}
...
...
src/Telegram.php
View file @
03e1ac14
...
...
@@ -468,6 +468,8 @@ class Telegram
'delete_chat_photo'
,
'group_chat_created'
,
'left_chat_participant'
,
'migrate_from_chat_id'
,
'migrate_to_chat_id'
,
'new_chat_participant'
,
'new_chat_photo'
,
'new_chat_title'
,
...
...
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