K
Kordā€¢17mo ago
matytyma

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
65 Replies
matytyma
matytymaā€¢17mo ago
I have tried to search for interfaces to cast to, but no result...
Unknown User
Unknown Userā€¢17mo ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown Userā€¢17mo ago
Message Not Public
Sign In & Join Server To View
SchlaubiBus
SchlaubiBusā€¢17mo ago
ig not sure either tbh
matytyma
matytymaā€¢17mo ago
Yeah šŸ˜… Thanks! This is exactly what I wanted for the first two, what about the MessageContextMenuCommand? Is it even possible?
SchlaubiBus
SchlaubiBusā€¢17mo ago
That should give you the same Message Object
matytyma
matytymaā€¢17mo ago
Tried it, but the referencedMessage property was null šŸ˜„
Unknown User
Unknown Userā€¢17mo ago
Message Not Public
Sign In & Join Server To View
matytyma
matytymaā€¢17mo ago
Haven't worked with rest yet šŸ˜„, but will try it!
Unknown User
Unknown Userā€¢17mo ago
Message Not Public
Sign In & Join Server To View
matytyma
matytymaā€¢16mo ago
Doesn't work with rest either, it's not taken as a reply imo. Also, good to mention, the response was ephemeral
Unknown User
Unknown Userā€¢16mo ago
Message Not Public
Sign In & Join Server To View
matytyma
matytymaā€¢16mo ago
ofc Response for message context-menu command:
interaction.respondEphemeral {
embed {
title = "Confirm Report"
description = "Do you really want to report this message for violating the ${Channels.RULES}?"
color = EmbedColor.DANGER
}
actionRow {
interactionButton(ButtonStyle.Danger, "report-confirm") {
emoji(Emojis.warning.toReaction())
label = "Report"
}
}
}
interaction.respondEphemeral {
embed {
title = "Confirm Report"
description = "Do you really want to report this message for violating the ${Channels.RULES}?"
color = EmbedColor.DANGER
}
actionRow {
interactionButton(ButtonStyle.Danger, "report-confirm") {
emoji(Emojis.warning.toReaction())
label = "Report"
}
}
}
report-confirm button
interaction.respondPublic {
embed {
title = "Message Reported"
color = EmbedColor.DANGER
description =
"This message has been reported for violating our ${Channels.RULES}, if you agree click on the button"
field {
name = "Message content"
value = interaction.message.referencedMessage!!.content // Here the NPE occurs :D
}
field {
name = "Times already reported"
value = "5"
}
}
actionRow {
interactionButton(ButtonStyle.Danger, "report-add") {
emoji(Emojis.warning.toReaction())
label = "Report"
}
}
}
interaction.respondPublic {
embed {
title = "Message Reported"
color = EmbedColor.DANGER
description =
"This message has been reported for violating our ${Channels.RULES}, if you agree click on the button"
field {
name = "Message content"
value = interaction.message.referencedMessage!!.content // Here the NPE occurs :D
}
field {
name = "Times already reported"
value = "5"
}
}
actionRow {
interactionButton(ButtonStyle.Danger, "report-add") {
emoji(Emojis.warning.toReaction())
label = "Report"
}
}
}
Tell me if something in the code could be improved, I'm new to Kotlin (coming from Java šŸ¤¢)
Unknown User
Unknown Userā€¢16mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server