matytyma
matytyma
KKord
Created by matytyma on 7/10/2024 in #help
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) }
}
}
19 replies
KKord
Created by matytyma on 6/26/2024 in #help
Passing data through interactions
Is there a way to pass some data (e.g. message ID) through multiple interactions? I'd like to make a message command, which opens a modal and then uses data from the original message and the modal. I know that there is customContext property, but dunno if it's somehow related to that. Or should I just create an object holding my data and store it until used or a certain amount of time is reached?
5 replies
KKord
Created by matytyma on 6/21/2024 in #help
Managing commands
How do you usually manage your commands, how do you get rid of the old ones? Do you delete every command on startup?
4 replies
KKord
Created by matytyma on 5/19/2023 in #help
Responses to messages
3 things I'd like to: 1. Check if the message is a response 2. Get the message this message responds to 3. (Optionally) get the same but from a message that is a response to a MessageContextMenuCommand
121 replies
KKord
Created by matytyma on 5/6/2023 in #help
Delete commands
How would I go to delete specific/all application commands?
2 replies