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

@fedify/botkit@0.2.0-dev.77+d1f283de
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
3 weeks ago (0.2.0-dev.77+d1f283de)
function mention
mention<TContextData>(handle: string): Text<"inline", TContextData>

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.

If the given handle does not refer to an actor, the returned tree consists of a plain text with the handle without any link.

Type Parameters

TContextData

The type of the context data.

Parameters

handle: string

The handle of the actor.

Return Type

Text<"inline", TContextData>

A MentionText tree.

mention<TContextData>(actor: Actor | URL): Text<"inline", TContextData>

Mentions an actor. You can use this function to create a MentionText from an actor object. The label of the mention will be the fediverse handle of the actor.

Type Parameters

TContextData

The type of the context data.

Parameters

actor: Actor | URL

The actor to mention.

Return Type

Text<"inline", TContextData>

A MentionText tree.

mention<TContextData>(
label: string,
actor: Actor | URL,
): Text<"inline", TContextData>

Mentions an actor with a custom label. You can use this function to create a MentionText tree from an actor object with a custom label.

If the given actor is a URL and the URL does not refer to an actor, the returned tree consists of a plain text with the URL without any link.

Type Parameters

TContextData

The type of the context data.

Parameters

label: string

The label of the mention.

actor: Actor | URL

The actor to mention.

Return Type

Text<"inline", TContextData>

Add Package

deno add jsr:@fedify/botkit

Import symbol

import { mention } from "@fedify/botkit/text";

---- OR ----

Import directly with a jsr specifier

import { mention } from "jsr:@fedify/botkit/text";