K
Kord5mo ago
matytyma

Unknown message/webhook/interaction null

All of sudden, I started getting this error message from REST, I haven't changed anything in the code, neither in configuration. Source code of the class it occurs in is here:
object ReportModal : ModalExecutor {
private val REPORT_ROLE_MENTION = "<@&${dotenv["REPORT_ROLE_ID"]}>"

override suspend fun onSubmit(interaction: ModalSubmitInteraction) {
interaction.updateEphemeralMessage {}
val message = unfinishedReports.remove(interaction.user) ?: return
val author = message.author ?: return
val user = interaction.user

interaction.channel.createMessage(REPORT_ROLE_MENTION).delete()
interaction.channel.createMessage {
embed {
title = "Message Report"
// url = message.url()
description = "The following message has been reported for breaking the rules"
field("Reported Message") { message.content }
field("Reason", true) { interaction.textInputs["reason"]!!.value!! }
field("Report Score", true) { "0/$REPORT_SCORE_THRESHOLD" }
// field(message.url(), true)
author {
name = author.effectiveName
icon = author.avatar?.cdnUrl?.toUrl()
}
footer {
text = "Reported by ${user.effectiveName}"
icon = user.avatar?.cdnUrl?.toUrl()
}
}
actionRow {
interactionButton(ButtonStyle.Success, "confirm") { label = "Confirm" }
interactionButton(ButtonStyle.Danger, "reject") { label = "Mark as false" }
}
}.let { pendingReports[it.id] = Report(message, user) }
}
}
object ReportModal : ModalExecutor {
private val REPORT_ROLE_MENTION = "<@&${dotenv["REPORT_ROLE_ID"]}>"

override suspend fun onSubmit(interaction: ModalSubmitInteraction) {
interaction.updateEphemeralMessage {}
val message = unfinishedReports.remove(interaction.user) ?: return
val author = message.author ?: return
val user = interaction.user

interaction.channel.createMessage(REPORT_ROLE_MENTION).delete()
interaction.channel.createMessage {
embed {
title = "Message Report"
// url = message.url()
description = "The following message has been reported for breaking the rules"
field("Reported Message") { message.content }
field("Reason", true) { interaction.textInputs["reason"]!!.value!! }
field("Report Score", true) { "0/$REPORT_SCORE_THRESHOLD" }
// field(message.url(), true)
author {
name = author.effectiveName
icon = author.avatar?.cdnUrl?.toUrl()
}
footer {
text = "Reported by ${user.effectiveName}"
icon = user.avatar?.cdnUrl?.toUrl()
}
}
actionRow {
interactionButton(ButtonStyle.Success, "confirm") { label = "Confirm" }
interactionButton(ButtonStyle.Danger, "reject") { label = "Mark as false" }
}
}.let { pendingReports[it.id] = Report(message, user) }
}
}
Solution:
deferEphemeralMessageUpdate still works though
Jump to solution
11 Replies
matytyma
matytymaOP5mo ago
short stacktrace is on lines 23-31
gdude
gdude5mo ago
you have no timestamps in your log please configure your logger I can't tell what the time scaling is
matytyma
matytymaOP5mo ago
matytyma
matytymaOP5mo ago
min:s.ms
gdude
gdude5mo ago
hmm, ID seems to match
matytyma
matytymaOP5mo ago
interaction.updateEphemeralMessage {} was causing it although, it worked for a long time before
gdude
gdude5mo ago
that only works on the first message of the chain afaik so follow-ups can't be edited at least that's what I recall
matytyma
matytymaOP5mo ago
if I read the KDoc as I did for everything else...
This is not available for ModalSubmitInteractions that do not contain a message.
gdude
gdude5mo ago
ah yep, that'd do it
Solution
matytyma
matytyma5mo ago
deferEphemeralMessageUpdate still works though
gdude
gdude5mo ago
that makes sense, you could follow-up to that
Want results from more Discord servers?
Add your server