You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JDA jda = JDABuilder.createLight(args[0], Collections.emptyList())
.addEventListeners(new Bot())
.setActivity(Activity.playing("Type /ping"))
.build();
// Sets the global command list to the provided commands (removing all others)
jda.updateCommands().addCommands(
Commands.slash("ping", "Calculate ping of the bot"),
Commands.slash("ban", "Ban a user from the server")
.setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.BAN_MEMBERS)) // only usable with ban permissions
.setGuildOnly(true) // Ban command only works inside a guild
.addOption(OptionType.USER, "user", "The user to ban", true) // required option of type user (target to ban)
.addOption(OptionType.STRING, "reason", "The ban reason") // optional reason
).queue();
But the ShardManager class doesn't have command related method. How do I addCommands for sharding case?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In single-host case,
I can use Slash Command with this example
But the ShardManager class doesn't have command related method. How do I addCommands for sharding case?
Beta Was this translation helpful? Give feedback.
All reactions