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
9d855c35
Commit
9d855c35
authored
Jan 01, 2017
by
Armando Lüscher
Committed by
GitHub
Jan 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #378 from jacklul/username_in_chat_table
Add 'username' field to 'chat' table
parents
b12b2e99
bfb2a3e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
DB.php
src/DB.php
+5
-2
structure.sql
structure.sql
+1
-0
No files found.
src/DB.php
View file @
9d855c35
...
...
@@ -408,18 +408,20 @@ class DB
$chat_id
=
$chat
->
getId
();
$chat_title
=
$chat
->
getTitle
();
$chat_username
=
$chat
->
getUsername
();
$chat_type
=
$chat
->
getType
();
$chat_all_members_are_administrators
=
$chat
->
getAllMembersAreAdministrators
();
try
{
$sth
=
self
::
$pdo
->
prepare
(
'
INSERT IGNORE INTO `'
.
TB_CHAT
.
'`
(`id`, `type`, `title`, `all_members_are_administrators`, `created_at` ,`updated_at`, `old_id`)
(`id`, `type`, `title`, `
username`, `
all_members_are_administrators`, `created_at` ,`updated_at`, `old_id`)
VALUES
(:id, :type, :title, :all_members_are_administrators, :date, :date, :oldid)
(:id, :type, :title, :
username, :
all_members_are_administrators, :date, :date, :oldid)
ON DUPLICATE KEY UPDATE
`type` = :type,
`title` = :title,
`username` = :username,
`all_members_are_administrators` = :all_members_are_administrators,
`updated_at` = :date
'
);
...
...
@@ -436,6 +438,7 @@ class DB
$sth
->
bindParam
(
':type'
,
$chat_type
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':title'
,
$chat_title
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':username'
,
$chat_username
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':all_members_are_administrators'
,
$chat_all_members_are_administrators
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':date'
,
$date
,
PDO
::
PARAM_STR
);
...
...
structure.sql
View file @
9d855c35
...
...
@@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS `chat` (
`id`
bigint
COMMENT
'Unique user or chat identifier'
,
`type`
ENUM
(
'private'
,
'group'
,
'supergroup'
,
'channel'
)
NOT
NULL
COMMENT
'Chat type, either private, group, supergroup or channel'
,
`title`
CHAR
(
255
)
DEFAULT
''
COMMENT
'Chat (group) title, is null if chat type is private'
,
`username`
CHAR
(
255
)
DEFAULT
NULL
COMMENT
'Username, for private chats, supergroups and channels if available'
,
`all_members_are_administrators`
tinyint
(
1
)
DEFAULT
0
COMMENT
'True if a all members of this group are admins'
,
`created_at`
timestamp
NULL
DEFAULT
NULL
COMMENT
'Entry date creation'
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
COMMENT
'Entry date update'
,
...
...
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