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 toolkit2y 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
ToastyOP2y ago
channel.send( "Hey I'm Dank Memer" ) ^ is my error
MrMythical
MrMythical2y 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
ToastyOP2y ago
v18.16.0 oh my u ment djs [email protected]
MrMythical
MrMythical2y ago
Yeah your code is outdated
Toasty
ToastyOP2y ago
How do I update without messing up everything I have done so far..
MrMythical
MrMythical2y ago
There are update guides
d.js docs
d.js docs2y 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
ToastyOP2y ago
I have verison 14 tho
MrMythical
MrMythical2y ago
Ok but your code isn't for v14
Toasty
ToastyOP2y ago
oh ok so I just have to re write my code not update correct?
MrMythical
MrMythical2y ago
Yeah
Toasty
ToastyOP2y ago
How would I rewrite it?
MrMythical
MrMythical2y ago
You read the update guide
Toasty
ToastyOP2y ago
Toasty
ToastyOP2y ago
But I get the error ReferenceError: ChannelType is not defined
MrMythical
MrMythical2y ago
Then define it
Toasty
ToastyOP2y ago
Where???
MrMythical
MrMythical2y ago
At the top of the file, probably
Want results from more Discord servers?
Add your server