πŸš€ How to Create an Automated AI Blog with Discord, Docker, and Cloudflare

This guide shows you how to build a fully automated blog where you create posts via Discord and publish them automatically using AI.


🧠 Architecture

Discord β†’ Bot β†’ AI β†’ GitHub β†’ Hugo β†’ Cloudflare Pages


πŸ“¦ Prerequisites

  • GitHub\
  • Cloudflare\
  • Linux Server (Ubuntu)\
  • Docker\
  • Discord\
  • AI API

🐧 Server Setup

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io -y
sudo systemctl enable docker
sudo systemctl start docker

Docker Permission:
sudo usermod -aG docker $USER


πŸ€– Bot on Discord

  1. Create application\
  2. Add bot\
  3. Copy token\
  4. Enable MESSAGE CONTENT INTENT

πŸ” Environment Variables

OPENROUTER_API_KEY=
GITHUB_TOKEN=
REPO_BLOG=
DISCORD_TOKEN=

⚠️ Never version .env


πŸ“‚ Project Structure

project/
β”œβ”€β”€ main.py
β”œβ”€β”€ blog/
β”‚ └── content/posts/
β”œβ”€β”€ scripts/
└── .env


🧠 Bot Functionalities

!write
!preview
!publish
!posts
!delete
!rename
!retranslate


🌍 Multi-language

post.pt.md
post.en.md
post.es.md


☁️ Cloudflare Pages

Build:
cd blog && hugo –gc –minify

Output:
blog/public


πŸ”„ Auto deploy

Script detects changes in Git and restarts the container only when necessary.


⏱️ Cron

*/2 * * * * bash update-bot.sh >> log.log 2>&1


πŸš€ Result

  • Content via Discord\
  • Automatic publication\
  • Continuous deployment\
  • Multi-language

🧠 Conclusion

You have created a modern, automated, and scalable blog.