🤖 Bot Discord otomatis untuk generate artikel SEO + gambar AI + upload ke Blogger
- Fitur
- Teknologi
- Struktur Proyek
- Prasyarat
- Instalasi
- Konfigurasi
- Cara Menjalankan
- Cara Menggunakan
- Auto Post (Cron)
- Troubleshooting
- Lisensi
- 🧠 Generate Artikel AI — Artikel SEO otomatis menggunakan OpenRouter (Mistral, DeepSeek, dll)
- 🎨 Generate Gambar AI — Ilustrasi otomatis menggunakan Replicate (SDXL)
- 🖼️ Watermark Otomatis — Logo AB CodeWorks ditambahkan ke setiap gambar
- 🚀 Upload ke Blogger — Posting otomatis ke blog Blogger kamu
- 🔍 SEO Optimization — Meta description, keywords, Schema.org JSON-LD, slug, alt text
- 📢 Log ke Discord — Notifikasi embed setiap artikel berhasil diposting
- ⏰ Auto Post — Cron job otomatis setiap Senin jam 09:00 WIB
- 🔒 User Whitelist — Hanya user Discord tertentu yang bisa menggunakan bot
| Teknologi | Kegunaan |
|---|---|
| TypeScript | Bahasa pemrograman utama |
| Discord.js v14 | Framework bot Discord |
| OpenRouter API | Generate artikel & metadata SEO via AI |
| Replicate API | Generate gambar AI (SDXL) |
| Google Blogger API | Upload artikel ke blog |
| Imgur API | Hosting gambar untuk artikel |
| Jimp | Image processing & watermark |
| node-cron | Scheduled auto-post |
ab-codeworks-article-bot/
├── src/
│ ├── index.ts # Entry point
│ ├── bot/
│ │ └── discord.ts # Bot Discord (event handler & cron)
│ ├── config/
│ │ └── keys.ts # Konfigurasi environment variables
│ ├── modules/
│ │ ├── addWatermark.ts # Tambah watermark ke gambar
│ │ ├── articleGenerator.ts # Generate artikel via AI
│ │ ├── imageGenerator.ts # Generate gambar via AI
│ │ └── uploadToBlogger.ts # Upload artikel ke Blogger
│ └── utils/
│ └── helper.ts # Utility functions (SEO, formatting)
├── dist/ # Compiled JavaScript (auto-generated)
├── temp/
│ ├── generated/ # Gambar mentah dari AI
│ └── with_watermark/ # Gambar dengan watermark
├── logo.png # Logo untuk watermark
├── .env # Environment variables (JANGAN di-commit)
├── .env.example # Contoh environment variables
├── .gitignore
├── tsconfig.json
├── package.json
└── README.md
Sebelum memulai, pastikan kamu sudah memiliki:
- Node.js v18 atau lebih baru
- Akun Discord Developer
- Akun OpenRouter (API key)
- Akun Replicate (API token)
- Akun Google Cloud Console (untuk Blogger API)
- Akun Imgur (Client ID)
- Blog di Blogger
https://github.com/abcodeworks-cod/auto-creat-article.git
cd auto-creat-articlenpm installnpm run build- Buka Discord Developer Portal
- Klik "New Application" → beri nama (contoh:
AB CodeWorks Bot) - Masuk ke menu "Bot" → klik "Add Bot" → "Yes, do it!"
- Klik "Reset Token" → copy token (simpan baik-baik!)
- Di bagian "Privileged Gateway Intents", aktifkan:
- ✅ Message Content Intent ← WAJIB AKTIF (untuk membaca command)
- Masuk ke menu "OAuth2" → "URL Generator":
- Scopes:
bot - Bot Permissions:
- ✅
View Channels- melihat channel - ✅
Send Messages- mengirim pesan - ✅
Embed Links- mengirim embed (untuk /help dan log) - ✅
Read Message History- membaca riwayat pesan
- ✅
- Scopes:
- Copy URL yang dihasilkan → buka di browser → pilih server → Authorize
Catatan Penting:
- Message Content Intent adalah privileged intent yang wajib diaktifkan agar bot bisa membaca isi pesan
- Tanpa intent ini, bot tidak akan bisa mendeteksi command
artikel:dan/help - Bot ini hanya menggunakan scope
bot(tidak perluapplications.commandskarena menggunakan message-based commands)
- Daftar di openrouter.ai
- Masuk ke Dashboard → Keys → buat API key baru
- Copy API key
- Buka Google Cloud Console
- Buat project baru atau pilih project yang ada
- Aktifkan Blogger API v3
- Buat OAuth 2.0 Credentials (Client ID + Client Secret)
- Gunakan OAuth Playground untuk mendapatkan Refresh Token
- Scope:
https://www.googleapis.com/auth/blogger
- Scope:
- Dapatkan Blog ID dari URL Blogger kamu:
https://www.blogger.com/blog/posts/1234567890 ← ini Blog ID kamu
- Daftar aplikasi di Imgur API Registration
- Authorization type: OAuth 2 authorization without a callback URL
- Copy Client ID
- Daftar di replicate.com
- Masuk ke Account → API tokens → buat token baru
- Copy API token
Salin file .env.example menjadi .env:
cp .env.example .envLalu isi semua variabel:
# Discord Bot
DISCORD_BOT_TOKEN=token_bot_discord_kamu
DISCORD_LOG_CHANNEL_ID=id_channel_log_kamu
# AI (OpenRouter)
OPENROUTER_API_KEY=sk-or-v1-xxxxx
# Google Blogger
BLOGGER_CLIENT_ID=xxxxx.apps.googleusercontent.com
BLOGGER_CLIENT_SECRET=GOCSPX-xxxxx
BLOGGER_REFRESH_TOKEN=1//xxxxx
BLOGGER_BLOG_ID=1234567890
# Imgur (Image Hosting)
IMGUR_CLIENT_ID=xxxxx
# Replicate (AI Image Generation)
REPLICATE_API_TOKEN=r8_xxxxx
# Izin User (Discord User ID, pisahkan koma)
ALLOWED_DISCORD_IDS=123456789,987654321,CRON
⚠️ PENTING: TambahkanCRONdiALLOWED_DISCORD_IDSjika ingin mengaktifkan auto-post.
- Aktifkan Developer Mode di Discord (Settings → Advanced → Developer Mode)
- Klik kanan pada username → Copy User ID
- Aktifkan Developer Mode
- Klik kanan pada channel → Copy Channel ID
npm run dev# Build TypeScript ke JavaScript
npm run build
# Jalankan bot
npm start# Install PM2
npm install -g pm2
# Jalankan bot
pm2 start dist/index.js --name "ab-codeworks-bot"
# Lihat status
pm2 status
# Lihat log
pm2 logs ab-codeworks-bot
# Restart
pm2 restart ab-codeworks-botBot mendukung beberapa command berikut:
| Command | Deskripsi |
|---|---|
/help atau !help atau help |
Menampilkan panduan penggunaan bot |
artikel: <topik> |
Generate artikel SEO + gambar AI + upload ke Blogger |
Kirim salah satu dari command berikut di Discord:
/help
!help
help
Bot akan membalas dengan embed berisi panduan lengkap penggunaan bot.
Kirim pesan di Discord channel manapun tempat bot berada:
artikel: cara membuat website dengan React
Bot akan otomatis:
- 🧠 Generate artikel SEO menggunakan AI
- 🎨 Generate gambar ilustrasi AI
- 🖼️ Tambahkan watermark logo AB CodeWorks
- 🚀 Upload artikel ke Blogger
- 📢 Kirim notifikasi embed ke channel log
artikel: <topik yang diinginkan>
Contoh:
artikel: tips belajar programming untuk pemula
artikel: review smartphone terbaru 2025
artikel: manfaat olahraga pagi untuk kesehatan
Bot akan otomatis membuat dan memposting artikel trending setiap hari Senin jam 09:00 WIB.
Untuk mengaktifkan fitur ini:
- Pastikan
CRONada diALLOWED_DISCORD_IDS - Pastikan
REPLICATE_API_TOKENsudah diisi di.env
Untuk menonaktifkan, hapus CRON dari ALLOWED_DISCORD_IDS.
💡 Tips: Kamu bisa mengubah jadwal cron di file
src/bot/discord.ts:// Format: detik menit jam tanggal bulan hari cron.schedule('0 9 * * 1', async () => { ... }); // Senin 09:00 cron.schedule('0 9 * * *', async () => { ... }); // Setiap hari 09:00 cron.schedule('0 */6 * * *', async () => { ... }); // Setiap 6 jam
| Masalah | Solusi |
|---|---|
| Bot tidak merespon | Pastikan Message Content Intent aktif di Discord Developer Portal |
❌ Maaf, kamu tidak diizinkan |
Tambahkan Discord User ID kamu ke ALLOWED_DISCORD_IDS |
| Gambar tidak muncul | Periksa REPLICATE_API_TOKEN di .env |
| Upload Blogger gagal | Periksa BLOGGER_REFRESH_TOKEN — mungkin expired, generate ulang |
| TypeScript build error | Jalankan rm -rf dist && npm run build |
| Module not found | Jalankan npm install ulang |
Proyek ini dibuat oleh AB CodeWorks.
Made with ❤️ by AB CodeWorks
Auto Article Generator — SEO Optimized — AI Powered
