create-strafebot
v1.3.0
Published
CLI to scaffold a Strafe bot project and commands
Readme
Overview
create-strafebot is an interactive command-line tool that helps you:
- Scaffold a complete TypeScript Strafe Chat bot project with pre-configured environment files, scripts, and starter commands.
- Generate new typed command modules (
src/commands/<name>.ts) inside an existing bot project with optional moderator (--mod) or administrator (--admin) permission guards.
1. Scaffolding a New Bot Project
Run the interactive wizard with npm, npx, pnpm, or bun:
npm create strafebot@latest my-bot
# or
npx create-strafebot my-botInteractive Prompts
- Project folder: Target directory name (default:
my-strafe-bot). - Bot token: Optional token written directly into
.env(BOT_TOKEN). - Command prefix: Default command prefix (default:
!). - Owner user IDs: Comma-separated Snowflake IDs for
botOwnerOnlycommands. - Template selection:
- 1) Full Command Bot: Includes
CommandHandler,src/commands/ping.ts, andsrc/commands/kick.ts. - 2) Minimal Event Bot: Lightweight
messageCreatelistener setup without command files.
- 1) Full Command Bot: Includes
Generated Directory Structure
my-bot/
├── .env # Local environment secrets (gitignored)
├── .env.example # Safe template for version control
├── .gitignore
├── package.json # Scripts: dev (tsx watch), build (tsc), start
├── tsconfig.json # Strict ES2022 + NodeNext TypeScript config
└── src/
├── index.ts # Client setup, event logging, and command registration
└── commands/
├── ping.ts # Basic latency check command
└── kick.ts # Moderation command exampleRunning Your New Bot
cd my-bot
npm run dev2. Generating Command Files (command / cmd / g)
From the root of an existing bot project, generate a new command module in src/commands/<name>.ts:
# Generate a standard user command (SendMessages)
npx create-strafebot command userinfo
# Generate a moderator command (KickMembers, ManageMessages + guildOnly)
npx create-strafebot command warn --mod
# Generate an administrator command (Administrator, BanMembers + guildOnly)
npx create-strafebot command purge --adminThen import and register the generated command in src/index.ts:
import { warnCommand } from './commands/warn.js';
client.commands.register(warnCommand);Links
License
Apache-2.0
