When my bot receives DMs:

Initially, when the bot is invited to a guild, it can receive DM messages without any issues. However, after the bot is rebooted, it cannot receive DMs anymore. Has anyone experienced a similar situation and found a solution? Any help would be greatly appreciated!
5 Replies
d.js toolkit
d.js toolkit5d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
treble/luna
treble/luna5d ago
do you have the Channel partial
변상훈
변상훈OP5d ago
const { Client, Events, GatewayIntentBits, ActivityType, ChannelType, VoiceChannel } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.DirectMessages,
],
partials: ['CHANNEL']
});
const { Client, Events, GatewayIntentBits, ActivityType, ChannelType, VoiceChannel } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.DirectMessages,
],
partials: ['CHANNEL']
});
client.on(Events.MessageCreate, async (message) => {
if (!message.author.bot && message.channel.type === ChannelType.DM) {
console.log(`DM received from ${message.author.tag}: ${message.content}`);
await message.channel.send('DM을 관리자에게 전송하였습니다. 답변을 기다려 주세요!');
client.replyUserDm = message.channel;
const master = await client.users.fetch('9999999999999');
master.send(`${message.author.id}`);
master.send(`${message.author.tag}: ${message.content}`);
return; // DM 처리 후 종료
}
}
client.on(Events.MessageCreate, async (message) => {
if (!message.author.bot && message.channel.type === ChannelType.DM) {
console.log(`DM received from ${message.author.tag}: ${message.content}`);
await message.channel.send('DM을 관리자에게 전송하였습니다. 답변을 기다려 주세요!');
client.replyUserDm = message.channel;
const master = await client.users.fetch('9999999999999');
master.send(`${message.author.id}`);
master.send(`${message.author.tag}: ${message.content}`);
return; // DM 처리 후 종료
}
}
here is my code here is my code
d.js docs
d.js docs5d ago
:guide: Popular Topics: Partial Structures read more
변상훈
변상훈OP5d ago
thx bro !👍

Did you find this page helpful?