Globy CV2 is a production-oriented Discord cross-server communication bot. Server admins choose a channel, and immediately starts mirroring messages across every connected channel using Discord webhooks.
Created by Adhi (itzadhi). If this project helps you, please star the repository and follow itzadhi to support more scalable Discord bot projects.
The project is built with:
- Node.js
- discord.js v14.26+
- MongoDB with Mongoose
The architecture is intentionally simple: commands call services, services use models, and MongoDB stays the source of truth.
Globy CV2 is created by Adhi.
- GitHub username:
itzadhi - Display name:
Adhi - Full credit page: docs/CREDITS.md
- Detailed project guide: docs/PROJECT_GUIDE.md
You can edit, fork, host, customize, and build on this project freely. The main required clause is that public copies, forks, deployments, showcases, tutorials, and redistributed versions must keep clear credit:
Globy CV2 by Adhi (GitHub: itzadhi)
See LICENSE.md for the full credit-required license.
- Syncs messages across servers in real time
- Uses webhooks so synced messages keep the real username and avatar
- Keeps synced webhook messages clean: only the user message content is shown
- Supports text, replies, attachments, stickers, emoji, edits, and deletes
- Stores message recovery data in MongoDB
- Rebuilds broken webhook messages with
/recovermessages - Tracks global XP, levels, and message counts
- Blocks dangerous pings before sync
- Filters spam, scam patterns, invite links, caps spam, repeat spam, and emoji spam
- Supports slash commands, comma-prefix commands, and developer-granted no-prefix commands
- Uses clean Discord Components V2 panels for command UI
- Preloads commands and webhook cache at startup
src/
├── commands/ Slash commands
├── prefixCommands/ Comma-prefix and no-prefix message commands
├── events/ Discord gateway event listeners
├── handlers/ Startup command/event loaders
├── models/ Mongoose schemas
├── services/ Sync, webhook, XP, recovery, moderation, and health logic
├── middleware/ Permission checks
├── utils/ Text, time, Components V2, logging, and file helpers
├── cache/ In-memory cooldown/webhook caches
└── config/ Environment and UI configuration
npm installUse Node.js 18.17 or newer.
Create .env from the example:
cp .env.example .envOn PowerShell:
Copy-Item .env.example .envSimple .env:
DISCORD_TOKEN=your_bot_token
CLIENT_ID=your_application_id
MONGO_URI=your_mongodb_connection_string
DEV_IDS=your_discord_user_id
PREFIX=,
DEFAULT_SYNC_MODE=plain
BOT_TAGLINE=A premium cross-server Discord bot for webhook chat, profiles, moderation, and recovery.
BOT_STATUS=Made by Adhi
The bot still supports advanced optional variables such as NO_PREFIX_ENABLED, WEBHOOK_NAME, SYNC_QUEUE_DELAY, MESSAGE_SPAM_LIMIT, CV2_WEBHOOK_USERNAME, and link settings, but you do not need them for a normal setup.
No-prefix access is automatic for DEV_IDS. Extra users must be granted by a bot developer with /noprefix add or ,noprefix add.
Never commit .env. It is ignored by Git.
In the Discord Developer Portal:
- Open your application.
- Go to the Bot page.
- Enable these privileged intents:
- Server Members Intent
- Message Content Intent
- Copy the bot token into
.env. - Copy the application ID into
CLIENT_ID.
Invite the bot with:
botapplications.commands
Recommended bot permissions:
- View Channel
- Send Messages
- Manage Webhooks
- Embed Links
- Attach Files
- Read Message History
- Manage Messages
Webhook sync will not work without Manage Webhooks in every connected channel.
Deploy global commands:
npm run deploy:commandsThe deploy script prints the command names Discord accepted. Global commands can take time to appear in the Discord client.
For instant testing in one server, set a guild ID:
$env:DEPLOY_GUILD_ID="your_test_server_id"
$env:DEPLOY_SCOPE="guild"
npm run deploy:commandsDeploy both guild and global:
$env:DEPLOY_GUILD_ID="your_test_server_id"
$env:DEPLOY_SCOPE="both"
npm run deploy:commandsIf slash commands are not showing:
- Run
npm run deploy:commands. - Check that the bot was invited with
applications.commands. - If using global deploy, wait for Discord propagation.
- For immediate testing, use
DEPLOY_SCOPE=guild. - Make sure you are using the same
CLIENT_IDas the bot token.
npm startHealth endpoints:
GET /
GET /health
Only the server owner or a user with Administrator permission can connect channels.
Slash:
/setchannel type:plain channel:#global-chat
/setchannel type:cv2
Prefix:
,setchannel plain
,setchannel #global-chat plain
,setchannel #global-chat cv2
Run the same setup command in each server/channel you want connected. There is no extra routing argument to type.
Each connected channel can choose its own message style:
plain: synced messages use the real sender username and avatar as the webhook identity, then show only the message content.cv2: synced messages use the bot identity and show a premium Components V2 card with the sender avatar, exact username, level, message, attachments, and source channel info.
Slash examples:
/setchannel type:plain
/setchannel type:cv2
Prefix examples:
,setchannel plain
,setchannel cv2
The style is required every time you run setup. Running /setchannel again on an already connected channel updates the style instead of making you remove and reconnect it.
Use this first when sync or webhooks do not work.
Slash:
/synchealth channel:#global-chat repair:true
Prefix:
,synchealth #global-chat repair
It reports:
- Whether the channel is connected
- Target channel count
- Webhook status
- Missing bot permissions
- Failed webhook copies
- Stored failure count
Recover missing or deleted webhook messages:
/recovermessages limit:25 force:true
Prefix:
,recovermessages 25 force
Recovery reads MongoDB MessageLogs, recreates missing webhook copies, avoids healthy duplicates, and queues sends to reduce rate-limit risk.
General:
/help,,help/ping,,ping/stats,,stats/avatar,,avatar/invite,,invite/about,,about
Sync:
/setchannel,,setchannel/removechannel,,removechannel/synchealth,,synchealth/recovermessages,,recovermessages
Dev (bot developers only):
/gban,,gban/gunban,,gunban/gmute,,gmute/gunmute,,gunmute/gwarn,,gwarn/purge,,purge/noprefix,,noprefix/botguild,,botguild
/botguild and ,botguild can list bot servers, show server details, create an invite for a server the bot is already in, make the bot leave a server, and generate the OAuth link needed to add the bot to a new server. Discord does not allow bots to self-join servers without a user authorizing the OAuth invite.
Bot developers are defined in .env:
DEV_IDS=123456789012345678
Developers can grant no-prefix access:
/noprefix add user:@User reason:Trusted staff
,noprefix add @User Trusted staff
Remove access:
/noprefix remove user:@User
,noprefix remove @User
A no-prefix user can run:
ping
help sync
No-prefix command messages are handled before sync, so they will not be mirrored to other servers.
For each connected channel, Globy CV2:
- Checks bot permissions.
- Finds or creates a webhook.
- Stores webhook ID/token in MongoDB.
- Caches webhook credentials in memory.
- Sends synced messages through the target channel webhook.
- Stores every webhook message ID for edits, deletes, and recovery.
- Recreates broken webhooks when Discord reports deleted/invalid webhook errors.
The receiving channel's selected style controls the webhook payload. One server can keep plain while another server receives the same synced chat in cv2 card style.
Attachments are uploaded when small enough. If upload fails or the file is too large, Globy CV2 keeps the sync alive and includes clean attachment links instead of failing the whole webhook send.
When uploads succeed, attachments are not repeated as extra link text. If an upload fails, the same message falls back to safe link-only attachment output.
Startup preloading warms:
- Slash command registry
- Prefix and no-prefix command registry
- Saved webhook credentials from MongoDB
Before syncing, Globy CV2 checks:
@everyoneand@here- Role mention abuse
- Mass mention spam
- Invite links
- Scam patterns
- Toxic words from
TOXIC_WORDS - Excessive caps
- Repeated messages
- Emoji spam
- Rapid spam
- Global bans and mutes
Synced webhook messages use empty allowedMentions, so dangerous mentions cannot ping people across servers.
Users: basic Discord user cacheGuilds: server settings and sync stateNetworks: internal routing stats and feature switchesChannels: connected channels and webhook credentialsProfiles: XP, level, and message countsXPs: XP audit eventsModerationLogs: blocked messages, actions, webhook failures, recovery logsBlacklists: global bans, mutes, warningsMessageLogs: original and webhook message mapping for recoverySettings: future scoped settingsNoPrefixUsers: developer-granted no-prefix access
Slash commands do not show:
- Run
npm run deploy:commands. - Confirm
CLIENT_IDis the application ID. - Reinvite the bot with
applications.commands. - Use guild deploy for instant testing.
Messages do not sync:
- Run
/synchealth repair:true. - Make sure
/setchannelhas been run in both channels. - Check
Manage Webhooks,View Channel,Send Messages,Embed Links,Attach Files, andRead Message History.
Webhooks fail:
- Run
/synchealth repair:true. - Check whether another bot/user deleted the webhook.
- Re-run
/setchannelif the channel was deleted and recreated. - Use
/recovermessagesafter repairing.
- Rotate tokens immediately if they are shared anywhere.
- Use MongoDB Atlas backups.
- Keep
SYNC_QUEUE_DELAYabove500msfor large deployments. - Monitor
MessageLogsgrowth. - Use
/synchealthafter permission or channel changes.
