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
a week ago (0.3.0-dev.119+a1068dd9)
interface Repository

A repository for storing bot data.

Methods

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

Sets the key pairs of the bot actor.

Gets the key pairs of the bot actor.

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

Adds a message to the repository.

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

Updates a message in the repository.

Removes a message from the repository.

Gets messages from the repository.

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

Gets a message from the repository.

Counts the number of messages in the repository.

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

Adds a follower to the repository.

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

Removes a follower from the repository.

Checks if the repository has a follower.

Gets followers from the repository.

Counts the number of followers in the repository.

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

Adds a sent follow request to the repository.

Removes a sent follow request from the repository.

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

Gets a sent follow request from the repository.

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

Adds a followee to the repository.

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

Removes a followee from the repository.

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

Gets a followee from 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.

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. If the poll allows multiple selections, each option is counted separately, and the same voter can vote for multiple options.

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 Repository } from "@fedify/botkit/repository";
or

Import directly with a jsr specifier

import { type Repository } from "jsr:@fedify/botkit/repository";