channels.GetAdminLog
Get the admin log of a channel/supergroup
Example
const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result = await client.invoke(
new Api.channels.GetAdminLog({
channel: "username",
q: "some string here",
maxId: 0,
minId: 0,
limit: 100,
eventsFilter: new Api.ChannelAdminLogEventsFilter({
join: true,
leave: true,
invite: true,
ban: true,
unban: true,
kick: true,
unkick: true,
promote: true,
demote: true,
info: true,
settings: true,
pinned: true,
groupCall: true,
invites: true,
send: true,
}),
})
);
console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result: Api.channels.AdminLogResults = await client.invoke(
new Api.channels.GetAdminLog({
channel: "username",
q: "some string here",
maxId: 0,
minId: 0,
limit: 100,
eventsFilter: new Api.ChannelAdminLogEventsFilter({
join: true,
leave: true,
invite: true,
ban: true,
unban: true,
kick: true,
unkick: true,
promote: true,
demote: true,
info: true,
settings: true,
pinned: true,
groupCall: true,
invites: true,
send: true,
}),
})
);
console.log(result); // prints the result
})();
Parameters
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
channel | InputChannel | Channel |
q | string | Search query, can be empty |
eventsFilter | flags.0?ChannelAdminLogEventsFilter | Event filter |
admins | flags.1?Vector<InputUser> | Only show events from these admins |
maxId | long | Maximum ID of message to return (see pagination) |
minId | long | Minimum ID of message to return (see pagination) |
limit | int | Maximum number of results to return, see pagination |
Result
Possible errors
Code | Type | Description |
---|---|---|
400 | CHANNEL_INVALID | The provided channel is invalid. |
400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
400 | CHAT_ADMIN_REQUIRED | You must be an admin in this chat to do this. |
403 | CHAT_WRITE_FORBIDDEN | You can't write in this chat. |
400 | MSG_ID_INVALID | Invalid message ID provided. |
Can bots use this method?
No
Related pages
Pagination in the API
How to fetch results from large lists of objects.
Channels, supergroups, gigagroups and basic groups
How to handle channels, supergroups, gigagroups, basic groups, and what's the difference between them.