<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Werter’s Tech Stack]]></title><description><![CDATA[Werter’s Tech Stack]]></description><link>https://werter.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/69ff4201f239332df4bb9578/e354f23a-fb8a-418e-ba90-7a030aec127d.jpg</url><title>Werter’s Tech Stack</title><link>https://werter.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 30 Nov 2026 22:13:02 GMT</lastBuildDate><atom:link href="https://werter.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Gamifying community engagement how I built a Pirate AI bot for my social network
]]></title><description><![CDATA[Building a social platform today isn't just about databases and fast loading times; it’s about atmosphere. When I started developing Waeris.com, I wanted…]]></description><link>https://werter.hashnode.dev/gamifying-community-engagement-how-i-built-a-pirate-ai-bot-for-my-social-network</link><guid isPermaLink="true">https://werter.hashnode.dev/gamifying-community-engagement-how-i-built-a-pirate-ai-bot-for-my-social-network</guid><dc:creator><![CDATA[robowerter]]></dc:creator><pubDate>Sat, 09 May 2026 14:50:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69ff4201f239332df4bb9578/6d03b35d-986b-40f2-8de3-2a9062901e24.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Building a social platform today isn't just about databases and fast loading times; it’s about <strong>atmosphere</strong>. When I started developing <a href="http://Waeris.com"><strong>Waeris.com</strong></a>, I wanted something more than just another "reply" button. I wanted a character.</p>
<p>Enter <strong>Captain Jack Bot</strong>.</p>
<h4>The Concept: An AI Legend in the Comments</h4>
<p>The idea was simple but ambitious: create a resident bot that users could summon to answer complex questions or just to liven up a discussion. By simply typing <code>@Jack</code> followed by a question, the user triggers a response from the "Captain" himself.</p>
<h4>The Tech Stack: PHP &amp; LLM Integration</h4>
<p>I decided to keep the implementation lean and efficient. The core logic is built on <strong>PHP</strong>, integrated directly into the platform's event system. When a post contains the <code>@Jack</code> command:</p>
<ol>
<li><p>The system captures the context of the user's question.</p>
</li>
<li><p>It processes it through an LLM API.</p>
</li>
<li><p>It formats and injects the response back into the discussion thread in real-time.</p>
</li>
</ol>
<h4>The Real Challenge: The "Pirate" Prompt Engineering</h4>
<p>Technically, connecting an API is the easy part. The real battle was fought in the <strong>System Prompt</strong>.</p>
<p>If you've ever played with AI bots, you know they tend to fall into repetitive patterns. They use the same catchphrases (<em>"Savvy?"</em>) in every single sentence. After a few hours, the magic disappears, and it becomes "info-noise."</p>
<p>To prevent "Jack fatigue," I spent weeks fine-tuning the prompt instructions to:</p>
<ul>
<li><p><strong>Vary the vocabulary:</strong> Using a wide range of nautical slang and 18th-century eccentricities.</p>
</li>
<li><p><strong>Manage Wit vs. Logic:</strong> Ensuring the bot actually answers the user's "complex question" while maintaining the drunk-but-genius persona.</p>
</li>
<li><p><strong>Contextual Awareness:</strong> Making sure the bot recognizes if it's being asked about a server error or a philosophy question, adjusting its "sea saltiness" accordingly.</p>
</li>
</ul>
<h4>Why Bother?</h4>
<p>In a world of sterile, corporate AI assistants, people crave personality. Since implementing the <code>@Jack</code> command on <strong>Waeris</strong>, I’ve seen a significant spike in user interaction. It’s not just a tool; it’s a member of the community.</p>
<p>The Implementation Logic To keep the system lightweight, I built a standalone PHP bridge that interacts with the Flarum core. Here’s a simplified look at how the bot processes the request and posts back as the legendary Captain:</p>
<pre><code class="language-plaintext">PHP // Bootstrapping the Flarum environment \(app = require 'site.php'; \)app-&gt;boot();
// Preparing the request for the Gemini 1.5 Flash model \(data = [ 'contents' =&gt; [ ['parts' =&gt; [['text' =&gt; "Act as Captain Jack Sparrow: {\)userText} "]]] ] ];

// Standard cURL to fetch the pirate's wisdom \(ch = curl_init('https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=' . API_KEY); curl_setopt(\)ch, CURLOPT_RETURNTRANSFER, true); curl_setopt(\(ch, CURLOPT_POSTFIELDS, json_encode(\)data)); \(response = curl_exec(\)ch);

// Posting the reply back to the discussion via Flarum's Eloquent models \(post = \Flarum\Post\CommentPost::reply( \)discussionId, \(replyText, JACK_USER_ID, null ); \)post-&gt;save(); Why this approach? By using \Flarum\Post\CommentPost::reply, the bot doesn't just inject text into the database; it triggers all the native platform events. This means "Jack" behaves like a real user—he can be mentioned, his posts can be liked, and he follows the site’s formatting rules.
</code></pre>
<p><strong>What about you?</strong> Have you tried integrating "character" AI into your projects, or do you prefer your bots to stay strictly professional?</p>
<p>#PHP, #AI, #Showcase</p>
]]></content:encoded></item></channel></rss>