puppet-xp icon indicating copy to clipboard operation
puppet-xp copied to clipboard

How to send messages to specific contacts?

Open illidan-liu opened this issue 4 years ago • 3 comments

I've learned the examples, but I still don't know how to find the specific contact with the name or nickname, and send the messages.

I suggest to add this code into the examples, thanks.

illidan-liu avatar Nov 18 '21 02:11 illidan-liu

You can follow our official howto guides at http://wechaty.js.org/docs/howto/contact .

To send a message to specific contact, you just need to:

await specificContact.say('the sent message to the specific contact')

huan avatar Nov 18 '21 09:11 huan

@huan Thanks, I found the method.

    let contact = await bot.Contact.find({ name: ContactName })
    let str = 'Test message'
    await contact.say(str) 

BTW, another question, there are lots of the echo messages, how can I mute it?

image

illidan-liu avatar Nov 18 '21 09:11 illidan-liu

Glad to know that you have found the solution!

About the verbose log message, I'd like to suggest that you can inspect the source code and find the lines that print them.

And PR to move those message to our standard log.verbose() method is welcome.

huan avatar Nov 18 '21 10:11 huan