xxhxxstxd sxnsx
DIAdiscord.js - Imagine a bot
•Created by xxhxxstxd sxnsx on 10/8/2023 in #djs-questions
How to send message to channel?
client.on('messageCreate', (message) => {
if (message.content === 'embed') {
const embed = new EmbedBuilder()
.setTitle('Embed title')
.setDescription('This is an embed desription')
.setColor('Random')
.addFields({
name: 'Field title',
value: 'Some random value',
inline: true,
});
//interaction.reply({ embeds: [embed] });
message.channel.send({ embeds: [embed] });
}
});
E:\Code)\DiscordBot\src\index.js:42
message.channel.send({ embeds: [embed] });
^
ReferenceError: message is not defined
at Client.<anonymous> (E:\Code)\DiscordBot\src\index.js:42:9)
at Client.emit (node:events:517:28)
at InteractionCreateAction.handle (E:\Code)\DiscordBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (E:\Code)\DiscordBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (E:\Code)\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (E:\Code)\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:239:12)
at WebSocketManager.emit (E:\Code)\DiscordBot\node_modules@vladfrangu\async_event_emitter\dist\index.js:282:31)
at WebSocketShard.<anonymous> (E:\Code)\DiscordBot\node_modules@discordjs\ws\dist\index.js:1173:51)
at WebSocketShard.emit (E:\Code)\DiscordBot\node_modules@vladfrangu\async_event_emitter\dist\index.js:282:31)
at WebSocketShard.onMessage (E:\Code)\DiscordBot\node_modules@discordjs\ws\dist\index.js:988:14)
Node.js v18.18.0
[nodemon] app crashed - waiting for file changes before starting..3 replies