Can Discord bots send direct messages to each other?

I’m working on setting up an automation testing system where one Discord bot needs to send private messages to another bot for testing purposes. My primary bot works perfectly when sending DMs to regular users, but when I try to make it send a direct message to my testing bot, it fails completely.

Here’s the code I’m using with discord.js:

user.createDM().then(dmChannel => {
    dmChannel.send('private message between bots');
});

But I keep getting this error message:

DiscordAPIError: Cannot send messages to this user

Both of my bots can receive and send DMs to human users without any problems. Is this a limitation built into Discord’s API, or is there some configuration I’m missing? I really need this functionality to properly test my bot’s private messaging features. Any suggestions for alternative approaches would be helpful too.

Discord blocks bots from DMing each other - it’s built into their API to stop spam networks and automated abuse. I hit this same wall building a multi-bot system last year and had to redesign everything. Best workaround I found? Create a private server with both bots and use a locked-down channel where only they can talk. Same isolated communication, no rule breaking. You could also set up HTTP webhooks or use Redis for messaging outside Discord completely. That route actually worked better for my testing since you’re not fighting Discord’s rate limits.

Yeah, this restriction caught me off guard on my first multi-bot project too. Discord blocks bot-to-bot DMs as an anti-spam measure, so your code’s fine. I ended up using MongoDB where both bots write and read from the same collection. Honestly worked better than Discord DMs for testing since you control message delivery and can simulate stuff like delays or connection failures. Also tried a simple Express server with REST endpoints for the bots to exchange data. The database approach gave me way better logging for debugging automation tests than Discord’s API would’ve anyway.

yea, it’s a bummer but bots can’t DM each other due to discord’s spam prevention rules. best bet is to make a test server with private channels for ur bots. this way you can test DM stuff without breaking any rules. it works!