Can't DM My Bot But Other People Can

I often send DMs to my bot as it is an easy way for me to keep notes of things, but lately I've found that the messages aren't being sent. Other people who send a DM to the bot get a message back saying that the bot isn't programmed to respond to such messages, but when I try it I get 'Your message could not be delivered. This is usually because you don't share a server with the recipient or the recipient is only accepting direct messages from friends.'
client.on('messageCreate', async message => {

if (message.channel.type == '1')
{
if (message.author.id != <BOT ID> && message.author.id != <MY ID>)
{
client.users.send(message.author.id, '**ERROR:** This bot is not programmed to receive Direct Messages.');
await client.guilds.cache.get("SERVER ID").channels.cache.get("CHANNEL ID").send('Received a Direct Message\n\n**MESSAGE CONTENT:** ' + message.content + '\n**SENT BY:** ' + message.author.username + '\n**USER ID:** ' + message.author.id) // Make a note of the message content, JIC.
}
}
})
client.on('messageCreate', async message => {

if (message.channel.type == '1')
{
if (message.author.id != <BOT ID> && message.author.id != <MY ID>)
{
client.users.send(message.author.id, '**ERROR:** This bot is not programmed to receive Direct Messages.');
await client.guilds.cache.get("SERVER ID").channels.cache.get("CHANNEL ID").send('Received a Direct Message\n\n**MESSAGE CONTENT:** ' + message.content + '\n**SENT BY:** ' + message.author.username + '\n**USER ID:** ' + message.author.id) // Make a note of the message content, JIC.
}
}
})
Not really sure why this is happening. Have I overlooked or missed something?
4 Replies
Kinect3000
Kinect30002y ago
Channel types are number, not string I’d just use ChannelType.DM
GeodesicDragon
I know it's a number; it still responds to other people as I said even with the 1 in single quotes. What I'm trying to figure out is why I can't send it any messages.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
GeodesicDragon
I managed to fix it myself. Thanks anyway.