@botkit@hollo.social

We are designing an API to support manual accept/reject of follow requests in . Which of the below two approaches seems better?

Returning true or false in the onFollow event

bot.onFollow = async (session, follower) => {
  // Accept follows requests from non-bot accounts:
  return follower instanceof Person;
};

Accepting a followRequest object as the third parameter in the onFollow event and calling the accept() or reject() method

bot.onFollow = async (session, follower, followRequest) => {
  // Accept follows requests from non-bot accounts:
  if (follower instanceof Person) await followRequest.accept();
  else await followRequest.reject();
};
  • Returning true or false in the onFollow event5 (63%)
  • Accepting a followRequest object as the third parameter in the onFollow event3 (38%)

botkit.fedify.dev

Events | BotKit by Fedify

BotKit provides a way to handle events that are emitted from the fediverse. Learn how to handle events and what kinds of events are available.

4 shares