@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.

1 reply

@botkit I like option B because in my mind a follow accept/reject is an operation that can fail and something you would want to handle. Also, if these are events that can be queued, a follow Request object feels convenient to work with here. Lastly, having used Slack's Bolt framework to build Slack bots, option B feels more the type of thing I would expect.