From de27e59c0a4b587637a299926683cc6a14f06805 Mon Sep 17 00:00:00 2001 From: Fine_Computer_4451 <119702188+FineComputer14451@users.noreply.github.com> Date: Fri, 13 Nov 2026 08:34:02 -0800 Subject: [PATCH 1/2] Add minimal GrokHunter Discord bot (slash + mention) - bots/discord/bot.py: discord.py bot with /ping /status /agents /credits - Hardcoded agent roster from AGENTS.md - Token via DISCORD_TOKEN env only - README with Developer Portal + run steps - .env.example + requirements.txt + .gitignore Rootless coding-lab presence for The Intelligent Playground. No secrets. --- bots/discord/.env.example | 3 + bots/discord/.gitignore | 4 ++ bots/discord/README.md | 42 ++++++++++++ bots/discord/bot.py | 126 ++++++++++++++++++++++++++++++++++ bots/discord/requirements.txt | 2 + 5 files changed, 177 insertions(+) create mode 100644 bots/discord/.env.example create mode 100644 bots/discord/.gitignore create mode 100644 bots/discord/README.md create mode 100644 bots/discord/bot.py create mode 100644 bots/discord/requirements.txt diff --git a/bots/discord/.env.example b/bots/discord/.env.example new file mode 100644 index 0000000..3b44c89 --- /dev/null +++ b/bots/discord/.env.example @@ -0,0 +1,3 @@ +DISCORD_TOKEN=your_bot_token_here +# Optional: set to your server ID for instant slash sync (Developer Mode → right-click server → Copy ID) +GUILD_ID= diff --git a/bots/discord/.gitignore b/bots/discord/.gitignore new file mode 100644 index 0000000..69cac2e --- /dev/null +++ b/bots/discord/.gitignore @@ -0,0 +1,4 @@ +.env +.venv/ +__pycache__/ +*.pyc diff --git a/bots/discord/README.md b/bots/discord/README.md new file mode 100644 index 0000000..251b6d8 --- /dev/null +++ b/bots/discord/README.md @@ -0,0 +1,42 @@ +# GrokHunter Discord Bot + +Minimal presence for **The Intelligent Playground** server. + +Slash commands + mention replies. Speaks as Coding Team Leader. Knowledge of the GrokHunter agent roster is hardcoded from the repo. + +## Setup + +1. **Create the bot** (Discord Developer Portal) + - New Application → Bot → Reset Token (copy once). + - Privileged Gateway Intents: enable **Message Content Intent**. + - OAuth2 → URL Generator: scopes `bot` + `applications.commands`. + - Permissions: Send Messages, Embed Links, Read Message History (minimal). + - Invite the bot to the server. + +2. **Local run** + ```bash + cd bots/discord + python3 -m venv .venv + source .venv/bin/activate # or .venv\Scripts\activate on Windows + pip install -r requirements.txt + cp .env.example .env + # edit .env — paste DISCORD_TOKEN (never commit .env) + # optional: set GUILD_ID for faster slash sync + python bot.py + ``` + +3. **Commands** + - `/ping` — latency + - `/status` — version, links, install one-liner + - `/agents` — Coding Team + lab roster + - `/credits` — upstream attribution + - Mention the bot → short help + +## Notes + +- Token stays in `.env` only. Add `.env` to `.gitignore` if you commit from this tree. +- Slash commands are global by default (up to ~1h to appear). Set `GUILD_ID` for instant guild sync. +- No live lab proxy, no XAI_API_KEY usage, no always-on hosting instructions here. +- Rootless / coding-lab only. Credit stack: jorexdeveloper, Termux, Kali/OffSec, xAI. + +Not affiliated with xAI, Offensive Security, Termux, or jorexdeveloper. diff --git a/bots/discord/bot.py b/bots/discord/bot.py new file mode 100644 index 0000000..560f1be --- /dev/null +++ b/bots/discord/bot.py @@ -0,0 +1,126 @@ +"""GrokHunter Discord bot — Coding Team presence for The Intelligent Playground. + +Slash commands + mention replies. Token from DISCORD_TOKEN env. +Never commit the token. +""" + +import os +import discord +from discord import app_commands +from discord.ext import commands +from dotenv import load_dotenv + +load_dotenv() + +TOKEN = os.getenv("DISCORD_TOKEN") +GUILD_ID = os.getenv("GUILD_ID") # optional: faster slash sync + +intents = discord.Intents.default() +intents.message_content = True # for mentions / prefix if needed + +class GrokHunterBot(commands.Bot): + def __init__(self): + super().__init__(command_prefix="!", intents=intents) + self.synced = False + + async def setup_hook(self): + if GUILD_ID: + guild = discord.Object(id=int(GUILD_ID)) + self.tree.copy_global_to(guild=guild) + await self.tree.sync(guild=guild) + print(f"Synced slash commands to guild {GUILD_ID}") + else: + await self.tree.sync() + print("Synced global slash commands (may take up to 1h)") + +bot = GrokHunterBot() + +# --- Knowledge (from GrokHunter AGENTS.md / README) --- +AGENTS = { + "coding-team": "Orchestrator: Design (Benjamin) → Build (Lucas) → Harden (Harper)", + "benjamin": "Senior Architect — plan/read-only. Emits Design card.", + "lucas": "Rapid Builder — shippable increments. Emits Build card.", + "harper": "Reliability Engineer — tests, edge cases, phone-real failures. Emits Harden card.", + "scout": "Fast map of tree / install flow (read-only).", + "review": "Diff / change review.", + "fix": "Surgical one-bug patches.", + "overlay": "install.sh / overlay cache / PATH wrappers.", + "desktop": "Termux:X11 / nh-x11 / proot desktop.", + "host": "Termux host vs Kali guest.", + "ship": "VERSION / changelog / release notes.", + "docs": "README / FAQ / website copy.", + "github": "git-identity / commits attach correctly.", + "secrets": "secrets.env mode 600 hygiene.", + "toolchain": "apt / compilers / build tools.", + "tls": "Kali CA / SSL_CERT_FILE.", + "net": "HTTPS probe / guest DNS.", + "tookie": "Authorized public username OSINT (scoped).", +} + +@bot.event +async def on_ready(): + print(f"GrokHunter online as {bot.user} (ID: {bot.user.id})") + print("------") + +@bot.tree.command(name="ping", description="Check bot latency") +async def ping(interaction: discord.Interaction): + await interaction.response.send_message(f"Pong! {round(bot.latency * 1000)}ms") + +@bot.tree.command(name="status", description="GrokHunter version and links") +async def status(interaction: discord.Interaction): + embed = discord.Embed( + title="GrokHunter Rootless", + description="Kali NetHunter (rootless) × Grok Build coding lab for unrooted Android.", + color=0x00E5C7, + ) + embed.add_field(name="Release", value="v1.0.10", inline=True) + embed.add_field(name="Grok Build", value="≥ 1.0.5 · default grok-4.6", inline=True) + embed.add_field( + name="Links", + value="[Repo](https://github.com/FineComputer14451/GrokHunter) · [Site](https://finecomputer14451.github.io/GrokHunter/)", + inline=False, + ) + embed.add_field( + name="Install (Termux)", + value="`bash <(curl -fsSL https://raw.githubusercontent.com/FineComputer14451/GrokHunter/main/install.sh)`", + inline=False, + ) + embed.set_footer(text="Not affiliated with xAI, OffSec, Termux, or jorexdeveloper — we credit them.") + await interaction.response.send_message(embed=embed) + +@bot.tree.command(name="agents", description="List Coding Team + lab agents") +async def agents(interaction: discord.Interaction): + lines = [f"**{name}** — {desc}" for name, desc in AGENTS.items()] + text = "\n".join(lines) + if len(text) > 1900: + text = text[:1900] + "\n…" + await interaction.response.send_message(f"**GrokHunter agents**\n{text}") + +@bot.tree.command(name="credits", description="Who we stand on") +async def credits(interaction: discord.Interaction): + await interaction.response.send_message( + "**Credits**\n" + "• Install engine: jorexdeveloper (termux-nethunter / termux-distro)\n" + "• Host: Termux team\n" + "• Guest OS: Kali / Offensive Security NetHunter rootfs\n" + "• AI: xAI Grok Build\n\n" + "GrokHunter is an overlay. We are not affiliated. See CREDITS.md in the repo." + ) + +@bot.event +async def on_message(message: discord.Message): + if message.author == bot.user: + return + # Mention or reply to bot → short Coding Team style help + if bot.user in message.mentions or (message.reference and message.reference.resolved and message.reference.resolved.author == bot.user): + await message.channel.send( + "Grok online — Coding Team Leader. Heavy loop ready.\n" + "Use `/status`, `/agents`, `/credits`, or `/ping`.\n" + "Rootless lab only. No offensive activity." + ) + await bot.process_commands(message) + +if __name__ == "__main__": + if not TOKEN: + raise SystemExit("DISCORD_TOKEN missing. Copy .env.example → .env and fill it.") + bot.run(TOKEN) diff --git a/bots/discord/requirements.txt b/bots/discord/requirements.txt new file mode 100644 index 0000000..70ad9a2 --- /dev/null +++ b/bots/discord/requirements.txt @@ -0,0 +1,2 @@ +discord.py>=2.3.0 +python-dotenv>=1.0.0 From c3d0b843d639a9dd0129b31cef5082ef7cad6a6b Mon Sep 17 00:00:00 2001 From: Fine_Computer_4451 <119702188+FineComputer14451@users.noreply.github.com> Date: Fri, 13 Nov 2026 08:39:01 -0800 Subject: [PATCH 2/2] Enhance slash commands: add /help, /agent, better sync reporting, error handler --- bots/discord/bot.py | 54 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/bots/discord/bot.py b/bots/discord/bot.py index 560f1be..8c61021 100644 --- a/bots/discord/bot.py +++ b/bots/discord/bot.py @@ -16,22 +16,21 @@ GUILD_ID = os.getenv("GUILD_ID") # optional: faster slash sync intents = discord.Intents.default() -intents.message_content = True # for mentions / prefix if needed +intents.message_content = True # for mentions class GrokHunterBot(commands.Bot): def __init__(self): super().__init__(command_prefix="!", intents=intents) - self.synced = False async def setup_hook(self): if GUILD_ID: guild = discord.Object(id=int(GUILD_ID)) self.tree.copy_global_to(guild=guild) - await self.tree.sync(guild=guild) - print(f"Synced slash commands to guild {GUILD_ID}") + synced = await self.tree.sync(guild=guild) + print(f"Synced {len(synced)} slash commands to guild {GUILD_ID}") else: - await self.tree.sync() - print("Synced global slash commands (may take up to 1h)") + synced = await self.tree.sync() + print(f"Synced {len(synced)} global slash commands (may take up to 1h)") bot = GrokHunterBot() @@ -66,6 +65,21 @@ async def on_ready(): async def ping(interaction: discord.Interaction): await interaction.response.send_message(f"Pong! {round(bot.latency * 1000)}ms") +@bot.tree.command(name="help", description="List available slash commands") +async def help_cmd(interaction: discord.Interaction): + embed = discord.Embed( + title="GrokHunter Slash Commands", + description="Coding Team presence for The Intelligent Playground.", + color=0x00E5C7, + ) + embed.add_field(name="/ping", value="Latency check", inline=False) + embed.add_field(name="/status", value="Version, links, install one-liner", inline=False) + embed.add_field(name="/agents", value="Full agent roster", inline=False) + embed.add_field(name="/agent ", value="Details for one agent", inline=False) + embed.add_field(name="/credits", value="Upstream attribution", inline=False) + embed.set_footer(text="Mention the bot for a short help. Rootless lab only.") + await interaction.response.send_message(embed=embed) + @bot.tree.command(name="status", description="GrokHunter version and links") async def status(interaction: discord.Interaction): embed = discord.Embed( @@ -96,6 +110,19 @@ async def agents(interaction: discord.Interaction): text = text[:1900] + "\n…" await interaction.response.send_message(f"**GrokHunter agents**\n{text}") +@bot.tree.command(name="agent", description="Get details for one agent") +@app_commands.describe(name="Agent name (e.g. benjamin, lucas, scout)") +async def agent(interaction: discord.Interaction, name: str): + key = name.lower().strip() + desc = AGENTS.get(key) + if desc: + await interaction.response.send_message(f"**{key}** — {desc}") + else: + await interaction.response.send_message( + f"Unknown agent `{name}`. Try `/agents` for the full list.", + ephemeral=True, + ) + @bot.tree.command(name="credits", description="Who we stand on") async def credits(interaction: discord.Interaction): await interaction.response.send_message( @@ -107,15 +134,24 @@ async def credits(interaction: discord.Interaction): "GrokHunter is an overlay. We are not affiliated. See CREDITS.md in the repo." ) +@bot.tree.error +async def on_app_command_error(interaction: discord.Interaction, error: app_commands.AppCommandError): + await interaction.response.send_message( + f"Command failed: `{error}`", ephemeral=True + ) + @bot.event async def on_message(message: discord.Message): if message.author == bot.user: return - # Mention or reply to bot → short Coding Team style help - if bot.user in message.mentions or (message.reference and message.reference.resolved and message.reference.resolved.author == bot.user): + if bot.user in message.mentions or ( + message.reference + and message.reference.resolved + and message.reference.resolved.author == bot.user + ): await message.channel.send( "Grok online — Coding Team Leader. Heavy loop ready.\n" - "Use `/status`, `/agents`, `/credits`, or `/ping`.\n" + "Use `/help`, `/status`, `/agents`, `/agent`, `/credits`, or `/ping`.\n" "Rootless lab only. No offensive activity." ) await bot.process_commands(message)