telegramx.js

Chat

class

extends Base<T.Chat>

A chat: private conversation, group, supergroup, or channel.

Declaration

declare class Chat extends Base<T.Chat> 

Properties

firstNameproperty#
get firstName(): string | undefined;
idproperty#
get id(): number;
isForumproperty#
get isForum(): boolean;
isPrivateproperty#
get isPrivate(): boolean;
lastNameproperty#
get lastName(): string | undefined;
titleproperty#
get title(): string | undefined;
typeproperty#
get type(): T.Chat['type'];
usernameproperty#
get username(): string | undefined;

Methods

banMember(userId: number, options?: Without$1<BanChatMemberParams, 'user_id'>): Promise<boolean>;
ParameterType
userIdnumber
options?Without$1<BanChatMemberParams, 'user_id'>
Returns Promise<boolean>

Ban a user from this chat.

fetchMember(userId: number): Promise<ChatMember>;
ParameterType
userIdnumber
Returns Promise<ChatMember>

Fetch a member of this chat.

fetchMemberCount(): Promise<number>;
Returns Promise<number>

Fetch the number of members in this chat.

leavemethod#
leave(): Promise<boolean>;
Returns Promise<boolean>

Leave this chat.

sendmethod#
send(text: string, options?: Without$1<SendMessageParams, 'text'>): Promise<Message>;
ParameterType
textstring
options?Without$1<SendMessageParams, 'text'>
Returns Promise<Message>

Send a text message to this chat.

sendChatAction(action: SendChatActionParams['action'], options?: Without$1<SendChatActionParams, 'action'>): Promise<boolean>;
ParameterType
actionSendChatActionParams['action']
options?Without$1<SendChatActionParams, 'action'>
Returns Promise<boolean>

Tell the user that something is happening on the bot's side (e.g. "typing").

sendDocument(document: SendDocumentParams['document'], options?: Without$1<SendDocumentParams, 'document'>): Promise<Message>;
ParameterType
documentSendDocumentParams['document']
options?Without$1<SendDocumentParams, 'document'>
Returns Promise<Message>

Send a document/file to this chat.

sendPhoto(photo: SendPhotoParams['photo'], options?: Without$1<SendPhotoParams, 'photo'>): Promise<Message>;
ParameterType
photoSendPhotoParams['photo']
options?Without$1<SendPhotoParams, 'photo'>
Returns Promise<Message>

Send a photo to this chat.

toStringmethod#
toString(): string;
Returns string
unbanMember(userId: number, onlyIfBanned?: boolean): Promise<boolean>;
ParameterType
userIdnumber
onlyIfBanned?boolean
Returns Promise<boolean>

Unban a previously banned user.