Skip to main content
The Telegram plugin syncs data locally. Use corsair.telegram.db.<entity>.search({ data, limit?, offset? }) with the filters listed per entity.

Chats

Path: telegram.db.chats.search
const rows = await corsair.telegram.db.chats.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});

Searchable filters

FieldTypeOperators
entity_idstringequals, contains, startsWith, endsWith, in
idstringequals, contains, startsWith, endsWith, in
chat_idnumberequals, gt, gte, lt, lte, in
titlestringequals, contains, startsWith, endsWith, in
usernamestringequals, contains, startsWith, endsWith, in
first_namestringequals, contains, startsWith, endsWith, in
last_namestringequals, contains, startsWith, endsWith, in
is_forumbooleanequals
descriptionstringequals, contains, startsWith, endsWith, in
invite_linkstringequals, contains, startsWith, endsWith, in
createdAtdateequals, before, after, between
Every .search() also accepts limit and offset for pagination. .list() is available on the same path without the .search suffix in code — see database operations.

Files

Path: telegram.db.files.search
const rows = await corsair.telegram.db.files.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});

Searchable filters

FieldTypeOperators
entity_idstringequals, contains, startsWith, endsWith, in
idstringequals, contains, startsWith, endsWith, in
file_idstringequals, contains, startsWith, endsWith, in
file_unique_idstringequals, contains, startsWith, endsWith, in
file_sizenumberequals, gt, gte, lt, lte, in
file_pathstringequals, contains, startsWith, endsWith, in
createdAtdateequals, before, after, between
Every .search() also accepts limit and offset for pagination. .list() is available on the same path without the .search suffix in code — see database operations.

Messages

Path: telegram.db.messages.search
const rows = await corsair.telegram.db.messages.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});

Searchable filters

FieldTypeOperators
entity_idstringequals, contains, startsWith, endsWith, in
idstringequals, contains, startsWith, endsWith, in
message_idnumberequals, gt, gte, lt, lte, in
chat_idstringequals, contains, startsWith, endsWith, in
from_idstringequals, contains, startsWith, endsWith, in
authorIdstringequals, contains, startsWith, endsWith, in
datenumberequals, gt, gte, lt, lte, in
textstringequals, contains, startsWith, endsWith, in
captionstringequals, contains, startsWith, endsWith, in
createdAtdateequals, before, after, between
edit_datenumberequals, gt, gte, lt, lte, in
media_group_idstringequals, contains, startsWith, endsWith, in
reply_to_message_idnumberequals, gt, gte, lt, lte, in
forward_from_idnumberequals, gt, gte, lt, lte, in
forward_from_chat_idnumberequals, gt, gte, lt, lte, in
forward_from_message_idnumberequals, gt, gte, lt, lte, in
Every .search() also accepts limit and offset for pagination. .list() is available on the same path without the .search suffix in code — see database operations.

Polls

Path: telegram.db.polls.search
const rows = await corsair.telegram.db.polls.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});

Searchable filters

FieldTypeOperators
entity_idstringequals, contains, startsWith, endsWith, in
idstringequals, contains, startsWith, endsWith, in
poll_idstringequals, contains, startsWith, endsWith, in
questionstringequals, contains, startsWith, endsWith, in
total_voter_countnumberequals, gt, gte, lt, lte, in
is_closedbooleanequals
is_anonymousbooleanequals
typestringequals, contains, startsWith, endsWith, in
allows_multiple_answersbooleanequals
createdAtdateequals, before, after, between
Every .search() also accepts limit and offset for pagination. .list() is available on the same path without the .search suffix in code — see database operations.

Users

Path: telegram.db.users.search
const rows = await corsair.telegram.db.users.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});

Searchable filters

FieldTypeOperators
entity_idstringequals, contains, startsWith, endsWith, in
idstringequals, contains, startsWith, endsWith, in
user_idnumberequals, gt, gte, lt, lte, in
is_botbooleanequals
first_namestringequals, contains, startsWith, endsWith, in
last_namestringequals, contains, startsWith, endsWith, in
usernamestringequals, contains, startsWith, endsWith, in
language_codestringequals, contains, startsWith, endsWith, in
is_premiumbooleanequals
createdAtdateequals, before, after, between
Every .search() also accepts limit and offset for pagination. .list() is available on the same path without the .search suffix in code — see database operations.