Skip to content

Commit 9eab029

Browse files
committed
Rewrote intro docs
1 parent ec3a28c commit 9eab029

File tree

1 file changed

+120
-33
lines changed

1 file changed

+120
-33
lines changed

docs/intro.md

Lines changed: 120 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,142 @@ What is BotKit?
33

44
BotKit is a TypeScript framework for creating standalone [ActivityPub] bots
55
that can interact with Mastodon, Misskey, and other [fediverse] platforms.
6-
Built on top of the robust [Fedify] framework, BotKit lets you focus on your
7-
bot's logic while handling all the complexity of federation under the hood.
6+
Built on top of the robust [Fedify] framework, BotKit simplifies the process
7+
of creating federated bots while handling the underlying ActivityPub
8+
protocol details.
9+
10+
Here's a simple example of what you can build with BotKit:
11+
12+
~~~~ typescript
13+
import { createBot, MemoryKvStore, text } from "@fedify/botkit";
14+
15+
const bot = createBot<void>({
16+
username: "weatherbot",
17+
name: "Seoul Weather Bot",
18+
summary: text`I post daily weather updates for Seoul!`,
19+
kv: new MemoryKvStore(),
20+
// ... configuration options
21+
});
22+
23+
// Respond to mentions
24+
bot.onMention = async (session, message) => {
25+
await message.reply(
26+
text`Current temperature in Seoul is 18°C with clear skies!`
27+
);
28+
};
29+
30+
// Post scheduled updates
31+
setInterval(async () => {
32+
const session = bot.getSession("https://weather.example.com");
33+
await session.publish(
34+
text`Good morning! Today's forecast for Seoul:
35+
🌡️ High: 22°C
36+
💨 Low: 15°C
37+
☀️ Clear skies expected`
38+
);
39+
}, 1000 * 60 * 60 * 24); // Daily updates
40+
~~~~
841

942
[ActivityPub]: https://activitypub.rocks/
1043
[fediverse]: https://fediverse.info/
1144
[Fedify]: https://fedify.dev/
1245

1346

14-
True independence
15-
-----------------
47+
Key features
48+
------------
1649

17-
Unlike traditional fediverse bots that require a Mastodon or Misskey account,
18-
BotKit lets you create fully standalone bots. Your bot runs as its own
19-
independent ActivityPub server, free from any platform-specific limitations or
20-
constraints.
50+
### Standalone operation
2151

22-
Easy to use
23-
-----------
52+
BotKit allows you to run your bot as a standalone ActivityPub server,
53+
which offers several practical benefits:
2454

25-
Getting started with BotKit is straightforward. Create a fully-functional
26-
fediverse bot in just a few lines of code using our intuitive API.
27-
We've designed BotKit to make federation as simple as possible,
28-
so you can focus on what your bot does best.
55+
- No need to create and maintain a Mastodon or Misskey account
56+
- Direct control over your bot's database and message queue
57+
- Freedom to define your own message size limits
2958

59+
Note that while BotKit bots are standalone, they still need to comply with
60+
general fediverse protocols and best practices to ensure reliable federation
61+
with other servers.
3062

31-
Type-safe
32-
---------
63+
### Developer-friendly API
3364

34-
BotKit is fully written in TypeScript, providing excellent IDE integration with
35-
autocompletion and inline documentation. Catch potential errors at compile time
36-
and enjoy a more productive development experience with complete type safety.
65+
BotKit provides a straightforward API that handles common bot operations:
3766

67+
Event handling
68+
: Easily respond to mentions, follows, and messages.
3869

39-
Easy to deploy
40-
--------------
70+
~~~~ typescript
71+
bot.onFollow = async (session, follower) => {
72+
await session.publish(
73+
text`Thanks for following me, ${follower}!`,
74+
{ visibility: "direct" }
75+
);
76+
};
77+
~~~~
4178

42-
BotKit is designed with modern deployment in mind. With minimal dependencies and
43-
a lightweight footprint, you can easily deploy your bot to Deno Deploy,
44-
or any container platforms like Fly.io and Railway using the Deno runtime.
45-
Support for Node.js and Bun is planned for future releases.
79+
Rich content
80+
: Create formatted messages with mentions, hashtags, and media.
4681

82+
~~~~ typescript
83+
await session.publish(
84+
text`Check out ${link("BotKit docs", "https://botkit.fedify.dev/")}!
4785

48-
Rock-solid foundation
49-
---------------------
86+
${hashtag("FediverseBot")}`,
87+
{
88+
attachments: [
89+
new Image({
90+
mediaType: "image/png",
91+
url: new URL("https://example.com/chart.png"),
92+
name: "Daily statistics"
93+
}),
94+
],
95+
}
96+
);
97+
~~~~
5098

51-
Built on Fedify, a battle-tested ActivityPub framework, BotKit ensures robust
52-
federation and seamless compatibility with the fediverse ecosystem.
53-
You can trust that your bot will work reliably with Mastodon, Misskey,
54-
and other ActivityPub implementations.
99+
Message management
100+
: Programmatically update or delete posts.
55101

56-
Ready to create your first fediverse bot?
57-
[Get started with BotKit →](./start.md)
102+
~~~~ typescript
103+
const msg = await session.publish(text`Initial message`);
104+
await msg.update(text`Updated content`);
105+
~~~~
106+
107+
### Type safety
108+
109+
BotKit is written in TypeScript and provides:
110+
111+
- Comprehensive type definitions for all API methods
112+
- Compile-time error checking for ActivityPub interactions
113+
- Autocomplete support in modern IDEs
114+
- Type-safe message formatting utilities
115+
116+
### Deployment options
117+
118+
BotKit currently supports deployment through:
119+
120+
- [Deno Deploy] for serverless hosting
121+
- Docker containers on platforms like Fly.io and Railway
122+
- Self-hosted Deno runtime on your own server
123+
124+
> [!NOTE]
125+
> While Node.js and Bun support are planned for future releases,
126+
> the current version requires Deno.
127+
128+
[Deno Deploy]: https://deno.com/deploy
129+
130+
### Built on Fedify
131+
132+
BotKit builds upon [Fedify]'s proven ActivityPub implementation:
133+
134+
- Robust federation with major fediverse platforms
135+
- Built-in retry mechanisms
136+
- Support for various storage backends (Redis, PostgreSQL, Deno KV)
137+
- Efficient message queue processing
138+
139+
140+
Getting started
141+
---------------
142+
143+
Ready to create your first fediverse bot? Follow our
144+
[step-by-step guide](./start.md) to get your bot up and running in minutes.

0 commit comments

Comments
 (0)