Skip to content

butunghd0-max/python-image-discordbot-experimenting-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Image Transform Discord Bot

A Discord bot that transforms your photos into AI-generated art, powered by Google Gemini (completely free).

Upload a selfie, pet photo, or anything. Pick a style like Anime, Cyberpunk, Ghibli, or Oil Painting and get an AI-generated version in seconds.


Features

Command Description
/transform Transform a photo with a style preset or custom prompt
/compare Side-by-side before & after comparison
/randomstyle Random style surprise
/transform_all Apply all 10 styles at once
React with paint React on any image to auto-transform it

Extras

  • Voting - every result gets reaction buttons so people can vote
  • #ai-gallery - all transformations auto-post to a gallery channel
  • 10 Style Presets - Anime, Oil Painting, Cyberpunk, Watercolor, Pixel Art, Sketch, 3D Render, Fantasy, Pop Art, Ghibli
  • Custom Prompts - write your own style description

Setup

1. Get your API keys

Key Where to get it Cost
Discord Bot Token discord.com/developers Free
Gemini API Key aistudio.google.com/apikey Free (500 images/day)

2. Discord bot configuration

  1. Go to Discord Developer Portal, create a New Application
  2. Go to Bot tab, enable Message Content Intent
  3. Go to OAuth2, URL Generator:
    • Scopes: bot, applications.commands
    • Permissions: Send Messages, Attach Files, Embed Links, Add Reactions, Read Message History
  4. Copy the generated URL and invite the bot to your server

3. Install and run

# Clone the repo
git clone https://github.com/butunghd0-max/python-image-discordbot-experimenting-practice.git
cd python-image-discordbot-experimenting-practice

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env with your Discord bot token and Gemini API key

# Run the bot
python bot.py

4. (Optional) Gallery channel

Create a text channel called #ai-gallery in your Discord server. The bot will automatically post all transformations there.


Project Structure

bot.py              # Main bot - commands, events, and logic
image_transform.py  # Google Gemini API integration
requirements.txt    # Python dependencies
.env.example        # API key template
.gitignore          # Keeps secrets out of git

Tech Stack

  • Python + discord.py - bot framework
  • Google Gemini API (google-genai) - AI image generation (free)
  • Pillow - image processing and comparison generation

Important Notes

  • Never commit your .env file - it contains your secret API keys
  • Gemini free tier allows around 500 image generations per day
  • /transform_all uses 10 API calls at once, use it sparingly
  • The bot needs the Message Content and Reactions intents enabled

Disclaimer

This project is just iseng-iseng doang (just messing around for fun/practice). Just practicing how to incorporate APIs. The bot is essentially gluing the Discord API and Google Gemini API together.

A more serious version will likely be built in Node.js / JavaScript, since I need to learn that for my Computer Science IA. Stay tuned!

Feel free to use and modify this project however you'd like.


References

Discord. "Discord Developer Portal - Documentation." Discord, Discord Inc., 9 Mar. 2026, https://discord.com/developers/docs/intro.

Discord.py. "Discord.py Documentation." Read the Docs, discord.py, 9 Mar. 2026, https://discordpy.readthedocs.io/en/stable/.

Google. "Gemini API: Image Generation." Google AI for Developers, Google, 9 Mar. 2026, https://ai.google.dev/gemini-api/docs/image-generation.

Google. "Google AI Studio: API Keys." Google AI Studio, Google, 9 Mar. 2026, https://aistudio.google.com/apikey.

Google. "Google Gen AI Python SDK." GitHub, Google, 9 Mar. 2026, https://github.com/googleapis/python-genai.

Pillow Contributors. "Pillow (PIL Fork) Documentation." Read the Docs, Pillow, 9 Mar. 2026, https://pillow.readthedocs.io/en/stable/.

Sauber, Sven. "python-dotenv." PyPI, Python Software Foundation, 9 Mar. 2026, https://pypi.org/project/python-dotenv/.

About

iseng doang lol

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages