ruffrick / jda-commands Goto Github PK
View Code? Open in Web Editor NEWAn easy to use, annotations-based slash command framework for JDA
License: MIT License
An easy to use, annotations-based slash command framework for JDA
License: MIT License
@command
class Mood : SlashCommand() {
@command
fun mood(event: SlashCommandInteractionEvent) {
event.reply("How are you?").addActionRow(
success("good", "Good"), danger("bad", "Bad")
).queue()
}
@Button
fun good(event: ButtonInteractionEvent) {
event.editMessage("That's good to hear!").setActionRow().queue()
}
@Button
fun bad(event: ButtonInteractionEvent) {
event.editMessage("Oh no! Here, have some \uD83C\uDF68!").setActionRow().queue()
}
}
java.lang.IllegalArgumentException: Unknown button good
at dev.ruffrick.jda.commands.event.ButtonInteractionListener.onEvent(ButtonInteractionListener.kt:21)
at dev.ruffrick.jda.kotlinx.event.SuspendEventManager$handle$1.invokeSuspend(SuspendEventManager.kt:38)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
when I try to click the buttons it does this
When I interact with a button, I get a java.lang.IllegalArgumentException: Unknown button bad
error. Is there a fix?
Code:
@command
class MoodCommand : SlashCommand() {
@command
fun mood(event: SlashCommandInteractionEvent) {
event.reply("How are you?").addActionRow(
success("good", "Good"),
danger("bad", "Bad")
).queue()
}
@Button("good")
fun good(event: ButtonInteractionEvent) {
event.editMessage("That's good to hear!").setActionRows().queue()
}
@Button("bad")
fun bad(event: ButtonInteractionEvent) {
event.editMessage("Oh no! Here, have some \uD83C\uDF68!").setActionRows().queue()
}
}
I'm using discord jda library version 5.0.0-beta.12
java.lang.IllegalArgumentException: Unknown button expBooster
at dev.ruffrick.jda.commands.event.ButtonInteractionListener.onEvent(ButtonInteractionListener.kt:21)
at dev.ruffrick.jda.kotlinx.event.SuspendEventManager$handle$1.invokeSuspend(SuspendEventManager.kt:38)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Add a @Privilege
annotation to support Slash Command privileges.
How do I make the options optional like we do in jda using OptionData.setRequired(false)
?
Can we add choices using the annotations ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.