diff --git a/packages/core/src/highlevel/client.ts b/packages/core/src/highlevel/client.ts index 4f8950d0..022fd910 100644 --- a/packages/core/src/highlevel/client.ts +++ b/packages/core/src/highlevel/client.ts @@ -1322,6 +1322,8 @@ export interface TelegramClient extends ITelegramClient { /** ID of the user/channel to ban */ participantId: InputPeerLike + untilDate?: number | Date + /** * Whether to dispatch the returned service message (if any) * to the client's update handler. diff --git a/packages/core/src/highlevel/methods/chats/ban-chat-member.ts b/packages/core/src/highlevel/methods/chats/ban-chat-member.ts index 85252af4..d1ddfbc5 100644 --- a/packages/core/src/highlevel/methods/chats/ban-chat-member.ts +++ b/packages/core/src/highlevel/methods/chats/ban-chat-member.ts @@ -1,6 +1,7 @@ import type { ITelegramClient } from '../../client.types.js' import type { InputPeerLike, Message } from '../../types/index.js' import { MtInvalidPeerTypeError } from '../../types/index.js' +import { normalizeDate } from '../../utils/index.js' import { isInputPeerChannel, isInputPeerChat, toInputChannel, toInputUser } from '../../utils/peer-utils.js' import { _findMessageInUpdate } from '../messages/find-in-update.js' import { resolvePeer } from '../users/resolve-peer.js' @@ -24,6 +25,8 @@ export async function banChatMember( /** ID of the user/channel to ban */ participantId: InputPeerLike + untilDate?: number | Date + /** * Whether to dispatch the returned service message (if any) * to the client's update handler. @@ -43,8 +46,7 @@ export async function banChatMember( participant: peer, bannedRights: { _: 'chatBannedRights', - // bans can't be temporary. - untilDate: 0, + untilDate: normalizeDate(params?.untilDate) ?? 0, viewMessages: true, }, })