Skip to content

Commit bbbe4d6

Browse files
authored
Merge pull request #1058 from omentes/add_support_lang_for_selectChats_function_in_DB_class
add select users by language_code in DB::selectChats()
2 parents 94af2fb + f480c27 commit bbbe4d6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
99
### Added
1010
- Bot API 4.5 (Unique file IDs, MarkdownV2). (#1046)
1111
- Chain the exception thrown when getting commands from path. (#1030)
12+
- Support `language_code` in `DB::selectChats()` for filtering the chats selection.
1213
### Changed
1314
- Save notes an unescaped JSON, to allow easy DB reading and editing of values. (#1005)
1415
### Deprecated

src/DB.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ public static function selectChats($select_chats_params)
10931093
'date_to' => null,
10941094
'chat_id' => null,
10951095
'text' => null,
1096+
'language' => null,
10961097
], $select_chats_params);
10971098

10981099
if (!$select['groups'] && !$select['users'] && !$select['supergroups'] && !$select['channels']) {
@@ -1148,6 +1149,11 @@ public static function selectChats($select_chats_params)
11481149
$tokens[':chat_id'] = $select['chat_id'];
11491150
}
11501151

1152+
if ($select['users'] && null !== $select['language']) {
1153+
$where[] = TB_USER . '.`language_code` = :language';
1154+
$tokens[':language'] = $select['language'];
1155+
}
1156+
11511157
if (null !== $select['text']) {
11521158
$text_like = '%' . strtolower($select['text']) . '%';
11531159
if ($select['users']) {

0 commit comments

Comments
 (0)