#how do i give my bot all intents

77 messages · Page 1 of 1 (latest)

prisma tusk
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

#

Like bro

#

Why do you need an intent for your bot existing

bright fjord
#

Import it from discord.js

prisma tusk
#

I did

charred dagger
#

That’s not what you use though…

prisma tusk
#

what do you use

charred dagger
#

you use GatewayIntentBits but import IntentsBitField

prisma tusk
#

oho kay

#

ill test it

#

and fix that

#
const Discord = require('discord.js')
const { Client, GatewayIntentBits } = require('discord.js');
const fs = require('fs');
const config = require('./config.json')

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers,
    ],
});

client.on('message', (message) => {
    if (message.content==='hi'){
        message.channel.send('hey')
    }
    console.log(message.content)
})```
#

this is my code

#

the command doesnt work something abt how i set it up but new djs is so confusing

#

what am i doing wrong

plain valeBOT
#

Tag suggestion for @prisma tusk:
The message and interaction events were renamed to messageCreate and interactionCreate respectively, to bring the library in line with Discord's naming conventions.

- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });
prisma tusk
#

Ohhh

#

Stop changing stuff

#

💢

fresh fable
#

stop upgrading version without reading breaking changes

prisma tusk
#

works ty

arctic barn
#

choosing what intents u need greatly increases peformance

prisma tusk
#

Oh

#

also what is the intent for

#

message content in dms

#

why is it different

#

alr got it

#
if (message.channel.type =='dm'){
        message.channel.send('hey')
    }```
#

this isnt working

fresh fable
prisma tusk
#

What version is the latest

fresh fable
#

14.6.0

prisma tusk
#

the docs are really confusing

#

is this the right site

arctic barn
#

if u look at the updating guide it covers the breaking changes

prisma tusk
#

Okay

arctic barn
prisma tusk
#

isDM()

prisma tusk
#

got it

fresh fable
#

.isDMBased() man

prisma tusk
#

oh

#
    if (message.channel.type===ChannelType.DM){
        console.log('dmed!')
    }```
not working 😦
#

same with isDMBasd() i tried both

plain valeBOT
#

Tag suggestion for @prisma tusk:
To receive direct message events on "messageCreate" with your bot, you will need:
• The DirectMessages gateway intent
• The Channel partial setting

prisma tusk
fresh fable
#

missing partial

prisma tusk
#

alright

fresh fable
#

in an array man

#

please read correctly

prisma tusk
#

yup it worked tho

#

without array

#

ok tahts it close this

#

wait how do i

#

set status tho

#

for the bot

#

its not in the breaking changes

#

or is it the same

#

i dont need intent for that right

#

nope

#

not setactivity

plain valeBOT
prisma tusk
fast harness
#

You can't

prisma tusk
#

alright

#

client.user.setPresence('hey')

#

this isnt working btw

#

no errorr but it just doesn't change the presence

arctic barn