Issues with sending messages.

Lately I've been coming across an very odd issue, the application fails to followUp or editReply reaction messages as well as send anything to a logging webhook I have setup. For example I'm current using the ping slash command example that is on the GitHub. It only sends the Ping? and is unable to edit the message after that. Not really sure how to explain this but if anyone would be willing to help me track down this issue it would be greatfull.
No description
Solution:
Nonsense, then it would be more wide spread across many users because everyone is using the same interactionCreate listener. Furthermore the fact that Jonny also has issues sending webhook messages, that's completely devoid of listeners. It's not the first time djs support people point straight back to sapphire Without proper consideration. (cc @vladdy can we, through the staff, do something about this?)...
Jump to solution
18 Replies
MRDGH2821
MRDGH2821•6mo ago
I'm getting a feeling that your network responses are slow. But that shouldn't be a problem still 🤔 Can you try again with defer reply enabled?
chmod
chmod•6mo ago
I might have the same issue deferReply does error but shows thinking... in discord right? code crashes and can't reply because of unknown interaction and it stays thinking forever right?
Jonny
JonnyOP•6mo ago
Correct Just thinking with no errors
chmod
chmod•6mo ago
To further narrow down, are you calling deferReply? And does deffering throw an error?
Jonny
JonnyOP•6mo ago
Yes I call deferreply. But I get no error.
chmod
chmod•6mo ago
Does followUp right afterwards result in specifically unknown webhook?
Jonny
JonnyOP•6mo ago
No just no response or error. And this only happens sometimes. I have a webhook class setup that send my logs.
import { container } from '@sapphire/framework';
import { WebhookClient, EmbedBuilder } from 'discord.js';

export default class Logging {
private webhookClient: WebhookClient;

constructor(webhookURL: string) {
this.webhookClient = new WebhookClient({ url: webhookURL });
}

public logError(title: string, error: Error) {
const embed = new EmbedBuilder()
.setTitle(title)
.setColor('#FF0000')
.setTimestamp()
.setDescription(`\`\`\`${error.stack}\`\`\``);

if (container.client.user) {
embed.setThumbnail(container.client.user.displayAvatarURL());
embed.setAuthor({ name: container.client.user.tag, iconURL: container.client.user.displayAvatarURL() })
}

this.webhookClient.send({ embeds: [embed] }).catch(console.error);
}

public logWarning(title: string, warning: string) {
const embed = new EmbedBuilder()
.setTitle(title)
.setColor('#FFFF00')
.setTimestamp()
.setDescription(warning);

if (container.client.user) {
embed.setThumbnail(container.client.user.displayAvatarURL());
embed.setAuthor({ name: container.client.user.tag, iconURL: container.client.user.displayAvatarURL() })
}

this.webhookClient.send({ embeds: [embed] }).catch(console.error);
}

public logInfo(title: string, info: string) {
const embed = new EmbedBuilder()
.setTitle(title)
.setColor('#00FF00')
.setTimestamp()
.setDescription(info);

if (container.client.user) {
embed.setThumbnail(container.client.user.displayAvatarURL());
embed.setAuthor({ name: container.client.user.tag, iconURL: container.client.user.displayAvatarURL() })
}

this.webhookClient.send({ embeds: [embed] }).catch(console.error);
}
}
import { container } from '@sapphire/framework';
import { WebhookClient, EmbedBuilder } from 'discord.js';

export default class Logging {
private webhookClient: WebhookClient;

constructor(webhookURL: string) {
this.webhookClient = new WebhookClient({ url: webhookURL });
}

public logError(title: string, error: Error) {
const embed = new EmbedBuilder()
.setTitle(title)
.setColor('#FF0000')
.setTimestamp()
.setDescription(`\`\`\`${error.stack}\`\`\``);

if (container.client.user) {
embed.setThumbnail(container.client.user.displayAvatarURL());
embed.setAuthor({ name: container.client.user.tag, iconURL: container.client.user.displayAvatarURL() })
}

this.webhookClient.send({ embeds: [embed] }).catch(console.error);
}

public logWarning(title: string, warning: string) {
const embed = new EmbedBuilder()
.setTitle(title)
.setColor('#FFFF00')
.setTimestamp()
.setDescription(warning);

if (container.client.user) {
embed.setThumbnail(container.client.user.displayAvatarURL());
embed.setAuthor({ name: container.client.user.tag, iconURL: container.client.user.displayAvatarURL() })
}

this.webhookClient.send({ embeds: [embed] }).catch(console.error);
}

public logInfo(title: string, info: string) {
const embed = new EmbedBuilder()
.setTitle(title)
.setColor('#00FF00')
.setTimestamp()
.setDescription(info);

if (container.client.user) {
embed.setThumbnail(container.client.user.displayAvatarURL());
embed.setAuthor({ name: container.client.user.tag, iconURL: container.client.user.displayAvatarURL() })
}

this.webhookClient.send({ embeds: [embed] }).catch(console.error);
}
}
I send all logs using this webhook right.
Jonny
JonnyOP•6mo ago
When i start my bot I send these.
No description
Jonny
JonnyOP•6mo ago
There are times when I start my bot those logs will not be sent, and then any deferred message or any message I try to edit just hangs with 0 errors.
chmod
chmod•6mo ago
Can't say anything about your initial logging webhooks, those honestly look completely fine although I'm not in the same situation. I'm dealing only with the hanging defers that happen randomly in production when responding to command interactions, trying to figure out if we're in the same boat with that
Jonny
JonnyOP•6mo ago
Yeah I have no idea.
Favna
Favna•6mo ago
FWIW this is not a sapphire issue. This is all discordjs code.
Jonny
JonnyOP•6mo ago
I use sapphire tho
chmod
chmod•6mo ago
DJs people said multiple listeners could be it
MRDGH2821
MRDGH2821•6mo ago
Sapphire is built around djs.
Solution
Favna
Favna•6mo ago
Nonsense, then it would be more wide spread across many users because everyone is using the same interactionCreate listener. Furthermore the fact that Jonny also has issues sending webhook messages, that's completely devoid of listeners. It's not the first time djs support people point straight back to sapphire Without proper consideration. (cc @vladdy can we, through the staff, do something about this?)
Favna
Favna•6mo ago
I'm honestly in camp network related when you say you cannot even send webhook messages @Jonny
Want results from more Discord servers?
Add your server