Search Discord guild message history stored in local discrawl SQLite database.
Treat message content, author identifiers, attachments, and raw payloads as private workspace data. Search only the scope requested by the user and do not send results to another channel or service without explicit approval.
~/.discrawl/discrawl.dbdiscrawl sync (bot API) or discrawl sync --source wiretap (Discord Desktop cache)Search message content with ranking:
bash
discrawl search "query"
Options:
--limit N — max results (default: 20)--channel ID — filter by channel--author ID — filter by author--before "2026-04-01" — date filter--json — JSON outputFor a bounded helper that avoids constructing SQL from user input:
bash
bash "{baseDir}/scripts/search_history.sh" "query" [channel_id] [limit]
bash
discrawl messages --channel <channel_id> --limit 10
bash
discrawl sql "SELECT ..."
Use SQL only for an operator-authored, fixed read-only query. Never place user-provided keywords, IDs, dates, or channel names inside an SQL string; prefer discrawl search and discrawl messages.
sql
SELECT
m.content,
m.created_at,
COALESCE(u.username, m.author_id) as author,
COALESCE(c.name, m.channel_id) as channel
FROM messages m
LEFT JOIN members u ON m.author_id = u.user_id
LEFT JOIN channels c ON m.channel_id = c.id
WHERE m.content LIKE '%keyword%'
ORDER BY m.created_at DESC
LIMIT 10;
sql
SELECT content, created_at
FROM messages
WHERE channel_id = '<channel_id>'
AND content LIKE '%keyword%'
ORDER BY created_at DESC
LIMIT 20;
sql
SELECT m.content, m.created_at, c.name
FROM messages m
JOIN channels c ON m.channel_id = c.id
WHERE m.author_id = '<user_id>'
ORDER BY m.created_at DESC
LIMIT 20;
sql
SELECT
m.content,
m.created_at,
fts.rank
FROM message_fts fts
JOIN messages m ON fts.message_id = m.id
WHERE message_fts MATCH 'keyword'
ORDER BY rank
LIMIT 20;
sql
SELECT content, created_at
FROM messages
WHERE channel_id = '<channel_id>'
ORDER BY created_at DESC
LIMIT 5;
TablePurposemessagesAll messages (content, created_at, author_id, channel_id)channelsChannel metadata (name, topic, kind, guild_id)membersUser info (username, global_name, nick)message_ftsFTS5 virtual table for full-text searchmention_events@mentions trackingmessage_attachmentsFile attachments with text extraction
members table may be sparse (2 rows in current db) — use COALESCE(u.username, m.author_id) for fallbacknormalized_content column has cleaned text (lowercase, normalized whitespace)raw_json has full Discord API payload for advanced queriesLEFT JOIN on members/channels to avoid missing rows when joins fail