1 | import { Telegram } from "npm:telegraf@4.11"; |
2 |
|
3 |
|
4 | * @param until_date Unix time. If user is banned for more than |
5 | * 366 days or less than 30 seconds from the current time they |
6 | * are considered to be banned forever. |
7 | * |
8 | * @param revoke_messages If `true` then the banned user's messages |
9 | * will be deleted from the chat. |
10 | */ |
11 | type Telegram = { |
12 | token: string; |
13 | }; |
14 | export async function main( |
15 | auth: Telegram, |
16 | chat_id: string, |
17 | user_id: number, |
18 | until_date?: number, |
19 | revoke_messages?: boolean | undefined, |
20 | ) { |
21 | const client = new Telegram(auth.token); |
22 | return await client.banChatMember(chat_id, user_id, until_date || undefined, { |
23 | revoke_messages, |
24 | }); |
25 | } |
26 |
|