Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Deno
This package works with Deno
JSR Score88%
Downloads36/wk
Published2 months ago (0.3.1)

A framework for creating ActivityPub bots

Classes

c
KvRepository(
kv: KvStore,
prefixes?: KvStoreRepositoryPrefixes
)

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

  • addFollowee(
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    followRequestId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addSentFollow(
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • countFollowers(): Promise<number>
    No documentation available
  • countMessages(): Promise<number>
    No documentation available
  • countVoters(messageId: Uuid): Promise<number>
    No documentation available
  • countVotes(messageId: Uuid): Promise<Readonly<Record<string, number>>>
    No documentation available
  • getFollowee(followeeId: URL): Promise<Follow | undefined>
    No documentation available
  • getFollowers(options?: RepositoryGetFollowersOptions): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(id: Uuid): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(options?: RepositoryGetMessagesOptions): AsyncIterable<Create | Announce>
    No documentation available
  • getSentFollow(id: Uuid): Promise<Follow | undefined>
    No documentation available
  • hasFollower(followerId: URL): Promise<boolean>
    No documentation available
  • kv: KvStore
    No documentation available
  • prefixes: KvStoreRepositoryPrefixes
    No documentation available
  • removeFollowee(followeeId: URL): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    followRequestId: URL,
    actorId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(id: Uuid): Promise<Create | Announce | undefined>
    No documentation available
  • removeSentFollow(id: Uuid): Promise<Follow | undefined>
    No documentation available
  • setKeyPairs(keyPairs: CryptoKeyPair[]): Promise<void>
    No documentation available
  • updateMessage(
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    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(
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    followId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addSentFollow(
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • cache: MemoryRepository
    No documentation available
  • countFollowers(): Promise<number>
    No documentation available
  • countMessages(): Promise<number>
    No documentation available
  • countVoters(messageId: Uuid): Promise<number>
    No documentation available
  • countVotes(messageId: Uuid): Promise<Readonly<Record<string, number>>>
    No documentation available
  • getFollowee(followeeId: URL): Promise<Follow | undefined>
    No documentation available
  • getFollowers(options?: RepositoryGetFollowersOptions): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(id: Uuid): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(options?: RepositoryGetMessagesOptions): AsyncIterable<Create | Announce>
    No documentation available
  • getSentFollow(id: Uuid): Promise<Follow | undefined>
    No documentation available
  • hasFollower(followerId: URL): Promise<boolean>
    No documentation available
  • removeFollowee(followeeId: URL): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(id: Uuid): Promise<Create | Announce | undefined>
    No documentation available
  • removeSentFollow(id: Uuid): Promise<Follow | undefined>
    No documentation available
  • setKeyPairs(keyPairs: CryptoKeyPair[]): Promise<void>
    No documentation available
  • underlying: Repository
    No documentation available
  • updateMessage(
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    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(
    followeeId: URL,
    follow: Follow
    ): Promise<void>
    No documentation available
  • addFollower(
    followId: URL,
    follower: Actor
    ): Promise<void>
    No documentation available
  • addMessage(
    id: Uuid,
    activity: Create | Announce
    ): Promise<void>
    No documentation available
  • addSentFollow(
    id: Uuid,
    follow: Follow
    ): Promise<void>
    No documentation available
  • countFollowers(): Promise<number>
    No documentation available
  • countMessages(): Promise<number>
    No documentation available
  • countVoters(messageId: Uuid): Promise<number>
    No documentation available
  • countVotes(messageId: Uuid): Promise<Readonly<Record<string, number>>>
    No documentation available
  • followRequests: Record<string, string>
    No documentation available
  • followees: Record<string, Follow>
    No documentation available
  • followers: Map<string, Actor>
    No documentation available
  • getFollowee(followeeId: URL): Promise<Follow | undefined>
    No documentation available
  • getFollowers(options?: RepositoryGetFollowersOptions): AsyncIterable<Actor>
    No documentation available
  • getKeyPairs(): Promise<CryptoKeyPair[] | undefined>
    No documentation available
  • getMessage(id: Uuid): Promise<Create | Announce | undefined>
    No documentation available
  • getMessages(options?: RepositoryGetMessagesOptions): AsyncIterable<Create | Announce>
    No documentation available
  • getSentFollow(id: Uuid): Promise<Follow | undefined>
    No documentation available
  • hasFollower(followerId: URL): Promise<boolean>
    No documentation available
  • keyPairs: CryptoKeyPair[]
    No documentation available
  • messages: Map<Uuid, Create | Announce>
    No documentation available
  • polls: Record<Uuid, Record<string, Set<string>>>
    No documentation available
  • removeFollowee(followeeId: URL): Promise<Follow | undefined>
    No documentation available
  • removeFollower(
    followId: URL,
    followerId: URL
    ): Promise<Actor | undefined>
    No documentation available
  • removeMessage(id: Uuid): Promise<Create | Announce | undefined>
    No documentation available
  • removeSentFollow(id: Uuid): Promise<Follow | undefined>
    No documentation available
  • sentFollows: Record<string, Follow>
    No documentation available
  • setKeyPairs(keyPairs: CryptoKeyPair[]): Promise<void>
    No documentation available
  • updateMessage(
    id: Uuid,
    updater: (existing: Create | Announce) =>
    Create
    | Announce
    | undefined
    | Promise<Create | Announce | undefined>
    ): Promise<boolean>
    No documentation available
  • vote(
    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
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>
4 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
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.

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

    Updates the message with new content.

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.

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

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

  • 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

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 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: LanguageTag

    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.

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

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

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 repository for storing bot data.

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

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

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

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

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

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

    Removes a sent follow request from the 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.

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: Bot<TContextData>

    The bot to which the session belongs.

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

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

    The language of 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
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
QuoteEventHandler<TContextData> = (
session: Session<TContextData>,
quote: Message<MessageClass, TContextData>
) => void | Promise<void>

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

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.

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.