Skip to content

A discord bot to auto-publish / crosspost messages of an announcement channel to other server

License

Notifications You must be signed in to change notification settings

rounak-codes/discord-autopublish-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord AutoPublish Bot Logo

# 📢 Discord AutoPublish Bot

A lightweight Discord bot that automatically crossposts messages in Announcement channels.

Built with:

  • Node.js
  • discord.js v14
  • MongoDB (Mongoose)

✨ Features

  • 🔄 Automatically publishes new messages in announcement channels
  • 🎛 Enable/disable auto-publish per server
  • 📋 Channel whitelist support
  • 📊 View current whitelisted channels
  • 🧠 MongoDB-backed persistent configuration
  • ⚡ Optimized for low-resource hosting (256MB environments supported)

🚀 Commands

Enable / Disable


/autopublish toggle state:true
/autopublish toggle state:false

Add or Remove Whitelisted Channel


/autopublish channel target:#announcements action:add
/autopublish channel target:#announcements action:remove

View Whitelisted Channels


/autopublish list


🧠 How It Works

  • If whitelist is empty → bot publishes in all announcement channels.
  • If whitelist contains channels → bot publishes only in those channels.
  • Discord rate limit: 10 publishes per hour per channel (handled automatically).

📦 Installation

1️⃣ Clone Repository

git clone https://github.com/YOUR_USERNAME/discord-autopublish-bot.git
cd discord-autopublish-bot

2️⃣ Install Dependencies

npm install

3️⃣ Create .env

DISCORD_TOKEN=your_bot_token
CLIENT_ID=your_application_id
MONGO_URI=your_mongodb_connection_string

4️⃣ Register Slash Commands

node deploy-commands.js

5️⃣ Start Bot

npm start

🏗 Deployment

Designed to run as a background Node process.

Recommended:

  • 256MB RAM minimum
  • Persistent WebSocket support
  • No HTTP server required

Works on:

  • VPS
  • Docker
  • Container-based hosts
  • Lightweight free-tier platforms

🔐 Required Bot Permissions

For announcement channels:

  • View Channel
  • Send Messages
  • Manage Messages

Channel must be of type:

Announcement Channel

📁 Project Structure

src/
  commands/
  events/
  models/
  index.js
deploy-commands.js

⚠️ Notes

  • Skipped messages (due to rate limit or downtime) are not retroactively published.
  • Discord enforces publish limits.
  • Slash command changes require re-running deploy-commands.js.

About

A discord bot to auto-publish / crosspost messages of an announcement channel to other server

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published