Skip to content

Commit f3afb3d

Browse files
committed
Example of FollowRequest outliving event
[ci skip]
1 parent b087d56 commit f3afb3d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/concepts/events.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ bot.onFollow = async (session, followRequest) => {
5555
> or `~FollowRequest.reject()` in the `~Bot.onFollow` event handler,
5656
> and the configured policy is ignored for the specific follow request.
5757
58+
> [!TIP]
59+
> The passed `FollowRequest` object can outlive the event handler if your bot
60+
> is configured the [`followerPolicy`](./bot.md#createbotoptions-followerpolicy)
61+
> option to `"manual"`. The following example shows how to accept a follow
62+
> request after an hour:
63+
>
64+
> ~~~~ typescript {2-4}
65+
> bot.onFollow = async (session, followRequest) => {
66+
> setTimeout(async () => {
67+
> await followRequest.accept();
68+
> }, 1000 * 60 * 60);
69+
> };
70+
> ~~~~
71+
5872
5973
Unfollow
6074
--------

0 commit comments

Comments
 (0)