Skip to content
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

Add tutorial for Heartbeat plugin #985

Merged
merged 11 commits into from
Jul 10, 2021

Conversation

sbis04
Copy link
Contributor

@sbis04 sbis04 commented Jun 28, 2021

I have added the tutorial for the Heartbeat plugin. The page contents are as follows:

Heartbeat plugin

Tag #891

@sbis04 sbis04 added GSoD 2021 tutorials Related to tutorial docs labels Jun 28, 2021
@sbis04 sbis04 requested review from a team as code owners June 28, 2021 11:52
@sbis04 sbis04 mentioned this pull request Jun 28, 2021
33 tasks
Copy link
Contributor

@proudofsimin proudofsimin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are so great as always!

Copy link
Member

@lijiarui lijiarui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls change as I request, thanks!


### 1. Create a starter bot

Follow the instructions on the **Starter Bot** page to create the foundation of a Wechaty bot.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks we should add link for *Starter Bot page and then users can refer that part if he don't know how to build a starter bot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll add the link. Currently, the Starter Bot page isn't there on the docs, we have it further down on our proposal timeline. Once, the page is ready we will also update the link here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbis04 Could you file a new issue for this and we can trace this later, then I will ignore this part.

Define a variable called `config` where you can specify:

* `contact`: The contact of the person whom you want to send the emoji (default: **filehelper**)
* `emoji`: Define under `heartbeat`, the emoji to send (default: **爱心**)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change default: **爱心** to [爱心] - Heartbeat emoji

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have updated it.

}
```

For using with **WhatsApp** you can set the contact in the following format:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you try to introduce WhatsApp here, then I suggest you introduce Wechat and WeCom here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I have updated with filehelper, I have removed the reference to WhatsApp.


```ts
const config = {
contact: 'cotact_num@c.us', // contact who will receive the emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this using default contact filehelper

filehelper is suitable for Wechat puppet, cotact_num@c.us is suitable for Whatsapp puppet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbis04 It still show as cotact_num@c.us here, I think we should change to filehelper

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have updated it now


To run the bot, first you have to **export/set** an environment variable with the type of puppet to use, and then start the bot:

#### Linux/macOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should unify the style here, @shwetalsoni did a good job, it looks like this:

image

You can use code like this:

<Tabs
  groupId="operating-systems"
  defaultValue="linux"
  values={[
    { label: 'Linux',   value: 'linux', },
    { label: 'macOS',   value: 'mac', },
    { label: 'Windows', value: 'windows', },
  ]
}>

<TabItem value="linux">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added the tabs

You can apply a similar concept to add the `Heartbeat` plugin to any of your Wechaty bots. You can learn more about this plugin [here](https://github.com/wechaty/wechaty-plugin-contrib#4-heartbeat).

## References

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add video link reference here: https://www.youtube.com/watch?v=tfGZXoe_aA4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added the video link

@lijiarui
Copy link
Member

lijiarui commented Jul 8, 2021

ping @sbis04

@lijiarui
Copy link
Member

lijiarui commented Jul 8, 2021

Pls resolve the conflict @sbis04

@sbis04
Copy link
Contributor Author

sbis04 commented Jul 8, 2021

@lijiarui Have made the CI green.

@sbis04
Copy link
Contributor Author

sbis04 commented Jul 9, 2021

@lijiarui I have made the suggested changes

Copy link
Member

@lijiarui lijiarui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

And also looking forward for you to file a new issue for the pending part.

@lijiarui
Copy link
Member

lijiarui commented Jul 10, 2021

@sbis04 Since the .webp format has lots of advantages and the safari has supported it last year which means all the modern browsers will be able to compatible with it.

@huan has just added a new unit test for enforcing the image format: the CI will not be passed if we are using other image formats than the perfect .webp.

Please make CI green to adjust the new rule, see https://github.com/wechaty/wechaty.js.org/issues/1035

@sbis04
Copy link
Contributor Author

sbis04 commented Jul 10, 2021

@lijiarui I have converted the image to .webp format and made the CI green.

@huan huan merged commit 78b6816 into wechaty:master Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoD 2021 tutorials Related to tutorial docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants