Project: Mjpin

Discord bot that generates Midjourney prompts with AI and posts images to Pinterest

mjpin Discord Bot Documentation

Comprehensive user documentation for the mjpin Discord bot - automated Pinterest pinning and Midjourney prompt generation. What mjpin Does mjpin automates three core workflows: Pinterest Integration: Pin Discord images to...

Message Search System

Discord channel history search with keyword filtering and image detection for /pin command. Search Functions Utility module: src/utils/messageSearch.js Core functions: findLastPinCommand(channel, maxMessages) - Locates last /pin command execution searchMessagesAfter(channel, afterMessageId,...

Rate Limiting System

Sliding window rate limiting for Pinterest API compliance (100 pins per 12 hours per account). Rate Limit Specification Pinterest API limit: 100 pins per 12 hours per account (enforced by...

Storage Architecture

File-based JSON storage for all persistent data in data/ directory. File Structure Data directory: /data/ Stored files: pinterest_tokens.json - OAuth tokens and account information boards.json - Cached Pinterest board data...

Discord.js Integration

Discord bot implementation using discord.js v14 with slash commands and message content access. Bot Configuration Required intents: GatewayIntentBits.Guilds - Guild information access GatewayIntentBits.GuildMessages - Message history access GatewayIntentBits.MessageContent - Message...

OpenAI API Integration

OpenAI ChatGPT API integration with per-guild model selection and modular prompt system. Model Selection API endpoint: https://api.openai.com/v1/models Model filtering: Bot filters available models to chat-capable models only. Exclusion patterns: Embedding...

Pinterest API Integration

Pinterest API v5 integration with multi-account OAuth2 support. OAuth2 Authentication Authorization flow: User executes /auth command Bot generates OAuth URL with state parameter (Discord user ID) User authorizes via Pinterest...

Account Management Commands

Commands for Pinterest authentication, board synchronization, and account switching. /auth Generates Pinterest OAuth2 authorization URL for account linking. Parameters: None What it does: Generates Pinterest OAuth URL with required scopes...

Admin Commands

Administrative commands requiring elevated Discord permissions. /model Configures OpenAI model for server prompt generation. Parameters: None Permission: Requires Manage Server permission What it does: Fetches available OpenAI models via API...

Workflow Commands

Core commands for pinning images and generating prompts. /pin Searches channel history for keyword-matching images and pins them to Pinterest boards. Parameters: keyword (required): Keyword to search for images. Also...

← Back to Chubes.net