File tree Expand file tree Collapse file tree
src/main/java/net/javadiscord/javabot
qotw/submissions/subcommands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public UnbanCommand() {
2929 @ Override
3030 protected ReplyCallbackAction handleModerationCommand (SlashCommandInteractionEvent event , Member commandUser ) {
3131 OptionMapping idOption = event .getOption ("id" );
32- if (idOption == null || ! Checks .checkLongInput (idOption )) {
32+ if (idOption == null || Checks .isInvalidLongInput (idOption )) {
3333 return Responses .error (event , "Missing required arguments." );
3434 }
3535 long id = idOption .getAsLong ();
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public MarkBestAnswerSubcommand() {
5252 @ Override
5353 public void execute (@ NotNull SlashCommandInteractionEvent event ) {
5454 OptionMapping idMapping = event .getOption ("thread-id" );
55- if (idMapping == null || ! Checks .checkLongInput (idMapping )) {
55+ if (idMapping == null || Checks .isInvalidLongInput (idMapping )) {
5656 Responses .error (event , "Please provide a valid thread id-" ).queue ();
5757 return ;
5858 }
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public CreateEmbedSubcommand() {
4444
4545 @ Override
4646 public void execute (@ NotNull SlashCommandInteractionEvent event ) {
47- if (Checks .checkGuild (event )) {
47+ if (! Checks .checkGuild (event )) {
4848 Responses .error (event , "This command may only be used inside of a server." ).queue ();
4949 return ;
5050 }
@@ -54,7 +54,7 @@ public void execute(@NotNull SlashCommandInteractionEvent event) {
5454 @ Override
5555 public void handleModal (ModalInteractionEvent event , List <ModalMapping > values ) {
5656 event .deferReply (true ).queue ();
57- if (Checks .checkGuild (event )) {
57+ if (! Checks .checkGuild (event )) {
5858 Responses .error (event .getHook (), "This command may only be used inside of a server." ).queue ();
5959 return ;
6060 }
Original file line number Diff line number Diff line change @@ -49,11 +49,11 @@ public EditEmbedSubcommand() {
4949 public void execute (@ NotNull SlashCommandInteractionEvent event ) {
5050 OptionMapping idMapping = event .getOption ("message-id" );
5151 OptionMapping typeMapping = event .getOption ("type" );
52- if (idMapping == null || typeMapping == null || ! Checks .checkLongInput (idMapping )) {
52+ if (idMapping == null || typeMapping == null || Checks .isInvalidLongInput (idMapping )) {
5353 Responses .error (event , "Missing required arguments." ).queue ();
5454 return ;
5555 }
56- if (Checks .checkGuild (event )) {
56+ if (! Checks .checkGuild (event )) {
5757 Responses .error (event , "This command may only be used inside of a server." ).queue ();
5858 return ;
5959 }
@@ -83,7 +83,7 @@ public void execute(@NotNull SlashCommandInteractionEvent event) {
8383 @ Override
8484 public void handleModal (@ NotNull ModalInteractionEvent event , List <ModalMapping > values ) {
8585 event .deferReply (true ).queue ();
86- if (Checks .checkGuild (event )) {
86+ if (! Checks .checkGuild (event )) {
8787 Responses .error (event .getHook (), "This command may only be used inside of a server." ).queue ();
8888 return ;
8989 }
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public void execute(@NotNull SlashCommandInteractionEvent event) {
3939 Responses .error (event , "Missing required arguments." ).queue ();
4040 return ;
4141 }
42- if (! Checks .checkLongInput (messageIdMapping )) {
42+ if (Checks .isInvalidLongInput (messageIdMapping )) {
4343 Responses .error (event , "Please provide a valid message id." ).queue ();
4444 return ;
4545 }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public void execute(@NotNull SlashCommandInteractionEvent event) {
4040 Responses .error (event , "Missing required arguments" ).queue ();
4141 return ;
4242 }
43- if (! Checks .checkLongInput (idMapping )) {
43+ if (Checks .isInvalidLongInput (idMapping )) {
4444 Responses .error (event , "Please provide a valid Discord Snowflake!" ).queue ();
4545 return ;
4646 }
Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ private Checks() {
2929 * @param mapping The {@link OptionMapping} to check.
3030 * @return Whether the {@link OptionMapping} is parsable to a {@link Long}.
3131 */
32- public static boolean checkLongInput (@ NotNull OptionMapping mapping ) {
32+ public static boolean isInvalidLongInput (@ NotNull OptionMapping mapping ) {
3333 try {
3434 mapping .getAsLong ();
35- return true ;
36- } catch (IllegalStateException | NumberFormatException e ) {
3735 return false ;
36+ } catch (IllegalStateException | NumberFormatException e ) {
37+ return true ;
3838 }
3939 }
4040
You can’t perform that action at this time.
0 commit comments