const client = new Discord.Client();
client.login("TOKEN");
var Con = "I love pizza"
var Who = "Maebee"
var NewCon = false
let embed = new Discord.MessageEmbed()
.setTitle(Who + "'s Confession'")
.setColor("RANDOM")
.setDescription(Con)
.setTimestamp
let embed2 = new Discord.MessageEmbed()
.setTitle("Anonymous Confession")
.setColor("RANDOM")
.setDescription(Con)
.setTimestamp()
client.on("ready", () => {
console.log("Bot is ready!");
});
client.on("message", message => {
client.user.setActivity("Anyones Secrets...", { type: "Not Telling" })
//begin coding
if (message.content === "!help"){
message.react("😊")
message.channel.send(`${message.author} Check Your DM's!`)
message.author.send("To confess a confesion please type **!confess** (Withouth the bold).")
}
if(message.channel.type === 'dm') {
if (message.content === "!confess") {
message.channel.send("Ok Great! Please Respond with your confession and start it with | My confession is ")
message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1})
.then(m => {
if(m.first().content.includes("My confession is")) {
Con = m.first().content ///now its saved
Who = m.first().author.username
message.channel.send("Great! Wrote that down! Do you want your name to be shown in your confession? Respond ``Yes`` Or ``No``")
}
message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1})
.then(m => {
if(m.first().content === "Yes")
message.channel.send("Ok sent!")
ERROR:client.guild.channels.fetch('792890482350358538').send("YES");
if (m.first().content != "Yes")
message.channel.send("Ok sent! Not sharing your info!")
ERROR:client.guild.channels.fetch('792890482350358538').send("NO?");
})})}
}})```
I keep getting a error from this code. HELP!!! I've been trying for hours.
I think you should be trying to get client.channels.cache.get('792890482350358538').send("YES");
because the client doesn’t have a guild
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.