Skip to main content
Home
Works with
This package works with Deno
This package works with Deno
JSR Score82%
License
AGPL-3.0-only
Downloads31/wk
Publisheda week ago (0.5.0)

A framework for creating ActivityPub bots

Classes

c
ActorScopedRepository(
repository: Repository,
identifier: string
)

A view of a Repository which is scoped to a single bot actor identifier. It exposes the same operations as Repository without the identifier parameter, which is bound at construction time.

  • addFollowee(
    followeeId: URL,
    follow: Follow
    ): Promise<void>

    Adds a followee to the repository.

  • addFollower(
    followId: URL,
    follower: Actor
    ): Promise<void>

    Adds a follower to the repository.

  • addMessage(
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>

    Adds a message to the repository.

  • addQuoteAuthorization(
    id: Uuid,
    authorization: QuoteAuthorization
    ): Promise<void>

    Adds a quote authorization stamp to the repository.

  • addQuoteAuthorizationReference(
    authorization: URL,
    messageId: Uuid,
    attribution?: URL
    ): Promise<void>

    Adds a received quote authorization reference.

  • addSentFollow(
    id: Uuid,
    follow: Follow
    ): Promise<void>

    Adds a sent follow request to the repository.

  • countFollowers(): Promise<number>

    Counts the number of followers in the repository.

  • countMessages(): Promise<number>

    Counts the number of messages in the repository.

  • countVoters(messageId: Uuid): Promise<number>

    Counts the number of voters in a poll. Even if the poll allows multiple selections, each voter is counted only once.

  • countVotes(messageId: Uuid): Promise<Readonly<Record<string, number>>>

    Counts the votes for each option in a poll.

  • findQuoteAuthorization(interactingObject: URL): Promise<QuoteAuthorization | undefined>

    Finds a quote authorization stamp by the quote post it authorizes.

  • findQuoteAuthorizationReference(authorization: URL): Promise<Uuid | undefined>

    Finds a message by received quote authorization stamp URI.

  • findQuoteAuthorizationReferenceAttribution(authorization: URL): Promise<URL | undefined>

    Finds the actor that issued a received quote authorization stamp.

  • getFollowee(followeeId: URL): Promise<Follow | undefined>

    Gets a followee from the repository.

  • getFollowers(options?: RepositoryGetFollowersOptions): AsyncIterable<Actor>

    Gets followers from the repository.

  • getKeyPairs(): Promise<CryptoKeyPair[] | undefined>

    Gets the key pairs of the bot actor.

  • getMessage(id: Uuid): Promise<Create | Announce | undefined>

    Gets a message from the repository.

  • getMessages(options?: RepositoryGetMessagesOptions): AsyncIterable<Create | Announce>

    Gets messages from the repository.

  • getQuoteAuthorization(id: Uuid): Promise<QuoteAuthorization | undefined>

    Gets a quote authorization stamp from the repository.

  • getSentFollow(id: Uuid): Promise<Follow | undefined>

    Gets a sent follow request from the repository.

  • hasFollower(followerId: URL): Promise<boolean>

    Checks if the repository has a follower.

  • identifier: string

    The identifier of the bot actor this view is scoped to.

  • removeFollowee(followeeId: URL): Promise<Follow | undefined>

    Removes a followee from the repository.

  • removeFollower(
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>

    Removes a follower from the repository.

  • removeMessage(id: Uuid): Promise<Create | Announce | undefined>

    Removes a message from the repository.

  • removeQuoteAuthorization(id: Uuid): Promise<QuoteAuthorization | undefined>

    Removes a quote authorization stamp from the repository.

  • removeQuoteAuthorizationReference(authorization: URL): Promise<void>

    Removes a received quote authorization reference.

  • removeSentFollow(id: Uuid): Promise<Follow | undefined>

    Removes a sent follow request from the repository.

  • repository: Repository

    The underlying repository.

  • setKeyPairs(keyPairs: CryptoKeyPair[]): Promise<void>

    Sets the key pairs of the bot actor.

  • updateMessage(
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>

    Updates a message in the repository.

  • vote(
    messageId: Uuid,
    voterId: URL,
    option: string
    ): Promise<void>

    Records a vote in a poll. If the same voter had already voted for the same option in a poll, the vote will be silently ignored.

c
KvRepository(
kv: KvStore,
options?: KvRepositoryOptions
)

A repository for storing bot data using a key-value store.

  • addFollowee(
    identifier: string,
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    identifier: string,
    followRequestId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    identifier: string,
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addQuoteAuthorization(
    identifier: string,
    id: Uuid,
    authorization: QuoteAuthorization
    ): Promise<void>
    No documentation available
  • addQuoteAuthorizationReference(
    identifier: string,
    authorization: URL,
    messageId: Uuid,
    attribution?: URL
    ): Promise<void>
    No documentation available
  • addSentFollow(
    identifier: string,
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • countFollowers(identifier: string): Promise<number>
    No documentation available
  • countMessages(identifier: string): Promise<number>
    No documentation available
  • countVoters(
    identifier: string,
    messageId: Uuid
    ): Promise<number>
    No documentation available
  • countVotes(
    identifier: string,
    messageId: Uuid
    ): Promise<Readonly<Record<string, number>>>
    No documentation available
  • findFollowedBots(followeeId: URL): AsyncIterable<string>
    No documentation available
  • findQuoteAuthorization(
    identifier: string,
    interactingObject: URL
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • findQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<Uuid | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceAttribution(
    identifier: string,
    authorization: URL
    ): Promise<URL | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceIdentifiers(authorization: URL): AsyncIterable<string>
    No documentation available
  • forIdentifier(identifier: string): ActorScopedRepository
    No documentation available
  • getFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • getFollowers(
    identifier: string,
    options?: RepositoryGetFollowersOptions
    ): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(identifier: string): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(
    identifier: string,
    options?: RepositoryGetMessagesOptions
    ): AsyncIterable<Create | Announce>
    No documentation available
  • getQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • getSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • hasFollower(
    identifier: string,
    followerId: URL
    ): Promise<boolean>
    No documentation available
  • kv: KvStore
    No documentation available
  • migrate(identifier: string): Promise<void>

    Migrates data stored by BotKit 0.4 or earlier, which was not scoped by bot actor identifiers, so that it belongs to the given identifier.

  • nonCasLocks: Map<string, Promise<void>>
    No documentation available
  • prefix: KvKey

    The key prefix under which all BotKit data is stored.

  • removeFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    identifier: string,
    followRequestId: URL,
    actorId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • removeQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • removeQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<void>
    No documentation available
  • removeSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • setKeyPairs(
    identifier: string,
    keyPairs: CryptoKeyPair[]
    ): Promise<void>
    No documentation available
  • updateMessage(
    identifier: string,
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    identifier: string,
    messageId: Uuid,
    voterId: URL,
    option: string
    ): Promise<void>
    No documentation available
c
MemoryCachedRepository(
underlying: Repository,
cache?: MemoryRepository
)

A repository decorator that adds an in-memory cache layer on top of another repository. This is useful for improving performance by reducing the number of accesses to the underlying persistent storage, but it increases memory usage. The cache is not persistent and will be lost when the process exits.

  • addFollowee(
    identifier: string,
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    identifier: string,
    followId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    identifier: string,
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addQuoteAuthorization(
    identifier: string,
    id: Uuid,
    authorization: QuoteAuthorization
    ): Promise<void>
    No documentation available
  • addQuoteAuthorizationReference(
    identifier: string,
    authorization: URL,
    messageId: Uuid,
    attribution?: URL
    ): Promise<void>
    No documentation available
  • addSentFollow(
    identifier: string,
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • cache: MemoryRepository
    No documentation available
  • countFollowers(identifier: string): Promise<number>
    No documentation available
  • countMessages(identifier: string): Promise<number>
    No documentation available
  • countVoters(
    identifier: string,
    messageId: Uuid
    ): Promise<number>
    No documentation available
  • countVotes(
    identifier: string,
    messageId: Uuid
    ): Promise<Readonly<Record<string, number>>>
    No documentation available
  • findFollowedBots(followeeId: URL): AsyncIterable<string>
    No documentation available
  • findQuoteAuthorization(
    identifier: string,
    interactingObject: URL
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • findQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<Uuid | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceAttribution(
    identifier: string,
    authorization: URL
    ): Promise<URL | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceIdentifiers(authorization: URL): AsyncIterable<string>
    No documentation available
  • forIdentifier(identifier: string): ActorScopedRepository
    No documentation available
  • getFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • getFollowers(
    identifier: string,
    options?: RepositoryGetFollowersOptions
    ): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(identifier: string): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(
    identifier: string,
    options?: RepositoryGetMessagesOptions
    ): AsyncIterable<Create | Announce>
    No documentation available
  • getQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • getSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • hasFollower(
    identifier: string,
    followerId: URL
    ): Promise<boolean>
    No documentation available
  • migrate(identifier: string): Promise<void>

    Migrates data stored by BotKit 0.4 or earlier in the underlying repository, so that it belongs to the given identifier. The cache is not involved: it starts empty and only ever holds values read after the migration.

  • removeFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    identifier: string,
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • removeQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • removeQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<void>
    No documentation available
  • removeSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • setKeyPairs(
    identifier: string,
    keyPairs: CryptoKeyPair[]
    ): Promise<void>
    No documentation available
  • underlying: Repository
    No documentation available
  • updateMessage(
    identifier: string,
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    identifier: string,
    messageId: Uuid,
    voterId: URL,
    option: string
    ): Promise<void>
    No documentation available
c

A repository for storing bot data in memory. This repository is not persistent and is only suitable for testing or development.

  • addFollowee(
    identifier: string,
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    identifier: string,
    followId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    identifier: string,
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addQuoteAuthorization(
    identifier: string,
    id: Uuid,
    authorization: QuoteAuthorization
    ): Promise<void>
    No documentation available
  • addQuoteAuthorizationReference(
    identifier: string,
    authorization: URL,
    messageId: Uuid,
    attribution?: URL
    ): Promise<void>
    No documentation available
  • addSentFollow(
    identifier: string,
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • countFollowers(identifier: string): Promise<number>
    No documentation available
  • countMessages(identifier: string): Promise<number>
    No documentation available
  • countVoters(
    identifier: string,
    messageId: Uuid
    ): Promise<number>
    No documentation available
  • countVotes(
    identifier: string,
    messageId: Uuid
    ): Promise<Readonly<Record<string, number>>>
    No documentation available
  • findFollowedBots(followeeId: URL): AsyncIterable<string>
    No documentation available
  • findQuoteAuthorization(
    identifier: string,
    interactingObject: URL
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • findQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<Uuid | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceAttribution(
    identifier: string,
    authorization: URL
    ): Promise<URL | undefined>
    No documentation available
  • findQuoteAuthorizationReferenceIdentifiers(authorization: URL): AsyncIterable<string>
    No documentation available
  • forIdentifier(identifier: string): ActorScopedRepository
    No documentation available
  • getFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • getFollowers(
    identifier: string,
    options?: RepositoryGetFollowersOptions
    ): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(identifier: string): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(
    identifier: string,
    options?: RepositoryGetMessagesOptions
    ): AsyncIterable<Create | Announce>
    No documentation available
  • getQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • getSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • hasFollower(
    identifier: string,
    followerId: URL
    ): Promise<boolean>
    No documentation available
  • removeFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    identifier: string,
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>
    No documentation available
  • removeQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>
    No documentation available
  • removeQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<void>
    No documentation available
  • removeSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>
    No documentation available
  • setKeyPairs(
    identifier: string,
    keyPairs: CryptoKeyPair[]
    ): Promise<void>
    No documentation available
  • updateMessage(
    identifier: string,
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    identifier: string,
    messageId: Uuid,
    voterId: URL,
    option: string
    ): Promise<void>
    No documentation available

Functions

f
createBot<TContextData = void>(options: CreateBotOptions<TContextData>): TContextData extends void ? BotWithVoidContextData : Bot<TContextData>

Creates a Bot instance.

f
createInstance<TContextData = void>(options: CreateInstanceOptions): TContextData extends void ? InstanceWithVoidContextData : Instance<TContextData>

Creates an Instance that can host multiple bots sharing the same infrastructure.

f
customEmoji<TContextData>(emoji: Emoji | DeferredCustomEmoji<TContextData>): Text<"inline", TContextData>

Renders a custom emoji. You can use this function to create a CustomEmojiText tree.

f
em<TContextData>(text: Text<"inline", TContextData> | string): Text<"inline", TContextData>

Applies <em> tag to a text. You can use this function to create an EmText tree.

f
emoji(
strings: TemplateStringsArray,
...values: unknown[]
): Emoji

A tagged template literal function that creates an Emoji from a string. It is a simple wrapper around the String.raw function, but it also checks if the resulting string is a valid emoji.

f
hashtag<TContextData>(tag: string): Text<"inline", TContextData>

Creates a hashtag. You can use this function to create a HashtagText tree.

f
isEmoji(value: unknown): value is Emoji

A type guard that checks if a value is a single emoji character.

f
mention<TContextData>(
a: string | Actor | URL,
b?: Actor | URL
): Text<"inline", TContextData>
3 overloads

Mentions an actor by its fediverse handle. You can use this function to create a MentionText tree. The label of the mention will be the same as the handle.

f
mention<TContextData>(
a: string | Actor | URL,
b?: Actor | URL
): Text<"inline", TContextData>
3 overloads

Mentions an actor by its fediverse handle. You can use this function to create a MentionText tree. The label of the mention will be the same as the handle.

f
mention<TContextData>(
a: string | Actor | URL,
b?: Actor | URL
): Text<"inline", TContextData>
3 overloads

Mentions an actor by its fediverse handle. You can use this function to create a MentionText tree. The label of the mention will be the same as the handle.

f
mention<TContextData>(
a: string | Actor | URL,
b?: Actor | URL
): Text<"inline", TContextData>
3 overloads

Mentions an actor by its fediverse handle. You can use this function to create a MentionText tree. The label of the mention will be the same as the handle.

f
normalizeQuotePolicy(policy?: QuotePolicyOption): QuotePolicy

Normalizes a quote policy option into the two-axis form.

f
plainText<TContextData>(text: string): Text<"inline", TContextData>

A function that creates a PlainText tree. It only does two simple things:

f
strong<TContextData>(text: Text<"inline", TContextData> | string): Text<"inline", TContextData>

Applies <strong> tag to a text. You can use this function to create a StrongText tree.

f
text<TContextData>(
strings: TemplateStringsArray,
...values: unknown[]
): Text<"block", TContextData>

A template string tag that creates a Text tree.

Interfaces

I

An authorized like of a message. Usually it is a like that the bot itself made.

  • unlike(): Promise<void>

    Undoes the like.

I

An authorized message in the ActivityPub network. Usually it is a message published by the bot itself.

  • delete(): Promise<void>

    Deletes the message, if possible.

  • quoteApprovalState: "pending" | "accepted" | "notRequired"

    The approval state for this message's quote target. It is only present when this message quotes another message.

  • unauthorizeQuote(quote: Message<MessageClass, TContextData> | URL): Promise<void>

    Revokes the authorization stamp issued to a quote of this message.

  • update(
    text: Text<"block", TContextData>,
    options?: AuthorizedMessageUpdateOptions
    ): Promise<void>

    Updates the message with new content.

I

Options for updating an authorized message.

  • quotePolicy: QuotePolicyOption

    Who can quote the updated message.

I

An authorized emoji reaction to a message. Usually it is a reaction that the bot itself made.

  • unreact(): Promise<void>

    Undoes the reaction.

I

An authorized shared message in the ActivityPub network. Usually it is a message shared by the bot itself.

  • unshare(): Promise<void>

    Undoes the shared message.

I

A bot that can interact with the ActivityPub network.

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

  • federation: Federation<TContextData>

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

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

  • getSession(
    origin: string | URL,
    contextData: TContextData
    ): Session<TContextData>

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

  • identifier: string

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

I

The event handlers a bot can register. Assigning a handler to one of these properties makes the bot react to the corresponding ActivityPub activity.

  • onAcceptFollow: AcceptEventHandler<TContextData>

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

  • onFollow: FollowEventHandler<TContextData>

    An event handler for a follow request to the bot.

  • onLike: LikeEventHandler<TContextData>

    An event handler for a like of a message.

  • onMention: MentionEventHandler<TContextData>

    An event handler for a message mentioned to the bot.

  • onMessage: MessageEventHandler<TContextData>

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

  • onQuote: QuoteEventHandler<TContextData>

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

  • onQuoteAccepted: QuoteAcceptedEventHandler<TContextData>

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

  • onQuoteRejected: QuoteRejectedEventHandler<TContextData>

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

  • onQuoteRequest: QuoteRequestEventHandler<TContextData>

    An event handler for a quote request to the bot.

  • onQuoteRevoked: QuoteRevokedEventHandler<TContextData>

    An event handler invoked when a quote authorization for the bot's quote post is revoked.

  • onReact: ReactionEventHandler<TContextData>

    An event handler for an emoji reaction to a message.

  • onRejectFollow: RejectEventHandler<TContextData>

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

  • onReply: ReplyEventHandler<TContextData>

    An event handler for a reply to the bot.

  • onSharedMessage: SharedMessageEventHandler<TContextData>

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

  • onUnfollow: UnfollowEventHandler<TContextData>

    An event handler for an unfollow event from the bot.

  • onUnlike: UnlikeEventHandler<TContextData>

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

  • onUnreact: UndoneReactionEventHandler<TContextData>

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

  • onVote: VoteEventHandler<TContextData>

    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.

I

A group of dynamically hosted bots sharing the same event handlers. A group is created by passing a BotDispatcher to Instance.createBot; the dispatcher resolves individual bots on demand, and the handlers registered on the group are invoked for every bot it resolves. Handlers can tell which bot they are running as through Session.bot.

  • getSession(
    origin: string | URL,
    identifier: string,
    contextData: TContextData
    ): Promise<Session<TContextData>>

    Gets a new session to control one of the group's bots for a specific origin and context data.

I

The profile of a bot actor hosted on an Instance. It configures everything about a bot except its identifier and the shared infrastructure, which belong to the instance.

  • class: Service | Application

    The type of the bot actor. It should be either Service or Application.

  • followerPolicy: "accept" | "reject" | "manual"

    How to handle incoming follow requests. Note that this behavior can be overridden by manually invoking FollowRequest.accept or FollowRequest.reject in the BotEventHandlers.onFollow event handler.

  • icon: URL | Image

    The avatar URL of the bot. It can be changed after the bot is federated.

  • image: URL | Image

    The header image URL of the bot. It can be changed after the bot is federated.

  • name: string

    The display name of the bot. It can be changed after the bot is federated.

  • properties: Record<string, Text<"block" | "inline", TContextData>>

    The custom properties of the bot. It can be changed after the bot is federated.

  • quotePolicy: QuotePolicyOption

    Who can quote messages published by the bot.

  • summary: Text<"block", TContextData>

    The description of the bot. It can be changed after the bot is federated.

  • username: string

    The username of the bot. It will be a part of the fediverse handle. It can be changed after the bot is federated.

I

A specialized Bot tpe that doesn't require context data.

  • fetch(request: Request): 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.

  • getSession(
    origin: string | URL,
    contextData: void
    ): Session<void>

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

I

Options for creating a dynamic BotGroup.

  • mapUsername(
    ctx: Context<TContextData>,
    username: string
    ): string | null | Promise<string | null>

    Maps a WebFinger username to the identifier of a bot the group's dispatcher can resolve. If omitted, usernames are assumed to equal identifiers.

I

Options for creating a bot.

  • behindProxy: boolean

    Whether to trust X-Forwarded-* headers. If your bot application is behind an L7 reverse proxy, turn it on.

  • class: Service | Application

    The type of the bot actor. It should be either Service or Application.

  • followerPolicy: "accept" | "reject" | "manual"

    How to handle incoming follow requests. Note that this behavior can be overridden by manually invoking FollowRequest.accept or FollowRequest.reject in the Bot.onFollow event handler.

  • icon: URL | Image

    The avatar URL of the bot. It can be changed after the bot is federated.

  • identifier: string

    The internal identifier of the bot. Since it is used for the actor URI, it should not be changed after the bot is federated.

  • image: URL | Image

    The header image URL of the bot. It can be changed after the bot is federated.

  • kv: KvStore

    The underlying key-value store to use for storing data.

  • name: string

    The display name of the bot. It can be changed after the bot is federated.

  • pages: PagesOptions

    The options for the web pages of the bot. If omitted, the default options will be used.

  • properties: Record<string, Text<"block" | "inline", TContextData>>

    The custom properties of the bot. It can be changed after the bot is federated.

  • queue: MessageQueue

    The underlying message queue to use for handling incoming and outgoing activities. If omitted, incoming activities are processed immediately, and outgoing activities are sent immediately.

  • quotePolicy: QuotePolicyOption

    Who can quote messages published by the bot.

  • repository: Repository

    The underlying repository to use for storing data. If omitted, KvRepository will be used.

  • software: Software

    The software information of the bot. If omitted, the NodeInfo protocol will be unimplemented.

  • summary: Text<"block", TContextData>

    The description of the bot. It can be changed after the bot is federated.

  • username: string

    The username of the bot. It will be a part of the fediverse handle. It can be changed after the bot is federated.

I

Options for creating an Instance.

  • behindProxy: boolean

    Whether to trust X-Forwarded-* headers. If your instance is behind an L7 reverse proxy, turn it on.

  • The identifier of the instance actor: an internal Application actor the instance uses for signing shared-inbox related requests. Override it when the default identifier collides with a bot you want to host. Since it is used for the actor URI, it should not be changed after the instance is federated.

  • kv: KvStore

    The underlying key–value store to use for storing data.

  • legacyObjectUris: { readonly identifier: string; }

    Configures the recognition of local object URIs in the legacy (pre-0.5) format, which did not carry the owning bot actor identifier. Set this when the instance hosts a bot that was deployed with BotKit 0.4 or earlier, so that object URIs stored by remote servers keep working.

  • pages: PagesOptions

    The options for the web pages of the instance. If omitted, the default options will be used.

  • queue: MessageQueue

    The underlying message queue to use for handling incoming and outgoing activities. If omitted, incoming activities are processed immediately, and outgoing activities are sent immediately.

  • repository: Repository

    The repository to use for storing bot data. A single repository stores the data of every bot hosted on the instance, scoped by their identifiers. If omitted, a KvRepository backed by kv will be used.

  • software: Software

    The software information of the instance. If omitted, the NodeInfo protocol will be unimplemented.

I

A follow request to the bot.

  • accept(): Promise<void>

    Accepts the follow request.

  • follower: Actor

    The follower actor.

  • id: URL

    The URI of the follow request.

  • raw: Follow

    The raw follow request object.

  • reject(): Promise<void>

    Rejects the follow request.

  • state: "pending" | "accepted" | "rejected"

    The state of the follow request.

I

A server instance that can host multiple bots. An instance owns the shared infrastructure—the key–value store, the message queue, the repository, and HTTP handling—while each bot hosted on it has its own actor identity and event handlers.

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

    Defines custom emojis for the instance. The custom emojis are shared by all bots hosted on the instance and are used for rendering their profiles and posts.

  • createBot(
    identifier: string,
    profile: BotProfile<TContextData>
    ): Bot<TContextData>

    Creates a bot with a fixed identifier and profile, hosted on this instance.

  • federation: Federation<TContextData>

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

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

I

A specialized Instance type that doesn't require context data.

  • fetch(request: Request): 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.

I

Options for creating a KvRepository.

  • prefix: KvKey

    The key prefix under which all BotKit data is stored. Data belonging to a bot actor is stored under [...prefix, "bots", identifier, ...], and instance-wide indices are stored under [...prefix, "index", ...].

I

A like of a message. It is a thin wrapper around a Like, which is a Fedify object.

  • actor: Actor

    The actor who liked the message.

  • id: URL

    The URI of the like activity.

  • message: Message<MessageClass, TContextData>

    The message that was liked.

  • raw: RawLike

    The underlying raw Like activity.

I

A message in the ActivityPub network. It is a thin wrapper around a Fedify object: an Article, a ChatMessage, a Note, or a Question.

  • actor: Actor

    The actor who published the message.

  • attachments: readonly Document[]

    The media attachments of the message.

  • hashtags: readonly Hashtag[]

    The hashtags used in the message.

  • html: string

    The HTML content of the message.

  • id: URL

    The URI of the message.

  • language: Intl.Locale

    The language of the message if the content is tagged with a language.

  • like(): Promise<AuthorizedLike<TContextData>>

    Likes the message.

  • mentions: readonly Actor[]

    The actors mentioned in the message.

  • published: Temporal.Instant

    The published time of the message.

  • quoteApproved: boolean

    Whether this message's quote target has been approved according to FEP-044f. It is undefined when this message is not a quote.

  • quotePolicy: QuotePolicy

    The quote policy advertised by this message, if present.

  • quoteTarget: Message<MessageClass, TContextData>

    The message quoted by this message, if any.

  • raw: T

    The underlying raw message object.

  • react(emoji: Emoji | CustomEmoji | DeferredCustomEmoji<TContextData>): Promise<AuthorizedReaction<TContextData>>

    Reacts to the message with a Unicode emoji or a custom emoji.

  • reply(
    text: Text<"block", TContextData>,
    options?: SessionPublishOptions<TContextData>
    ): Promise<AuthorizedMessage<Note, TContextData>>

    Publishes a reply to the message.

  • replyTarget: Message<MessageClass, TContextData>

    The original message in reply to, if the message is a reply.

  • share(options?: MessageShareOptions): Promise<AuthorizedSharedMessage<T, TContextData>>

    Shares the message.

  • text: string

    The plain text content of the message.

  • updated: Temporal.Instant

    The updated time of the message, if it is updated.

  • visibility: MessageVisibility

    The visibility of the message.

I

Options for sharing a message.

  • visibility: Exclude<MessageVisibility, "direct" | "unknown">

    The visibility of the shared message. If omitted, the visibility of the original message will be used.

I

Options for the web pages of the bot.

  • color:
    "amber"
    | "azure"
    | "blue"
    | "cyan"
    | "fuchsia"
    | "green"
    | "grey"
    | "indigo"
    | "jade"
    | "lime"
    | "orange"
    | "pink"
    | "pumpkin"
    | "purple"
    | "red"
    | "sand"
    | "slate"
    | "violet"
    | "yellow"
    | "zinc"

    The color of the theme. It will be used for the theme color of the web pages. The default color is "green".

  • css: string

    The CSS code for the bot. It will be used for the custom CSS of the web pages.

  • theme: "auto" | "light" | "dark"

    The color scheme of the web pages. "auto" follows the visitor's operating system preference, while "light" and "dark" force a fixed scheme. The default is "auto".

I

An interface representing a poll.

  • endTime: Temporal.Instant

    The time when the poll ends.

  • multiple: boolean

    Whether the poll allows multiple selections.

  • options: readonly string[]

    The options of the poll. Each option is a string. Every option must be unique, and must not be empty.

I

A quote policy for messages published by the bot.

  • automatic: QuoteAcceptance

    The audience whose quote requests are accepted automatically.

  • manual: QuoteAcceptance

    The audience whose quote requests wait for manual approval.

I

A quote request to the bot.

  • accept(signal?: AbortSignal): Promise<void>

    Accepts the quote request.

  • actor: Actor

    The actor requesting quote authorization.

  • id: URL

    The URI of the quote request.

  • quote: Message<MessageClass, TContextData>

    The message that quotes the bot's message.

  • raw: RawQuoteRequest

    The raw quote request object.

  • reject(signal?: AbortSignal): Promise<void>

    Rejects the quote request.

  • state: "pending" | "accepted" | "rejected"

    The state of the quote request.

  • target: AuthorizedMessage<MessageClass, TContextData>

    The bot's message being quoted.

I

An emoji reaction to a message. It is a thin wrapper around an EmojiReact, which is a Fedify object.

  • actor: Actor

    The actor who reacted to the message.

  • emoji: Emoji | CustomEmoji

    The emoji that was used in the reaction. It can be either a Unicode emoji or a custom emoji.

  • id: URL

    The URI of the reaction activity.

  • message: Message<MessageClass, TContextData>

    The message that was reacted.

  • raw: RawLike | EmojiReact

    The underlying raw Like or EmojiReact activity.

I

A read-only view of a bot actor's identity and profile. It is exposed through Session.bot so that event handlers can tell which bot they are running as without being able to mutate the bot (e.g. reassign its event handlers).

  • class: Service | Application

    The type of the bot actor. It is either Service or Application.

  • followerPolicy: "accept" | "reject" | "manual"

    How the bot handles incoming follow requests.

  • icon: URL | Image

    The avatar URL of the bot.

  • identifier: string

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

  • image: URL | Image

    The header image URL of the bot.

  • name: string

    The display name of the bot.

  • quotePolicy: QuotePolicyOption

    How the bot handles incoming quote requests for its messages.

  • username: string

    The username of the bot. It is a part of the fediverse handle.

I

A repository for storing bot data.

  • addFollowee(
    identifier: string,
    followeeId: URL,
    follow: Follow
    ): Promise<void>

    Adds a followee to the repository.

  • addFollower(
    identifier: string,
    followId: URL,
    follower: Actor
    ): Promise<void>

    Adds a follower to the repository.

  • addMessage(
    identifier: string,
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>

    Adds a message to the repository.

  • addQuoteAuthorization(
    identifier: string,
    id: Uuid,
    authorization: QuoteAuthorization
    ): Promise<void>

    Adds a quote authorization stamp to the repository.

  • addQuoteAuthorizationReference(
    identifier: string,
    authorization: URL,
    messageId: Uuid,
    attribution?: URL
    ): Promise<void>

    Adds a reference to a quote authorization stamp received for one of the bot's own quote posts.

  • addSentFollow(
    identifier: string,
    id: Uuid,
    follow: Follow
    ): Promise<void>

    Adds a sent follow request to the repository.

  • countFollowers(identifier: string): Promise<number>

    Counts the number of followers in the repository.

  • countMessages(identifier: string): Promise<number>

    Counts the number of messages in the repository.

  • countVoters(
    identifier: string,
    messageId: Uuid
    ): Promise<number>

    Counts the number of voters in a poll. Even if the poll allows multiple selections, each voter is counted only once.

  • countVotes(
    identifier: string,
    messageId: Uuid
    ): Promise<Readonly<Record<string, number>>>

    Counts the votes for each option in a poll. If the poll allows multiple selections, each option is counted separately, and the same voter can vote for multiple options.

  • findFollowedBots(followeeId: URL): AsyncIterable<string>

    Finds the identifiers of the bot actors that follow the given actor. This is the reverse lookup of Repository.getFollowee: it answers the question “which bots on this instance follow this remote actor?”, which is used for routing incoming activities from followed actors to the right bots.

  • findQuoteAuthorization(
    identifier: string,
    interactingObject: URL
    ): Promise<QuoteAuthorization | undefined>

    Finds a quote authorization stamp by the quote post it authorizes.

  • findQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<Uuid | undefined>

    Finds the bot's quote message that depends on a received quote authorization stamp.

  • findQuoteAuthorizationReferenceAttribution(
    identifier: string,
    authorization: URL
    ): Promise<URL | undefined>

    Finds the actor that issued a received quote authorization stamp.

  • findQuoteAuthorizationReferenceIdentifiers(authorization: URL): AsyncIterable<string>

    Finds bot identifiers whose quote messages depend on a received quote authorization stamp.

  • forIdentifier(identifier: string): ActorScopedRepository

    Returns a view of this repository which is scoped to the given bot actor identifier. The returned view exposes the same operations without the identifier parameter.

  • getFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>

    Gets a followee from the repository.

  • getFollowers(
    identifier: string,
    options?: RepositoryGetFollowersOptions
    ): AsyncIterable<Actor>

    Gets followers from the repository.

  • getKeyPairs(identifier: string): Promise<CryptoKeyPair[] | undefined>

    Gets the key pairs of a bot actor.

  • getMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>

    Gets a message from the repository.

  • getMessages(
    identifier: string,
    options?: RepositoryGetMessagesOptions
    ): AsyncIterable<Create | Announce>

    Gets messages from the repository.

  • getQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>

    Gets a quote authorization stamp from the repository.

  • getSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>

    Gets a sent follow request from the repository.

  • hasFollower(
    identifier: string,
    followerId: URL
    ): Promise<boolean>

    Checks if the repository has a follower.

  • migrate(identifier: string): Promise<void>

    Migrates data stored by BotKit 0.4 or earlier, which was not scoped by bot actor identifiers, so that it belongs to the given identifier. Implementations should make this operation idempotent: calling it again after a successful migration should be a no-op.

  • removeFollowee(
    identifier: string,
    followeeId: URL
    ): Promise<Follow | undefined>

    Removes a followee from the repository.

  • removeFollower(
    identifier: string,
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>

    Removes a follower from the repository.

  • removeMessage(
    identifier: string,
    id: Uuid
    ): Promise<Create | Announce | undefined>

    Removes a message from the repository.

  • removeQuoteAuthorization(
    identifier: string,
    id: Uuid
    ): Promise<QuoteAuthorization | undefined>

    Removes a quote authorization stamp from the repository.

  • removeQuoteAuthorizationReference(
    identifier: string,
    authorization: URL
    ): Promise<void>

    Removes the reference to a received quote authorization stamp.

  • removeSentFollow(
    identifier: string,
    id: Uuid
    ): Promise<Follow | undefined>

    Removes a sent follow request from the repository.

  • setKeyPairs(
    identifier: string,
    keyPairs: CryptoKeyPair[]
    ): Promise<void>

    Sets the key pairs of a bot actor.

  • updateMessage(
    identifier: string,
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>

    Updates a message in the repository.

  • vote(
    identifier: string,
    messageId: Uuid,
    voterId: URL,
    option: string
    ): Promise<void>

    Records a vote in a poll. If the same voter had already voted for the same option in a poll, the vote will be silently ignored.

I

A session to control the bot.

  • actorHandle: `@${string}@${string}`

    The fediverse handle of the bot actor. It starts with @.

  • actorId: URL

    The URI of the bot actor.

  • bot: ReadonlyBot

    A read-only view of the bot to which the session belongs. It exposes the bot's identity and profile (e.g. identifier, username, name) without allowing event handlers to be reassigned through it.

  • context: Context<TContextData>

    The Fedify context of the session.

  • follow(actor: Actor | URL | string): Promise<void>

    Send a follow request to the specified actor.

  • follows(actor: Actor | URL | string): Promise<boolean>

    Checks whether the bot is following the specified actor.

  • getActor(): Promise<Actor>

    Gets the Actor object of the bot.

  • getOutbox(options?: SessionGetOutboxOptions): AsyncIterable<AuthorizedMessage<MessageClass, TContextData>>

    Gets messages from the bot's outbox.

  • publish(
    content: Text<"block", TContextData>,
    options?: SessionPublishOptions<TContextData>
    ): Promise<AuthorizedMessage<Note, TContextData>>

    Publishes a message attributed to the bot.

  • republishProfile(): Promise<void>

    Republishes the bot profile to its followers.

  • unfollow(actor: Actor | URL | string): Promise<void>

    Unfollow the specified actor.

I

Options for getting messages from the bot's outbox.

  • limit: number

    The maximum number of messages to get. If omitted, no limit will be applied.

  • order: "oldest" | "newest"

    The order of the messages. If omitted, "newest" will be used.

  • since: Temporal.Instant

    The timestamp to get messages created at or after this time. If omitted, no limit will be applied.

  • until: Temporal.Instant

    The timestamp to get messages created at or before this time. If omitted, no limit will be applied.

I

Options for publishing a message.

  • attachments: Document[]

    The media attachments of the published message.

  • language: string | Intl.Locale

    The language of the published message.

  • quotePolicy: QuotePolicyOption

    Who can quote the published message.

  • quoteTarget: Message<MessageClass, TContextData>

    The message to quote in the published message.

  • visibility: Exclude<MessageVisibility, "unknown">

    The visibility of the published message. If omitted, "public" will be used.

I

Options for publishing a message with a specific class.

  • class: T extends Article ? Article : T extends ChatMessage ? ChatMessage : T extends Note ? Note : T extends Question ? Question : never

    The class of the published message. If omitted, Note will be used.

I

A shared message in the ActivityPub network. It is a thin wrapper around an Announce, which is a Fedify object.

  • actor: Actor

    The actor who shared the message.

  • id: URL

    The URI of the shared message.

  • original: Message<T, TContextData>

    The original message.

  • raw: Announce

    The underlying raw shared message object.

  • visibility: MessageVisibility

    The visibility of the shared message.

I

A tree structure representing a text with formatting. It does not only render the text but also extract tags (e.g., mentions) from it.

  • getCachedObjects(): Object[]

    Gets cached objects. The result of this method depends on whether getHtml or getTags has been called before. It's used for optimizing the post rendering process, e.g., reusing once fetched remote objects.

  • getHtml(session: Session<TContextData>): AsyncIterable<string>

    Render a text tree as HTML.

  • getTags(session: Session<TContextData>): AsyncIterable<Link | Object>

    Extract tags (e.g., mentions) from a text tree.

  • type: TType

    The type of the text. It can be either "block" or "inline".

I

An interface representing a vote in a poll. Note that if the poll allows multiple selections, the options are represented as multiple Vote objects, each with a single option.

  • actor: Actor

    The actor who voted.

  • message: Message<Question, TContextData>

    The question to which the poll belongs.

  • option: string

    The options selected by the actor. Note that this is a string even if the poll allows multiple selections. If the poll allows multiple selections, the options are represented as multiple Vote objects.

  • poll: Poll

    The poll to which the vote belongs.

  • raw: Note

    The underlying raw note object.

Type Aliases

T
AcceptEventHandler<TContextData> = (
session: Session<TContextData>,
accepter: Actor
) => void | Promise<void>

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

T
BotDispatcher<TContextData> = (
ctx: Context<TContextData>,
identifier: string
) =>
BotProfile<TContextData>
| null
| Promise<BotProfile<TContextData> | null>

A function that resolves the profile of a dynamically hosted bot from its identifier. It is invoked whenever an identifier needs to be resolved, e.g. for dispatching an actor or routing an incoming activity, so it should be fast; look profiles up from a database rather than computing them expensively.

T
CustomEmoji = CustomEmojiFromUrl | CustomEmojiFromFile

A definition of a custom emoji. It can be either a remote image URL or a local image file.

T
DeferredCustomEmoji<TContextData> = (session: Session<TContextData>) => EmojiObject

A deferred Emoji (provided by Fedify), which is a function that takes a Session and returns an Emoji. This is useful for creating emojis that depend on the session data.

T
Emoji = string & { readonly __emoji: unique symbol; }

A branded type for a single emoji character (more exactly, a single Unicode grapheme cluster of emoji). This is used to represent a single emoji in a string format. It is not a full-fledged emoji object, but rather a string that is guaranteed to be a single emoji.

T
FollowEventHandler<TContextData> = (
session: Session<TContextData>,
followRequest: FollowRequest
) => void | Promise<void>

An event handler for a follow request to the bot.

T
LikeEventHandler<TContextData> = (
session: Session<TContextData>,
like: Like<TContextData>
) => void | Promise<void>

An event handler for a like of a message.

T
MentionEventHandler<TContextData> = (
session: Session<TContextData>,
message: Message<MessageClass, TContextData>
) => void | Promise<void>

An event handler for a message mentioned to the bot.

T
MessageClass = Article | ChatMessage | Note | Question

A possible message class.

T
MessageEventHandler<TContextData> = (
session: Session<TContextData>,
message: Message<MessageClass, TContextData>
) => void | Promise<void>

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

T
MessageVisibility = "public" | "unlisted" | "followers" | "direct" | "unknown"

The visibility of a message.

T
QuoteAcceptance = "public" | "followers" | "nobody"

The audience whose quote requests can be approved.

T
QuoteAcceptedEventHandler<TContextData> = (
session: Session<TContextData>,
message: AuthorizedMessage<MessageClass, TContextData>,
approver: Actor
) => void | Promise<void>

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

T
QuoteEventHandler<TContextData> = (
session: Session<TContextData>,
quote: Message<MessageClass, TContextData>
) => void | Promise<void>

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

T
QuotePolicyOption = QuoteAcceptance | "manual" | QuotePolicy

A shorthand or full quote policy.

T
QuoteRejectedEventHandler<TContextData> = (
session: Session<TContextData>,
message: AuthorizedMessage<MessageClass, TContextData>,
rejecter: Actor
) => void | Promise<void>

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

T
QuoteRequestEventHandler<TContextData> = (
session: Session<TContextData>,
quoteRequest: QuoteRequest<TContextData>
) => void | Promise<void>

An event handler for a quote request to the bot.

T
QuoteRevokedEventHandler<TContextData> = (
session: Session<TContextData>,
message: AuthorizedMessage<MessageClass, TContextData>,
revoker: Actor
) => void | Promise<void>

An event handler invoked when an authorization stamp for the bot's quote post is revoked.

T
ReactionEventHandler<TContextData> = (
session: Session<TContextData>,
reaction: Reaction<TContextData>
) => void | Promise<void>

An event handler for an emoji reaction to a message.

T
RejectEventHandler<TContextData> = (
session: Session<TContextData>,
rejecter: Actor
) => void | Promise<void>

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

T
ReplyEventHandler<TContextData> = (
session: Session<TContextData>,
reply: Message<MessageClass, TContextData>
) => void | Promise<void>

An event handler for a reply to the bot.

T
SharedMessageEventHandler<TContextData> = (
session: Session<TContextData>,
message: SharedMessage<MessageClass, TContextData>
) => void | Promise<void>

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

T
UndoneReactionEventHandler<TContextData> = (
session: Session<TContextData>,
reaction: Reaction<TContextData>
) => void | Promise<void>

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

T
UnfollowEventHandler<TContextData> = (
session: Session<TContextData>,
follower: Actor
) => void | Promise<void>

An event handler for an unfollow event from the bot.

T
UnlikeEventHandler<TContextData> = (
session: Session<TContextData>,
like: Like<TContextData>
) => void | Promise<void>

An event handler for undoing a like of a message.

T
VoteEventHandler<TContextData> = (
session: Session<TContextData>,
vote: Vote<TContextData>
) => void | Promise<void>

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. Note that if the poll allows multiple selections, this event is triggered multiple times, once for each option selected by the actor.

Variables

v
DEFAULT_INSTANCE_ACTOR_IDENTIFIER: "__botkit_instance__"

The default identifier of the instance actor: an internal Application actor that an Instance uses for signing shared-inbox related requests on behalf of the whole instance. It can be overridden through the CreateInstanceOptions.instanceActorIdentifier option; either way, bots cannot take the effective identifier.

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.