use of net.dv8tion.jda.api.entities.NewsChannel in project JavaBot by Java-Discord.
the class CancelSubcommand method handleJamCommand.
@Override
protected ReplyCallbackAction handleJamCommand(SlashCommandInteractionEvent event, Jam activeJam, Connection con, JamConfig config) throws SQLException {
OptionMapping confirmOption = event.getOption("confirm");
if (confirmOption == null || !confirmOption.getAsString().equals("yes")) {
return Responses.warning(event, "Invalid confirmation. Type `yes` to confirm cancellation.");
}
NewsChannel announcementChannel = config.getAnnouncementChannel();
if (announcementChannel == null)
throw new IllegalArgumentException("Invalid jam announcement channel id.");
new JamRepository(con).cancelJam(activeJam);
announcementChannel.sendMessage("The current Java Jam has been cancelled.").queue();
return Responses.success(event, "Jam Cancelled", "The " + activeJam.getFullName() + " has been cancelled.");
}
Aggregations