A Discord bot that analyzes direct messages between you and your partner, allowing you to search and query conversation history, track shared links, and more. Perfect for finding those furniture links you shared months ago!
Clone this repository
git clone <repository-url>
cd discord-bot
Install dependencies
npm install
Create a .env
file based on .env.example
cp .env.example .env
Fill in the required environment variables in .env
:
DISCORD_TOKEN
: Your Discord bot tokenDISCORD_CLIENT_ID
: Your Discord application client IDDISCORD_USER_ID
: Your Discord user IDSPOUSE_USER_ID
: Your partner's Discord user IDOPENAI_API_KEY
: Your OpenAI API keyInitialize the database
node index.js
Test the DM fetching process
node val-town-cron.js
Install the Val.town CLI
npm install -g val-town-cli
Authenticate with Val.town
vt login
Deploy the application to Val.town
node val-town-deploy.js
Configure Val.town environment variables
.env
fileSet up a scheduled task on Val.town for periodic DM fetching
discordDMBotCron
function.env
fileThe application exposes the following HTTP endpoints:
GET /health
: Health check endpointPOST /api/fetch-dms
: Manually trigger DM fetchingPOST /api/process-links
: Manually trigger link processingPOST /api/query
: Submit a query about your message history
{ "query": "your question here", "filters": { optional filters } }
POST /api/commands/search
: Discord command endpoint for searching
{ "query": "your search term" }
Once set up, you can interact with the bot using the following commands:
/search [query]
: Search your conversation history/links [category]
: Show links from a specific category/categories
: List all available link categories/analyze [query]
: Analyze your conversation with AIThe application uses a SQLite database with the following tables:
messages
: Stores all DM messagesattachments
: Stores message attachmentsembeds
: Stores message embedslinks
: Stores extracted links with categoriescategories
: Stores link categoriesconversations
: Stores AI-generated conversation summariesContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.