#text message to channel
1 messages · Page 1 of 1 (latest)
Hi, it's weird, I execute it and shows no errors, but message doesnt go through. Why not, otherwise i will litter the chat
the only permission bot has is "send messages"
is it enough? connects with no problem
do you have the right intents, and is your bot able to actually view the channel
im not sure, i assume you mean scopes and permissions, of which it has these:
you are missing a lot of intents
I've added
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
would that be enough?
compiler throws error: used disallowed intents..
why do you think i said this
i selected every possible permission
oh im starting to understand
where can i find intentions in the dev portal
u mean this place right
I feel like somethings missing but not sure what
// Require the necessary discord.js classes
import { Client, Events, GatewayIntentBits } from 'discord.js';
const token = '';
// Create a new client instance
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers
]
});
const channel = await client.channels.cache.get('');
// Log in to Discord with your client's token
client.login(token);
// When the client is ready, run this code (only once)
// We use 'c' for the event parameter to keep it separate from the already defined 'client'
client.once(Events.ClientReady, (c) => {
console.log(`Ready! Logged in as ${c.user.tag}`);
if (channel?.isTextBased()) {
channel.send('My Message');
}
});
Popular Topics: Gateway Intents