### Quick Start with Environment Variables Source: https://github.com/steipete/discrawl/blob/main/README.md Initialize and sync data using environment-based token authentication. ```bash export DISCORD_BOT_TOKEN="..." discrawl doctor discrawl init discrawl sync --full ``` -------------------------------- ### Install discrawl via Homebrew Source: https://github.com/steipete/discrawl/blob/main/README.md Install the binary using Homebrew and verify the installation. ```bash brew install steipete/tap/discrawl # auto-taps steipete/tap discrawl --version ``` -------------------------------- ### Quick Start with OpenClaw Configuration Source: https://github.com/steipete/discrawl/blob/main/README.md Initialize and sync data using an existing OpenClaw configuration. ```bash discrawl init --from-openclaw ~/.openclaw/openclaw.json discrawl doctor discrawl sync --full discrawl search "panic: nil pointer" discrawl tail ``` ```bash discrawl init --from-openclaw ~/.openclaw/openclaw.json --account atlas ``` -------------------------------- ### Build Discrawl from Source Source: https://context7.com/steipete/discrawl/llms.txt Builds the Discrawl CLI application from its source code. Requires Git and Go to be installed. ```bash # Build from source git clone https://github.com/steipete/discrawl.git cd discrawl go build -o bin/discrawl ./cmd/discrawl ./bin/discrawl --version ``` -------------------------------- ### Start Live Gateway Tail Source: https://context7.com/steipete/discrawl/llms.txt Runs a persistent connection to Discord's Gateway for real-time message updates. Supports automatic reconnection, periodic repair syncs, and configuration of repair intervals. Can tail multiple guilds. ```bash # Start live tail on default guild discrawl tail ``` ```bash # Tail specific guild discrawl tail --guild 123456789012345678 ``` ```bash # Configure repair sync interval (default 6h) discrawl tail --repair-every 30m ``` ```bash # Tail multiple guilds discrawl tail --guilds 123,456 ``` -------------------------------- ### Update Homebrew tap Source: https://github.com/steipete/discrawl/blob/main/docs/RELEASING.md Commands to verify the release archive checksums and test the local Homebrew installation. ```sh curl -L -o /tmp/discrawl-darwin-arm64.tgz https://github.com/steipete/discrawl/releases/download/vX.Y.Z/discrawl_X.Y.Z_darwin_arm64.tar.gz shasum -a 256 /tmp/discrawl-darwin-arm64.tgz brew uninstall discrawl || true brew install steipete/tap/discrawl discrawl --version brew info steipete/tap/discrawl ``` -------------------------------- ### Verify build and tests Source: https://github.com/steipete/discrawl/blob/main/docs/RELEASING.md Run linting, tests, and build the binary to ensure the project is ready for release. ```sh go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0 run go test ./... -coverprofile=coverage.out go tool cover -func=coverage.out | tail -n 1 go build -o /tmp/discrawl ./cmd/discrawl gh run list -L 5 --branch main ``` -------------------------------- ### Build discrawl from Source Source: https://github.com/steipete/discrawl/blob/main/README.md Clone the repository and compile the binary manually. ```bash git clone https://github.com/steipete/discrawl.git cd discrawl go build -o bin/discrawl ./cmd/discrawl ./bin/discrawl --version ``` -------------------------------- ### Initialize discrawl Configuration Source: https://github.com/steipete/discrawl/blob/main/README.md Various ways to initialize the local configuration and discover guilds. ```bash discrawl init discrawl init --from-openclaw ~/.openclaw/openclaw.json discrawl init --from-openclaw ~/.openclaw/openclaw.json --account atlas discrawl init --guild 123456789012345678 discrawl init --db ~/data/discrawl.db ``` -------------------------------- ### Define Go Project Layout Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Recommended directory structure for organizing the Discrawl codebase. ```text cmd/discrawl/ internal/cli/ internal/config/ internal/discord/ internal/store/ internal/search/ internal/syncer/ internal/embed/ ``` -------------------------------- ### Initialize Discrawl Configuration Source: https://context7.com/steipete/discrawl/llms.txt Creates the local configuration file and discovers accessible Discord guilds. Supports importing from OpenClaw or using environment variables for bot tokens. ```bash # Initialize from OpenClaw config (reuse existing bot credentials) discrawl init --from-openclaw ~/.openclaw/openclaw.json ``` ```bash # Initialize with specific OpenClaw account discrawl init --from-openclaw ~/.openclaw/openclaw.json --account atlas ``` ```bash # Initialize with environment variable token export DISCORD_BOT_TOKEN="your-bot-token" discrawl init ``` ```bash # Initialize with specific guild and database path discrawl init --guild 123456789012345678 --db ~/data/discrawl.db ``` ```bash # Initialize with embeddings support enabled discrawl init --with-embeddings ``` -------------------------------- ### Configure Discord Bot Token via Environment Variables Source: https://github.com/steipete/discrawl/blob/main/README.md Set the bot token in the environment for quick access and verify the configuration. ```bash export DISCORD_BOT_TOKEN="your-bot-token" discrawl doctor discrawl init ``` ```bash export DISCORD_BOT_TOKEN="your-bot-token" ``` -------------------------------- ### Local Development Build and Test Source: https://github.com/steipete/discrawl/blob/main/README.md Commands for local development, including running linters, executing tests with coverage, and building the Discrawl binary. ```bash go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.1 run ``` ```bash go test ./... -coverprofile=/tmp/discrawl.cover ``` ```bash go tool cover -func=/tmp/discrawl.cover | tail -n 1 ``` ```bash go build ./cmd/discrawl ``` -------------------------------- ### Initialize Discrawl with Embeddings Source: https://github.com/steipete/discrawl/blob/main/README.md Initializes Discrawl and enables embedding generation. Ensure the OPENAI_API_KEY environment variable is set. ```bash export OPENAI_API_KEY="..." discrawl init --with-embeddings ``` -------------------------------- ### List and Show Channels Source: https://github.com/steipete/discrawl/blob/main/README.md Commands to list all available channels or show details for a specific channel using its ID. ```bash discrawl channels list ``` ```bash discrawl channels show 123456789012345678 ``` -------------------------------- ### Set Environment Variables Source: https://context7.com/steipete/discrawl/llms.txt Configure tokens and paths using environment variables. ```bash export DISCORD_BOT_TOKEN="your-bot-token" export DISCRAWL_CONFIG="~/custom/config.toml" export OPENAI_API_KEY="sk-..." DISCORD_BOT_TOKEN="..." discrawl doctor DISCORD_BOT_TOKEN="..." discrawl init DISCORD_BOT_TOKEN="..." discrawl sync --full ``` -------------------------------- ### List and Show Members Source: https://github.com/steipete/discrawl/blob/main/README.md Use these commands to list all members, show details for a specific member by ID, or display recent messages for a member. ```bash discrawl members list ``` ```bash discrawl members show 123456789012345678 ``` ```bash discrawl members show --messages 10 steipete ``` -------------------------------- ### Define Discrawl Configuration Source: https://github.com/steipete/discrawl/blob/main/SPEC.md The configuration file uses TOML format and should be placed at ~/.discrawl/config.toml. ```toml version = 1 guild_id = "1456350064065904867" db_path = "~/.discrawl/discrawl.db" cache_dir = "~/.discrawl/cache" log_dir = "~/.discrawl/logs" [discord] token_source = "openclaw" openclaw_config = "~/.openclaw/openclaw.json" channel_account = "discord" [sync] concurrency = 4 repair_every = "6h" full_history = true [search] default_mode = "hybrid" [search.embeddings] enabled = true provider = "openai" model = "text-embedding-3-small" api_key_env = "OPENAI_API_KEY" batch_size = 64 ``` -------------------------------- ### Discrawl Init Command Flags Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Flags for the 'init' command, used to create and configure the discrawl settings file, including importing defaults and specifying database paths. ```text --from-openclaw --guild --db --with-embeddings ``` -------------------------------- ### Configuration File Source: https://context7.com/steipete/discrawl/llms.txt TOML configuration file structure for Discrawl. ```toml version = 1 default_guild_id = "1456350064065904867" guild_ids = ["1456350064065904867"] db_path = "~/.discrawl/discrawl.db" cache_dir = "~/.discrawl/cache" log_dir = "~/.discrawl/logs" [discord] token_source = "openclaw" openclaw_config = "~/.openclaw/openclaw.json" account = "default" token_env = "DISCORD_BOT_TOKEN" [sync] concurrency = 16 repair_every = "6h" full_history = true attachment_text = true [search] default_mode = "fts" [search.embeddings] enabled = false provider = "openai" model = "text-embedding-3-small" api_key_env = "OPENAI_API_KEY" batch_size = 64 ``` -------------------------------- ### List Channels Source: https://context7.com/steipete/discrawl/llms.txt Retrieve information about synced channels and threads. ```bash discrawl channels list discrawl channels show 123456789012345678 ``` -------------------------------- ### Tail live gateway events Source: https://github.com/steipete/discrawl/blob/main/README.md Runs the live Gateway tail and periodic repair loop. ```bash discrawl tail discrawl tail --guild 123456789012345678 discrawl tail --repair-every 30m ``` -------------------------------- ### Execute Discrawl CLI Workflow Source: https://context7.com/steipete/discrawl/llms.txt Standard command-line operations for initializing, syncing, searching, and analyzing Discord data. ```bash # 1. Set up bot token and initialize export DISCORD_BOT_TOKEN="your-bot-token" discrawl doctor discrawl init # 2. Run full initial sync discrawl sync --full # 3. Search for specific content discrawl search "panic: nil pointer" discrawl search --channel maintainers "deployment" # 4. Explore member activity discrawl members search "design engineer" discrawl members show --messages 25 steipete discrawl messages --author steipete --days 30 --all # 5. Run live tail for continuous updates discrawl tail --repair-every 30m # 6. Ad-hoc SQL analysis discrawl sql 'SELECT date(created_at) as day, count(*) FROM messages GROUP BY day ORDER BY day DESC LIMIT 7' ``` -------------------------------- ### List user and role mentions Source: https://github.com/steipete/discrawl/blob/main/README.md Lists structured user and role mentions within the archive. ```bash discrawl mentions --channel maintainers --days 7 discrawl mentions --target steipete --type user --limit 50 discrawl mentions --target 1456406468898197625 discrawl --json mentions --type role --days 1 ``` -------------------------------- ### Typical Member Workflow Source: https://github.com/steipete/discrawl/blob/main/README.md A common workflow involves syncing data, searching for members by keywords, and then displaying detailed information including recent messages for a specific member. ```bash discrawl sync --full ``` ```bash discrawl members search "design engineer" ``` ```bash discrawl members search "github" ``` ```bash discrawl members show --messages 25 steipete ``` ```bash discrawl messages --author steipete --days 30 --all ``` -------------------------------- ### Global CLI Flags Source: https://context7.com/steipete/discrawl/llms.txt Control output format and verbosity using global flags. ```bash discrawl --version discrawl --json status discrawl --json search "query" discrawl --plain members list discrawl -q sync --full discrawl -v tail discrawl --config ~/custom/config.toml doctor ``` -------------------------------- ### Verify GitHub release assets Source: https://github.com/steipete/discrawl/blob/main/docs/RELEASING.md Check the status of the release workflow and view the created release. ```sh gh run list -L 5 --workflow release.yml gh release view vX.Y.Z ``` -------------------------------- ### Perform Full Guild Sync Source: https://context7.com/steipete/discrawl/llms.txt Performs a one-shot crawl to backfill guild data into the SQLite database. Supports full guild sync, all discovered guilds, specific guilds, and channels with time filters. Can also enable embeddings generation. ```bash # Full sync of default guild (channels, threads, members, messages) discrawl sync --full ``` ```bash # Sync all discovered guilds discrawl sync --full --all ``` ```bash # Sync specific guild by ID discrawl sync --guild 123456789012345678 ``` ```bash # Sync multiple guilds with custom concurrency discrawl sync --guilds 123,456 --concurrency 8 ``` ```bash # Sync specific channels with time filter discrawl sync --channels 111,222 --since 2024-03-01T00:00:00Z ``` ```bash # Sync with embeddings generation discrawl sync --full --with-embeddings ``` -------------------------------- ### Execute SQL Queries Source: https://context7.com/steipete/discrawl/llms.txt Run read-only SQL queries against the local SQLite database. ```bash discrawl sql 'select count(*) as messages from messages' echo 'select guild_id, count(*) from messages group by guild_id' | discrawl sql - discrawl sql 'select c.name, count(m.id) as msg_count from channels c left join messages m on c.id = m.channel_id group by c.id order by msg_count desc limit 10' discrawl sql 'select author_id, count(*) as posts from messages where author_id is not null group by author_id order by posts desc limit 20' discrawl sql 'select count(*) from message_fts' ``` -------------------------------- ### Run Diagnostic Check Source: https://github.com/steipete/discrawl/blob/main/README.md Executes a diagnostic check to verify the configuration, authentication, database, and full-text search (FTS) wiring. ```bash discrawl doctor ``` -------------------------------- ### Sync guild state to SQLite Source: https://github.com/steipete/discrawl/blob/main/README.md Backfills guild state into the local SQLite database. Use flags to control concurrency, scope, and time-based history limits. ```bash discrawl sync --full discrawl sync --full --all discrawl sync --guild 123456789012345678 discrawl sync --guilds 123,456 --concurrency 8 discrawl sync --channels 111,222 --since 2026-03-01T00:00:00Z ``` -------------------------------- ### Discrawl CLI Usage Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Basic structure for the discrawl command-line interface. Supports global flags for configuration and output control. ```text discrawl [global flags] [args] ``` -------------------------------- ### Commit, tag, and push release Source: https://github.com/steipete/discrawl/blob/main/docs/RELEASING.md Finalize the release by committing changes, tagging the version, and pushing to the main branch. ```sh git checkout main git pull --ff-only origin main git commit -am "release: vX.Y.Z" git tag -a vX.Y.Z -m "Release X.Y.Z" git push origin main --tags ``` -------------------------------- ### Create Channels Table Source: https://github.com/steipete/discrawl/blob/main/SPEC.md SQL schema for the channels table, designed to store both channels and threads. Includes ID, guild ID, parent ID, kind, name, topic, position, NSFW status, archive status, lock status, thread-specific fields, and update timestamp. ```sql create table channels ( id text primary key, guild_id text not null, parent_id text, kind text not null, name text not null, topic text, position integer, is_nsfw integer not null default 0, is_archived integer not null default 0, is_locked integer not null default 0, is_private_thread integer not null default 0, thread_parent_id text, archive_timestamp text, raw_json text not null, updated_at text not null ); ``` -------------------------------- ### Execute read-only SQL Source: https://github.com/steipete/discrawl/blob/main/README.md Runs read-only SQL queries against the local database. ```bash discrawl sql 'select count(*) as messages from messages' echo 'select guild_id, count(*) from messages group by guild_id' | discrawl sql - ``` -------------------------------- ### Manage Member Operations Source: https://context7.com/steipete/discrawl/llms.txt List, search, and display detailed member profiles and message statistics. ```bash discrawl members list discrawl members show 123456789012345678 discrawl members show --messages 10 steipete discrawl members search "peter" discrawl members search "github" discrawl members search "https://github.com/steipete" ``` -------------------------------- ### Sync State Table Schema Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Manages synchronization state for different scopes, storing cursors and update times to resume crawls efficiently. ```sql create table sync_state ( scope text primary key, cursor text, updated_at text not null ); ``` -------------------------------- ### Discrawl Sync Command Flags Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Flags for the 'sync' command, which performs a one-shot crawl. Supports full syncs, incremental updates since a timestamp, and concurrency control. ```text --full --since --concurrency --with-embeddings ``` -------------------------------- ### Rerun release workflow Source: https://github.com/steipete/discrawl/blob/main/docs/RELEASING.md Manually trigger the release workflow if a rerun is required. ```sh gh workflow run release.yml -f tag=vX.Y.Z ``` -------------------------------- ### Create Guilds Table Source: https://github.com/steipete/discrawl/blob/main/SPEC.md SQL schema for the guilds table, storing guild metadata. Includes primary key, name, icon, raw JSON, and update timestamp. ```sql create table guilds ( id text primary key, name text not null, icon text, raw_json text not null, updated_at text not null ); ``` -------------------------------- ### Sync Data with Embeddings Source: https://github.com/steipete/discrawl/blob/main/README.md Performs a data synchronization while also processing and storing embeddings. This requires prior initialization with embedding support. ```bash discrawl sync --with-embeddings ``` -------------------------------- ### Query Mentions Source: https://context7.com/steipete/discrawl/llms.txt Retrieve mentions from the archive using various filters like channel, user, or time range. ```bash discrawl mentions --channel maintainers --days 7 discrawl mentions --target steipete --type user --limit 50 discrawl mentions --target 1456406468898197625 discrawl --json mentions --type role --days 1 discrawl mentions --channel general --author admin --type user --since 2024-01-01T00:00:00Z ``` -------------------------------- ### List message slices Source: https://github.com/steipete/discrawl/blob/main/README.md Retrieves specific message slices filtered by channel, author, or time range. Requires at least one filter. ```bash discrawl messages --channel maintainers --days 7 --all discrawl messages --channel maintainers --hours 6 --all discrawl messages --channel "#maintainers" --since 2026-03-01T00:00:00Z discrawl messages --channel 1456744319972282449 --author steipete --limit 50 discrawl messages --channel maintainers --last 100 --sync discrawl messages --channel maintainers --days 7 --all --include-empty discrawl --json messages --channel maintainers --days 3 ``` -------------------------------- ### Search Members Source: https://github.com/steipete/discrawl/blob/main/README.md Search for members by name or by matching profile fields like website or GitHub username. This command searches names and any offline profile fields present in the archived member payload. ```bash discrawl members search "peter" ``` ```bash discrawl members search "github" ``` ```bash discrawl members search "https://github.com/steipete" ``` -------------------------------- ### Show Archive Status Source: https://github.com/steipete/discrawl/blob/main/README.md Displays the current status of the local archive, providing insights into the state of the Discrawl data. ```bash discrawl status ``` -------------------------------- ### Discrawl Tail Command Flags Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Flags for the 'tail' command, used for live synchronization from the Discord Gateway. Includes options for repair intervals and embedding integration. ```text --repair-every --with-embeddings ``` -------------------------------- ### Members Table Schema Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Defines the structure for storing member information within a Discord guild. Includes user details, roles, and join timestamps. ```sql create table members ( guild_id text not null, user_id text not null, username text not null, global_name text, display_name text, nick text, discriminator text, avatar text, bot integer not null default 0, joined_at text, role_ids_json text not null, raw_json text not null, updated_at text not null, primary key (guild_id, user_id) ); ``` -------------------------------- ### Query Discrawl SQLite Schema Source: https://context7.com/steipete/discrawl/llms.txt SQL queries for retrieving guild, channel, member, and message data from the local database. ```sql -- Example queries against the schema -- Get guild information SELECT id, name, updated_at FROM guilds; -- List channels with message counts SELECT c.id, c.name, c.kind, COUNT(m.id) as message_count FROM channels c LEFT JOIN messages m ON m.channel_id = c.id GROUP BY c.id ORDER BY message_count DESC; -- Find active members by message count SELECT mem.username, mem.display_name, COUNT(m.id) as messages, MIN(m.created_at) as first_message, MAX(m.created_at) as last_message FROM members mem LEFT JOIN messages m ON m.author_id = mem.user_id AND m.guild_id = mem.guild_id WHERE mem.bot = 0 GROUP BY mem.guild_id, mem.user_id ORDER BY messages DESC LIMIT 20; -- Search FTS index directly SELECT message_id, author_name, channel_name, content FROM message_fts WHERE message_fts MATCH '"error" OR "exception"' LIMIT 10; -- Check sync state SELECT scope, cursor, updated_at FROM sync_state ORDER BY updated_at DESC; ``` -------------------------------- ### Discrawl Search Command Flags Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Flags for the 'search' command, enabling queries against mirrored messages. Supports different search modes (FTS, semantic, hybrid) and filtering by channel or author. ```text --mode fts|semantic|hybrid --channel --author --limit --json --plain ``` -------------------------------- ### Messages Table Schema Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Defines the structure for storing message data, including content, author, channel, and timestamps. Supports tracking edits and deletions. ```sql create table messages ( id text primary key, guild_id text not null, channel_id text not null, author_id text, message_type integer not null, created_at text not null, edited_at text, deleted_at text, content text not null, normalized_content text not null, reply_to_message_id text, pinned integer not null default 0, has_attachments integer not null default 0, raw_json text not null, updated_at text not null ); ``` -------------------------------- ### Query Mentions from Archived Messages Source: https://context7.com/steipete/discrawl/llms.txt Lists structured user and role mentions from archived messages. Supports filtering by target, type, channel, and time range. -------------------------------- ### List Archived Messages Source: https://context7.com/steipete/discrawl/llms.txt Retrieves exact message slices from the archive with flexible filtering by channel, author, time range, and message content. Supports syncing before querying and JSON output. ```bash # Get messages from channel in last 7 days discrawl messages --channel maintainers --days 7 --all ``` ```bash # Get messages from last 6 hours discrawl messages --channel maintainers --hours 6 --all ``` ```bash # Get messages since specific timestamp discrawl messages --channel "#maintainers" --since 2024-03-01T00:00:00Z ``` ```bash # Get messages by author with limit discrawl messages --channel 1456744319972282449 --author steipete --limit 50 ``` ```bash # Get last N messages, printed oldest-to-newest discrawl messages --channel maintainers --last 100 ``` ```bash # Sync channel before querying discrawl messages --channel maintainers --days 7 --all --sync ``` ```bash # Include empty messages and output as JSON discrawl --json messages --channel maintainers --days 3 --include-empty ``` -------------------------------- ### Discrawl Global Flags Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Common flags applicable to all discrawl commands for managing configuration, verbosity, and output format. ```text -h, --help --version --config --json --plain -q, --quiet -v, --verbose --no-color ``` -------------------------------- ### Search archived messages Source: https://github.com/steipete/discrawl/blob/main/README.md Performs full-text search over archived messages. By default, rows without searchable content are skipped. ```bash discrawl search "panic: nil pointer" discrawl search --guild 123456789012345678 "payment failed" discrawl search --channel billing --author steipete --limit 50 "invoice" discrawl search --include-empty "GitHub" discrawl --json search "websocket closed" ``` -------------------------------- ### Search Archived Messages Source: https://context7.com/steipete/discrawl/llms.txt Performs full-text search over archived messages using SQLite FTS5 indexes. Supports filtering by guild, channel, author, and output format. Can include messages with no searchable content. ```bash # Basic full-text search discrawl search "panic: nil pointer" ``` ```bash # Search within specific guild discrawl search --guild 123456789012345678 "payment failed" ``` ```bash # Search with channel and author filters discrawl search --channel billing --author steipete --limit 50 "invoice" ``` ```bash # Include messages with no searchable content discrawl search --include-empty "GitHub" ``` ```bash # JSON output format discrawl --json search "websocket closed" ``` ```bash # Search across all guilds (default behavior) discrawl search "error handling" ``` -------------------------------- ### Embedding Jobs Table Schema Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Tracks the state of embedding generation jobs for messages, including attempts and last update time. Used for asynchronous processing. ```sql create table embedding_jobs ( message_id text primary key, state text not null, attempts integer not null default 0, updated_at text not null ); ``` -------------------------------- ### Message Events Table Schema Source: https://github.com/steipete/discrawl/blob/main/SPEC.md Stores events related to messages, such as edits or deletions, with timestamps and payload information. Useful for auditing and history. ```sql create table message_events ( event_id integer primary key autoincrement, guild_id text not null, channel_id text not null, message_id text not null, event_type text not null, event_at text not null, payload_json text not null ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.