diff --git a/docusaurus/docs/howto/friendship.md b/docusaurus/docs/howto/friendship.mdx similarity index 60% rename from docusaurus/docs/howto/friendship.md rename to docusaurus/docs/howto/friendship.mdx index 923f9171c6d..6c185632b3b 100644 --- a/docusaurus/docs/howto/friendship.md +++ b/docusaurus/docs/howto/friendship.mdx @@ -1,11 +1,32 @@ --- -title: 'Making friends' +title: 'Send and accept friend requests' --- import Tabs from '@theme/Tabs' import TabItem from '@theme/TabItem' -## Sending Request +Sending and accepting friend requests can easily be done using wechaty `onfriendship` function. This guide will help you send request, receive request(in friend event), confirm friendship(friend event) in a room. + +Use the guide to help you integrate additional functions to an existing project which is present at [Github/Friend-Bot](https://github.com/wechaty/wechaty-getting-started/blob/main/examples/advanced/friend-bot.js) or check that your existing local system will run on Wechaty. If, you wish to learn on how to build the bot on your own, please visit one of our [Building the bot](https://wechaty.js.org/docs/getting-started/running-locally) section. + +The steps outlined here mainly focuses on working with Javascript, but user are free to switch between any languages.This guide help you Send, receive friend request, and friend confirmation events. + +## Prerequisites + +* Your system must have [Node.js](https://nodejs.org/en/download/package-manager/) installed (version >= 16). +* Your system must have [Wechaty](https://github.com/wechaty/wechaty) (version >= 0.40). +* You need to be familiar with the basics of Wechaty platform. If not, follow our [tutorials](https://wechaty.js.org/docs/tutorials/) section. +* You need to have at least a minimal application ready to work, follow one of our [Example/ding-dong-bot](https://github.com/wechaty/getting-started/blob/main/examples/ding-dong-bot.js). + +### If you don't know where to start from + +See [Running our first ding-dong bot](https://wechaty.js.org/docs/getting-started/quick-start/#run-ding-dong-bot). + +The below function needs a basic script that can help run the bot. The basic script starts by importing the code from [Github/Friend-Bot](https://github.com/wechaty/wechaty-getting-started/blob/main/examples/advanced/friend-bot.js).Integrate the below code, for this action to work. + +## Send Request - define how to send a friend request + +When you send the request, you try to make new friend connection. This section elaborates on how to send friend requests.`Friendship.search()` helps you search the contact, if found we get "Sending friend request..." as a response else "Friendship.search: not found" as a response. -## Receiving Request +## Receive Request - define how to accept the friend request + +When someone sends you the request, you choose whether to have the friend connection or to reject the connection. This section elaborates on how to accept friend requests. When someone sends you the request, the `friendship.contact()` helps you list down all the contacts with a hello message from `friendship.hello()` and then when the user accepts the request, it prints out with a confirmation message using `friendship.contact().name()`.