Send welcome message in random channel when bot is invited!

js
client.on(Events.GuildCreate, g => {

const channel = g.channels.cache.find(channel => channel.type === 'text' && channel.permissionsFor(g.me).has('SEND_MESSAGES'))
channel.send( "Hey I'm Dank Memer" )

})
js
client.on(Events.GuildCreate, g => {

const channel = g.channels.cache.find(channel => channel.type === 'text' && channel.permissionsFor(g.me).has('SEND_MESSAGES'))
channel.send( "Hey I'm Dank Memer" )

})
19 Replies
d.js toolkit
d.js toolkit17mo ago
- 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. - Issue solved? Press the button!
Toasty
ToastyOP17mo ago
channel.send( "Hey I'm Dank Memer" ) ^ is my error
MrMythical
MrMythical17mo ago
That's just the line with the error, not the error itself This looks like old djs code, what version are you on?
Toasty
ToastyOP17mo ago
v18.16.0 oh my u ment djs [email protected]
MrMythical
MrMythical17mo ago
Yeah your code is outdated
Toasty
ToastyOP17mo ago
How do I update without messing up everything I have done so far..
MrMythical
MrMythical17mo ago
There are update guides
d.js docs
d.js docs17mo ago
Version 14 has released! Please update at your earliest convenience. - Update: npm rm discord.js npm i discord.js - Update guide (use CTRL + F to search for the old method or property)
Toasty
ToastyOP17mo ago
I have verison 14 tho
MrMythical
MrMythical17mo ago
Ok but your code isn't for v14
Toasty
ToastyOP17mo ago
oh ok so I just have to re write my code not update correct?
MrMythical
MrMythical17mo ago
Yeah
Toasty
ToastyOP17mo ago
How would I rewrite it?
MrMythical
MrMythical17mo ago
You read the update guide
Toasty
ToastyOP17mo ago
Toasty
ToastyOP17mo ago
But I get the error ReferenceError: ChannelType is not defined
MrMythical
MrMythical17mo ago
Then define it
Toasty
ToastyOP17mo ago
Where???
MrMythical
MrMythical17mo ago
At the top of the file, probably
Want results from more Discord servers?
Add your server