A Discord that creates an interactive environment where users can participate in time-limited image generation AMA sessions. During these sessions, users can create AI-generated images using text prompts, vote on their favorites, and ultimately have the collection minted as an NFT on the Solana blockchain as a singular collage/mosaic.
- Timed Sessions: Administrators can start time-limited image generation sessions
- AI Image Generation: Users can generate images using text prompts
- Voting System: Community voting through Discord reactions (👍 and 👎)
- Collage Creation: Automatically creates a collage of all session images
- NFT Minting: Mints the session collage as an NFT on Eclipse
- MongoDB Integration: Stores all image data and voting results
- Permission System: Admin-only controls for session management
- Node.js (v16 or higher)
- MongoDB database
- Eclipse supported wallet with Native Tokens for minting
- Discord Bot Token
- Discord Developer Application with proper permissions
- Clone the repository:
git clone <repository-url>
cd discord-nft-bot- Install dependencies:
npm install- Create a
.envfile in the root directory:
DISCORD_TOKEN=your_discord_bot_token
MONGODB_URI=your_mongodb_uri
CHANNEL_ID=your_channel_id
SOLANA_PRIVATE_KEY=your_base58_private_key
SOLANA_RPC_URL=your_preferred_rpc_url
AMA_DURATION_MINUTES=60- Build the project:
npm run buildsrc/
├── commands/
│ ├── generate.ts
│ ├── mint.ts
│ └── start-session.ts
├── models/
│ └── schemas.ts
├── services/
│ ├── imageGeneration.ts
│ ├── nftMinting.ts
│ └── collageCreator.ts
├── config.ts
└── index.ts
- Description: Starts a new image generation session
- Usage:
/start-session - Permission: Admin only
- Effect: Initiates a timed session where users can generate images
- Description: Generates an AI image based on a text prompt
- Usage:
/generate prompt:<your prompt> - Permission: All users during active session
- Effect: Creates and posts an AI-generated image that can be voted on
- Description: Creates a collage of session images and mints it as NFT
- Usage:
/mint - Permission: Admin only
- Effect: Generates a collage and mints it on Eclipse
In config.ts:
- Discord Settings
- Token and Channel ID
- Command permissions
- MongoDB Settings
- Database connection URI
- Eclipse Settings
- RPC URL
- Private key handling
- Session Settings
- Duration
- Image limits
- Start in development mode:
npm run dev- Watch for changes:
npm run watch- Run tests:
npm test- Uses external AI service for image generation
- Supports various prompt types
- Image size: 512x512 pixels
- Uses Sharp library for image processing
- Creates optimal grid layout
- No empty spaces or gaps
- Maintains image quality
- Network: Exlipse
- Uses Metaplex for NFT creation
- Includes session metadata
- Sets 5% royalty fee (can be changed at
src\services\nftMinting.ts)
Image Schema:
{
url: string,
prompt: string,
upvotes: number,
downvotes: number,
userId: string,
messageId: string,
createdAt: Date
}User Schema:
{
discordId: string,
images: [ImageSchema]
}- Build the project:
npm run build- Start in production:
npm startFor PM2:
pm2 start npm --name "discord-nft-bot" -- startThe bot includes comprehensive error handling for:
- Discord API issues
- Database connection problems
- Image generation failures
- NFT minting errors
- Invalid user input
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Submit a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
- Check existing issues
- Create a new issue with detailed description
- Join our Discord community
- Never share your private keys
- Keep
.envfile secure - Regularly update dependencies
- Monitor bot permissions