Class: Chat
Defined in: structures/Chat.ts:25
Fluent chat handle: send without having to repeat the recipient.
Example
const chat = wa.chat('34600112233');
await chat.text('hi!');
await chat.image('./cat.jpg', { caption: 'meow' });
Extended by
Constructors
Constructor
new Chat(
client,id,name?):Chat
Defined in: structures/Chat.ts:26
Parameters
client
id
string
Chat JID.
name?
string
Chat name, if known.
Returns
Chat
Properties
client
protectedreadonlyclient:Client
Defined in: structures/Chat.ts:27
id
readonlyid:string
Defined in: structures/Chat.ts:29
Chat JID.
name?
readonlyoptionalname?:string
Defined in: structures/Chat.ts:31
Chat name, if known.
Accessors
isGroup
Get Signature
get isGroup():
boolean
Defined in: structures/Chat.ts:35
Is it a group?
Returns
boolean
Methods
audio()
audio(
source,options?):Promise<Message>
Defined in: structures/Chat.ts:59
Parameters
source
options?
Returns
Promise<Message>
block()
block():
Promise<void>
Defined in: structures/Chat.ts:100
Blocks this contact.
Returns
Promise<void>
document()
document(
source,options?):Promise<Message>
Defined in: structures/Chat.ts:68
Parameters
source
options?
Returns
Promise<Message>
fromLink()
fromLink(
link,options?):Promise<Message>
Defined in: structures/Chat.ts:77
Sends whatever a link points to, auto-detecting the media kind.
Parameters
link
string
options?
Returns
Promise<Message>
image()
image(
source,options?):Promise<Message>
Defined in: structures/Chat.ts:51
Parameters
source
options?
Returns
Promise<Message>
location()
location(
location,options?):Promise<Message>
Defined in: structures/Chat.ts:72
Parameters
location
options?
MiscMessageGenerationOptions
Returns
Promise<Message>
profilePictureUrl()
profilePictureUrl(
highRes?):Promise<string|undefined>
Defined in: structures/Chat.ts:90
Profile picture URL of this chat/contact.
Parameters
highRes?
boolean = false
Returns
Promise<string | undefined>
send()
send(
content,options?):Promise<Message>
Defined in: structures/Chat.ts:40
Sends raw Baileys content (or text).
Parameters
content
string | AnyMessageContent
options?
MiscMessageGenerationOptions
Returns
Promise<Message>
subscribePresence()
subscribePresence():
Promise<void>
Defined in: structures/Chat.ts:95
Subscribes to this contact's presence updates.
Returns
Promise<void>
text()
text(
body,options?):Promise<Message>
Defined in: structures/Chat.ts:47
Parameters
body
string
options?
Returns
Promise<Message>
typing()
typing():
Promise<() =>Promise<void>>
Defined in: structures/Chat.ts:82
Shows "typing…". Returns a function to stop showing it.
Returns
Promise<() => Promise<void>>
unblock()
unblock():
Promise<void>
Defined in: structures/Chat.ts:105
Unblocks this contact.
Returns
Promise<void>
video()
video(
source,options?):Promise<Message>
Defined in: structures/Chat.ts:55
Parameters
source
options?
Returns
Promise<Message>
voice()
voice(
source,options?):Promise<Message>
Defined in: structures/Chat.ts:64
Voice note (audio with ptt: true).
Parameters
source
options?
MiscMessageGenerationOptions
Returns
Promise<Message>