owner.send isn't working properly

Hey, for some reason when I my bot runs this if statement:
if (await isToggled(guildId2) === true) {
await guild.fetchOwner().then(async (owner) => {
const embed = new EmbedBuilder()
.setTitle('Partnership Accepted!')
.setColor('Green')
.setDescription(`${interaction.guild.name} accepted a partnership requested by ${guild.name}'s Auto-Partner module`)
.setTimestamp()
await owner.send({embeds: [embed]})
await interaction.followUp("Done!")
return
})}
if (await isToggled(guildId2) === true) {
await guild.fetchOwner().then(async (owner) => {
const embed = new EmbedBuilder()
.setTitle('Partnership Accepted!')
.setColor('Green')
.setDescription(`${interaction.guild.name} accepted a partnership requested by ${guild.name}'s Auto-Partner module`)
.setTimestamp()
await owner.send({embeds: [embed]})
await interaction.followUp("Done!")
return
})}
it doesn't work for some reason. And yes, isToggled does return to true but the owner.send() function is not sending the owner a message guild variable code:
const guild = await client.guilds.fetch(guildId)
const guild = await client.guilds.fetch(guildId)
4 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs3mo ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. - Once you do, log relevant values and if-conditions - More sophisticated debugging methods are breakpoints and runtime inspections: learn more
Steve Jobs
Steve Jobs3mo ago
Everything works perfectly fine, no errors or nothing, except the part were the bot doesn't DM the owner variable Ok Yeah the followUp happens but not the owner.send Hm, I'm currently testing the bot myself and my DMs are open. Basically the whole point here is to DM me the owner (myself here) No, but I'm going to make one soon. I tried await owner.send already, and I got the same unwanted results I'll try to do .catch Update: I did both things and it didn't worked. I tried catching the error/bug and I have nothing displayed on my terminal
else if (interaction.customId == "deny_partner") {
await row.components[0].setDisabled(true)
await row.components[1].setDisabled(true)
await interaction.update({components: [row]})
collector.stop()
const guildId3 = await interaction.client.guilds.fetch(guild).then(guild => guild.id)
if (await isToggled(guildId3) === true) {
await guild.fetchOwner().then(async (owner) => {
console.log(`Owner's username: ${owner.user}`); // Log the owner's username
const embed = new EmbedBuilder()
.setTitle('Partnership Declined')
.setColor('Red')
.setDescription(`${interaction.guild.name} declined a partnership requested by ${guild.name}'s Auto-Partner module`)
.setTimestamp()
await owner.send({embeds: [embed]}).catch(error => {
console.log(error)
return
})
await interaction.followUp("Done!")
return
})}
else {
await interaction.followUp("Done!")
return
}
}
else if (interaction.customId == "deny_partner") {
await row.components[0].setDisabled(true)
await row.components[1].setDisabled(true)
await interaction.update({components: [row]})
collector.stop()
const guildId3 = await interaction.client.guilds.fetch(guild).then(guild => guild.id)
if (await isToggled(guildId3) === true) {
await guild.fetchOwner().then(async (owner) => {
console.log(`Owner's username: ${owner.user}`); // Log the owner's username
const embed = new EmbedBuilder()
.setTitle('Partnership Declined')
.setColor('Red')
.setDescription(`${interaction.guild.name} declined a partnership requested by ${guild.name}'s Auto-Partner module`)
.setTimestamp()
await owner.send({embeds: [embed]}).catch(error => {
console.log(error)
return
})
await interaction.followUp("Done!")
return
})}
else {
await interaction.followUp("Done!")
return
}
}
@Qjuh
const guild = await client.guilds.fetch(guildId)
const guild = await client.guilds.fetch(guildId)
d.js docs
d.js docs3mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
Want results from more Discord servers?
Add your server
More Posts