Skip to main content
Home
This release is a pre-release — the latest non-prerelease version of @fedify/botkit is 0.2.1. Jump to this version

@fedify/botkit@0.3.0-dev.119+a1068dd9
Built and signed on GitHub Actions

A framework for creating ActivityPub bots

This package works with Deno
This package works with Deno
JSR Score
88%
Published
2 weeks ago (0.3.0-dev.119+a1068dd9)
interface Bot

A bot that can interact with the ActivityPub network.

Type Parameters

TContextData

Properties

An internal Fedify federation instance. Normally you don't need to access this directly.

The internal identifier for the bot actor. It is used for the actor URI.

An event handler for a follow request to the bot.

An event handler for an unfollow event from the bot.

An event handler invoked when a follow request the bot sent is accepted.

An event handler invoked when a follow request the bot sent is rejected.

An event handler for a message mentioned to the bot.

An event handler for a reply to the bot.

An event handler for a quote of the bot's message.

An event handler for a message shown to the bot's timeline. To listen to this event, your bot needs to follow others first.

An event handler for a message shared to the bot. To listen to this event, your bot needs to follow others first.

An event handler for a like of a message.

An event handler for an undoing of a like of a message.

An event handler for an emoji reaction to a message.

An event handler for an undoing of an emoji reaction to a message.

An event handler for a vote in a poll. This event is only triggered when the bot is the author of the poll, and the vote is made by another actor. If the poll allows multiple selections, this event is triggered multiple times, once for each option selected by the actor.

Note that this event can be triggered even if the voter vote an option multiple times or multiple options for a poll that disallows multiple selections. You should validate the vote in the event handler by storing the votes in a persistent store, and checking if the vote is valid. (This behavior can subject to change in the future.)

Methods

Gets a new session to control the bot for a specific origin and context data.

Gets a new session to control bot for a specific Fedify context.

fetch(
request: Request,
contextData: TContextData,
): Promise<Response>

The fetch API for handling HTTP requests. You can pass this to an HTTP server (e.g., Deno.serve(), Bun.serve()) to handle incoming requests.

addCustomEmojis<TEmojiName extends string>(emojis: Readonly<Record<TEmojiName, CustomEmoji>>): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>

Defines custom emojis for the bot. The custom emojis are used for rendering the bot's profile and posts. The custom emojis are defined by their names, and the names are used as the keys of the emojis.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/botkit

Import symbol

import { type Bot } from "@fedify/botkit/bot";
or

Import directly with a jsr specifier

import { type Bot } from "jsr:@fedify/botkit/bot";