A bot that can interact with the ActivityPub network.
federation: Federation<TContextData>
An internal Fedify federation instance. Normally you don't need to access this directly.
identifier: string
The internal identifier for the bot actor. It is used for the actor URI.
onFollow: FollowEventHandler<TContextData>
An event handler for a follow request to the bot.
onUnfollow: UnfollowEventHandler<TContextData>
An event handler for an unfollow event from the bot.
onAcceptFollow: AcceptEventHandler<TContextData>
An event handler invoked when a follow request the bot sent is accepted.
onRejectFollow: RejectEventHandler<TContextData>
An event handler invoked when a follow request the bot sent is rejected.
onMention: MentionEventHandler<TContextData>
An event handler for a message mentioned to the bot.
onReply: ReplyEventHandler<TContextData>
An event handler for a reply to the bot.
onQuote: QuoteEventHandler<TContextData>
An event handler for a quote of the bot's message.
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.
onLike: LikeEventHandler<TContextData>
An event handler for a like of a message.
onUnlike: UnlikeEventHandler<TContextData>
An event handler for an undoing of a like of a message.
onReact: ReactionEventHandler<TContextData>
An event handler for an emoji reaction to 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.
Note that this event can be triggered even if the voter vote an option multiple times or multiple options for a poll that disallows multiple selections. You should validate the vote in the event handler by storing the votes in a persistent store, and checking if the vote is valid. (This behavior can subject to change in the future.)
getSession(contextData: TContextData,): Session<TContextData>
Gets a new session to control the bot for a specific origin and context data.
getSession(context: Context<TContextData>): Session<TContextData>
Gets a new session to control bot for a specific Fedify context.
fetch(request: Request,contextData: TContextData,): Promise<Response>
The fetch API for handling HTTP requests. You can pass this to an HTTP
server (e.g., Deno.serve()
, Bun.serve()
) to handle incoming requests.
addCustomEmojis<TEmojiName extends string>(emojis: Readonly<Record<TEmojiName, CustomEmoji>>): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>
Defines custom emojis for the bot. The custom emojis are used for rendering the bot's profile and posts. The custom emojis are defined by their names, and the names are used as the keys of the emojis.