# 🎮 GRFTY Discord Game Bot

*Version: 1.0
Domains: Discord Gaming • Crypto Social • LLM UX
Core Stack: Discord.js • SQLite • ChainGPT LLM • Solana (USDC) for boosts/payouts*

By [GRFTY](https://paragraph.com/@grfty) · 2025-08-26

ai, crypto, game, bot, web3

---

⚡ TL;DR
-------

**GRFTY** is a fast, social, crypto-native Discord game bot with three headline modes:

1.  ⚔ **GRFT Duels** — challenge a user; they get **8h** to respond or auto-forfeit.
    
2.  🏟 **GRFTY Rumble** — elimination game with kill/death/revival (incl. **mass events**).
    
3.  🚀 **Raids** — time-boxed Twitter/X engagements with verified requirements & points.
    

🤖 **ChainGPT powers** short, savage, on-brand narration (challenge lines, arena results, rumble events, raid copy hints). Admins can toggle **Exact / Hybrid / Full LLM** live. Hybrid falls back to curated phrases under latency/budget.

* * *

🎯 Why GRFTY?
-------------

*   🧲 **High-energy loops:** duel clocks, live eliminations, raid deadlines.
    
*   🧪 **Crypto-native flavor:** memecoins, NFT lore, conference chaos—kept sharp via ChainGPT + phrase banks.
    
*   🏅 **Status & stakes:** role transfers on timeouts, 7-day Activity Score, prize pools, Solana boosts.
    

* * *

🕹 Game Modes & Flow
--------------------

### ⚔ A) GRFT Duels (1v1)

![](https://storage.googleapis.com/papyrus_images/e99f4ad71e44719361ebb58d0ccec9d6.png)

![](https://storage.googleapis.com/papyrus_images/0e2df3b30082d9284f92f81a7cea4c01.png)

  
  
  
  
  
  
  
  
  
  
  

**Flow**

1.  `/grft challenge @user` → posts to **GRFTs in Progress** with a live **8h** timer.
    
2.  If **P2 responds** in time → chance-based result (weighted by Activity Score) in **GRFT Arena**; **points** awarded; **roles unchanged**.
    
3.  If **no response** → **Auto-Win** to P1, kill-style line in **GRFT Arena**; loser **forfeits highest whitelist role**; winner **gains next level** (unless max); points awarded.
    
4.  **Cooldowns:** default 8h; **bypass** for admins/whitelisted users. P1 can challenge **again once P2 replies** (even before 8h elapses).
    

**Roles & Points**

*   Tiers: 🦍 **GRIZL GANG** (top) → 🧠 **GRFTY OG** → ✅ **GRFTY WL**.
    
*   Timeouts can transfer tier; wins vs high-tier on response grant **elevated points** (no role change).
    

**ChainGPT Usage**

*   **Challenge lines** & **Arena narration** (timeout/chance wins).
    

**Reliability**

*   Immediate **ACK** + later edit → no Discord “did not respond”.
    
*   LLM **hard timeouts** → **phrase fallback**.
    

* * *

### 🏟 B) GRFTY Rumble (Battle Royale)

![](https://storage.googleapis.com/papyrus_images/707c0321a703bf384b46049e69a3c496.png)

  
  
  
  
  
  
  
  
  
  
  
  
  

**Flow**

*   Host starts game → users **react** 😈 to join.
    
*   Configurable **countdown** ⏳, **min players**, **early start** threshold, **random images**.
    
*   Rounds: **Kill / Death / Revival** events; occasional **Mass Death / Mass Revival**.
    
*   End: 🏁 **Stats** posted (🥇/🥈/🥉, **Most Kills**); points update leaderboard.
    

**ChainGPT Usage**

*   **Kill/Death/Revival** lines + **Mass Event** headers (Hybrid/LLM).
    
*   **Exact** uses curated banks only.
    

**Activity Score Mod**

*   Rolling **7-day Activity Score (0–100)** slightly adjusts survival/kill odds (bounded, fair).
    

* * *

### 🚀 C) Raids (Twitter/X)

**Flow**

1.  `/raid start` → set **tweet URL**, **length**, **base points**, **required phrase**, **image required?**
    
2.  Bot announces in RAID channel; pings a **configured role**; shows **countdown**.
    
3.  Users reply on X, then `/raid submit` with their **reply URL**.
    
4.  Bot verifies:
    
    *   ✅ Is a reply to the **target tweet**
        
    *   ✅ Contains **required phrase**
        
    *   ✅ If image required, matches approved **NFT image set** (perceptual hash)
        
    *   ✅ Not previously submitted
        
5.  Points **decay** over time; raid closes at deadline; points finalize.
    

**ChainGPT Usage**

*   Optional **raid copy** suggestions + **announcement flair**.
    

* * *

🧮 Scoring, Leaderboard & Activity Score
----------------------------------------

**Leaderboard Columns**

*   👤 **User**
    
*   🎮 **GRFTY Games Played** • 💀 **Kills** • 🏅 **1st/2nd/3rd** • 🧾 **GRFTY Game Total**
    
*   ⚔ **Attempted GRFTs** • 🦍/🧠/✅ **Timeout GRFTs by tier** • 🗡 **GRFTs (total)** • 📈 **GRFT Total**
    
*   📣 **Raid Points**
    
*   🔥 **Activity Score (0–100)**
    
*   🧮 **Total Score = GRFTY Game Total + GRFT Total + Raid Points**
    

**Activity Score (AS)**

*   Based on **main chat** messages, **rolling 7 days**.
    
*   **Boosts:** **$5 → +25 AS** for **7 days**, **stackable up to 100**. After 7 days, boosted AS falls off; natural chat AS remains.
    

* * *

🤖 ChainGPT Integration
-----------------------

**Generates**

*   Challenge lines (Duels)
    
*   Arena narration (timeouts/chance results)
    
*   Rumble events & mass headers
    
*   Optional raid copy hints
    

**Modes**

*   🎯 **Exact:** curated phrases only (0 API calls)
    
*   🧪 **Hybrid (default):** try ChainGPT → fallback to phrases on timeout/error
    
*   🚀 **Full LLM:** always use ChainGPT (with latency guard)
    

**Latency Guard**

*   ~**1.5s** timeout → immediate fallback (game flow never blocks).
    
*   Slash commands **ACK first, edit later**.
    

**Admin Controls**

*   `/admin phrases-mode exact|hybrid|llm`
    
*   `/admin set-phrases` (JSON import)
    
*   Cooldown bypass toggles & per-user whitelist
    

**Minimal API Footprint**

*   Tiny prompts, low `max_tokens`, consistent style output.
    

* * *

🔒 Security & Reliability
-------------------------

*   **Permissions:** Send/Manage Messages (optional), **Manage Roles** (duel timeouts), Read History, Add Reactions, Use Commands.
    
*   **Gating:** Only approved **roles/users** can start Rumbles/Raids & configure payouts.
    
*   **Anti-timeout:** Instant **ACK**; LLM fallback; WAL & busy timeouts in SQLite.
    
*   **Automod-friendly:** Zero-width content wrappers to avoid embed-spam flags.
    
*   **Role safety:** Check bot role hierarchy before transfers.
    
*   **Config safety:** KV/DB auto-heal; admin **throttling** (e.g., 1 change / 10s); **audit logs** to private channel.
    

**ChainGPT Safety**

*   Short prompts; hard timeouts; post-processing to enforce **mention format** and length.
    

* * *

![](https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/1fa99.png) On-Chain & Payments (Boosts & Prize Pool)
-------------------------------------------------------------------------------------------------------------------------

**Boosts**

*   Purchase via **Solana Pay (USDC)** → **+25 AS / 7d**, stackable up to **100**.
    
*   Public **boost activity** feed; **prize pool** UI shows **team seed** + **user contributions** and **team fee %**.
    

**Prize Pool**

*   Monthly winners via **Total Score**.
    
*   **Payout Options:**
    
    *   🧾 **Unsigned tx** for multisig approval via `/pool payout-confirm` (recommended)
        
    *   🔥 **Direct payouts** (hot wallet) only if you accept operational risk (role-gated + logged)
        

* * *

🛠 Admin UX (Selected Commands)
-------------------------------

*   **Channels**  
    `/admin set-channels in_progress|arena|commands|leaderboard|rumble|raid|boost_announce|main|admin_log #channel`
    
*   **Hosts/Permissions**  
    `/admin set-hosts rumble @role/@user …` • `/admin get-hosts`  
    `/rumble-admin set-ping-role @role` • `/raid-admin set-ping-role @role`
    
*   **Phrases & LLM**  
    `/admin phrases-mode exact|hybrid|llm`  
    `/admin set-phrases` (JSON)
    
*   **Duels**  
    `/grft challenge @user` • `/grft respond id` • `/grft mine` • `/grft sweep-expired`  
    Admin cooldown bypass toggles & per-user overrides
    
*   **Rumble**  
    `/rumble start` with **countdown**, **min players**, **early start**, **images**
    
*   **Raids**  
    `/raid start` (tweet, length, points, phrase, image rule)  
    `/raid submit` (reply URL; verified)
    
*   **Leaderboard**  
    `/leaderboard post` (simple/expanded), `/leaderboard pin`, `/leaderboard auto-refresh set`
    
*   **Boosts/Pool**  
    `/boosts set-price` • `/boosts set-as-points` • `/boosts set-cap`  
    `/pool set-team-fee` • `/pool info` • `/pool payout-confirm`
    

_All admin actions are_ **_throttled_** _and_ **_audit-logged_**_._

* * *

🧩 Developer Notes
------------------

**Architecture**

*   Discord.js v14+ bot
    
*   SQLite (WAL, light migrations, KV config)
    
*   ChainGPT chat-style endpoint (URL + API key)
    
*   Solana client for boosts/payout ops (USDC)
    

**ChainGPT Call (shape)**

    await fetch(CHAINGPT_API_URL, {
      method: 'POST',
      headers: { Authorization: `Bearer ${CHAINGPT_API_KEY}`, 'Content-Type': 'application/json' },
      body: JSON.stringify({
        messages: [{ role: 'user', content: prompt }],
        max_tokens: 60,
        temperature: 0.9,
      }),
      signal: AbortSignal.timeout(1500),
    });
    

**Reliability Patterns**

*   ACK first → `editReply` later
    
*   LLM timeout → phrase fallback
    
*   Per-guild KV config, safe defaults, schema auto-heal
    

* * *

🗺 Roadmap
----------

*   🌐 Web dashboard (tuning & analytics)
    
*   🛡 Stronger raid verifiers & fraud heuristics
    
*   📦 Season tooling & recaps
    
*   🎭 Extensible phrase packs (brand collabs)
    
*   🔍 Optional anti-abuse models
    

* * *

🤝 Why ChainGPT?
----------------

*   🎨 Consistent **crypto-native micro-copy** for live game loops
    
*   ⚡ Low-latency short generations fit our **hard timeout** model
    
*   🧩 Straightforward API; easy to **fallback without breaking UX**

---

*Originally published on [GRFTY](https://paragraph.com/@grfty/discord-game-bot)*
