BotKit by Fedify :botkit:<p>We're excited to announce the release of <a href="https://github.com/fedify-dev/botkit/releases/tag/0.3.0" rel="nofollow noopener" target="_blank">BotKit 0.3.0</a>! This release marks a significant milestone as <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/BotKit" target="_blank">#<span>BotKit</span></a> now supports <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/Node" target="_blank">#<span>Node</span></a>.js alongside <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/Deno" target="_blank">#<span>Deno</span></a>, making it accessible to a wider audience. The minimum required Node.js version is 22.0.0. This dual-runtime support means you can now choose your preferred <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/JavaScript" target="_blank">#<span>JavaScript</span></a> runtime while building <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/ActivityPub" target="_blank">#<span>ActivityPub</span></a> <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/bots" target="_blank">#<span>bots</span></a> with the same powerful BotKit APIs.</p><p>One of the most requested features has landed: <em><a href="https://botkit.fedify.dev/concepts/message#polls" rel="nofollow noopener" target="_blank">poll support</a></em>! You can now create interactive polls in your <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/bot" target="_blank">#<span>bot</span></a> messages, allowing followers to vote on questions with single or multiple-choice options. Polls are represented as ActivityPub <code>Question</code> objects with proper expiration times, and your bot can react to votes through the new <a href="https://botkit.fedify.dev/concepts/events#vote" rel="nofollow noopener" target="_blank"><code>onVote</code> event handler</a>. This feature enhances engagement possibilities and brings BotKit to feature parity with major <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/fediverse" target="_blank">#<span>fediverse</span></a> platforms like Mastodon and Misskey.</p>
<pre><code><span class=""><span>// Create a poll with multiple choices</span></span>
<span class=""><span>await</span><span> session</span><span>.</span><span>publish</span><span>(</span><span>text</span><span>`What's your favorite programming language?`</span><span>, {</span></span>
<span class=""><span> class</span><span>:</span><span> Question</span><span>,</span></span>
<span class=""><span> poll</span><span>:</span><span> {</span></span>
<span class=""><span> multiple</span><span>:</span><span> true</span><span>, </span><span>// Allow multiple selections</span></span>
<span class=""><span> options</span><span>:</span><span> [</span><span>"JavaScript"</span><span>, </span><span>"TypeScript"</span><span>, </span><span>"Python"</span><span>, </span><span>"Rust"</span><span>],</span></span>
<span class=""><span> endTime</span><span>:</span><span> Temporal</span><span>.</span><span>Now</span><span>.</span><span>instant</span><span>().</span><span>add</span><span>({ </span><span>hours</span><span>:</span><span> 24</span><span> }),</span></span>
<span class=""><span> },</span></span>
<span class=""><span>});</span></span>
<span class=""></span>
<span class=""><span>// Handle votes</span></span>
<span class=""><span>bot</span><span>.</span><span>onVote</span><span> =</span><span> async</span><span> (</span><span>session</span><span>, </span><span>vote</span><span>) </span><span>=></span><span> {</span></span>
<span class=""><span> console</span><span>.</span><span>log</span><span>(</span><span>`</span><span>${</span><span>vote</span><span>.</span><span>actor</span><span>}</span><span> voted for "</span><span>${</span><span>vote</span><span>.</span><span>option</span><span>}</span><span>"`</span><span>);</span></span>
<span class=""><span>};</span></span></code></pre><p>The web frontend has been enhanced with a new <em>followers page</em>, thanks to the contribution from <em>Hyeonseo Kim</em> (<a translate="no" class="h-card u-url mention" href="https://hackers.pub/@gaebalgom" rel="nofollow noopener" target="_blank">@<span>gaebalgom</span></a>)! The <code>/followers</code> route now displays a paginated list of your bot's followers, and the follower count on the main profile page is now clickable, providing better visibility into your bot's audience. This improvement makes the web interface more complete and user-friendly.</p><p>For developers looking for alternative storage backends, we've introduced the <a href="https://botkit.fedify.dev/concepts/repository#sqliterepository" rel="nofollow noopener" target="_blank"><code>SqliteRepository</code></a> through the new <code>@fedify/botkit-sqlite</code> package. This provides a production-ready SQLite-based storage solution with ACID compliance, write-ahead logging (WAL) for optimal performance, and proper indexing. Additionally, the new <a href="https://botkit.fedify.dev/concepts/repository" rel="nofollow noopener" target="_blank"><code>@fedify/botkit/repository</code> module</a> offers <a href="https://botkit.fedify.dev/concepts/repository#memorycachedrepository" rel="nofollow noopener" target="_blank"><code>MemoryCachedRepository</code></a> for adding an in-memory cache layer on top of any <a href="https://botkit.fedify.dev/concepts/repository" rel="nofollow noopener" target="_blank">repository</a> implementation, improving read performance for frequently accessed data.</p><p>This release also includes an important security update: we've upgraded to <a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/Fedify" target="_blank">#<span>Fedify</span></a> 1.8.8, ensuring your bots stay secure and compatible with the latest ActivityPub standards. The <a href="https://botkit.fedify.dev/concepts/repository" rel="nofollow noopener" target="_blank">repository pattern</a> has been expanded with new interfaces and types like <code>RepositoryGetMessagesOptions</code>, <code>RepositoryGetFollowersOptions</code>, and proper support for polls storage through the <code>KvStoreRepositoryPrefixes.polls</code> option, providing more flexibility for <a href="https://botkit.fedify.dev/concepts/repository#implementing-a-custom-repository" rel="nofollow noopener" target="_blank">custom implementations</a>.</p><p><a class="mention hashtag" rel="nofollow noopener" href="https://hollo.social/tags/fedidev" target="_blank">#<span>fedidev</span></a></p>