-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: change say() method response type from void to Message #1866
Conversation
related issue: #1857 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, approved.
@windmemory Please only approve the PR that can be passed the CI tests. It will not be good progress that we approve of the future work before we can make sure the current work can be done without any problem. This PR can not pass the CI before the new version of wechaty-puppet had published the related new features, and the wechaty-puppet is not ready yet. So please only approve this PR after we had everything ready for it. Thank you very much! |
@huan got it |
Let's make the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codeclimate
can be ignored, I'll remove it later.
Please follow my reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check it more strictly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
One more thing: we should update the documentation as well.
Please update both the README.md and the JS Doc, after that, we will be able to merge this PR.
Cheers!
BTW: It would be better if you can remove the code of |
@param {(string | Contact | FileBox | UrlLink | MiniProgram)} something
send text, Contact, or file to contact. </br>
You can use {@link https://www.npmjs.com/package/file-box|FileBox} to send file
@returns {Promise<void | Message>}
import { FileBox } from 'file-box'
const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
const fileBox2 = FileBox.fromFile('/tmp/text.txt')
await contact.say(fileBox1)
const msg1 = await contact.say(fileBox1) // only supported by puppet-padplus
await contact.say(fileBox2)
const msg2 = await contact.say(fileBox2) // only supported by puppet-padplus Should I add JS doc like this way? Or declare @param {(string | Contact | FileBox | UrlLink | MiniProgram)} something
send text, Contact, or file to contact. </br>
You can use {@link https://www.npmjs.com/package/file-box|FileBox} to send file
@returns {Promise<void | Message>} Message type only supported by puppet-padplus.
import { FileBox } from 'file-box'
const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
const fileBox2 = FileBox.fromFile('/tmp/text.txt')
await contact.say(fileBox1)
const msg1 = await contact.say(fileBox1)
await contact.say(fileBox2)
const msg2 = await contact.say(fileBox2) Which way is better? Thanks. |
Please just pick the one which you think is the best. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggested changes.
Looks good to me. |
Thank you very much for the great improvement, Cheers! |
feat: change say() method response type from void to Message (wechaty#1866)
I'm submitting a...
Checklist
Description
please describe the changes that you are making
for features, please describe how to use the new feature
please include a reference to an existing issue, if applicable
Does this PR introduce a breaking change?