Skip to content

Commit

Permalink
refactor: moved tests commands into a new tests package
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsTheSky committed Apr 24, 2024
1 parent 99d06ee commit b0699cd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/greazi/discordbotfoundation/SimpleBot.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.greazi.discordbotfoundation;

import com.greazi.discordbotfoundation.command.PingCommand;
import com.greazi.discordbotfoundation.command.ReplyCommand;
import com.greazi.discordbotfoundation.tests.ReplyCommand;
import com.greazi.discordbotfoundation.command.SimpleCommand;
import com.greazi.discordbotfoundation.command.SlashCommandHandler;
import com.greazi.discordbotfoundation.command.tests.MainCommand;
import com.greazi.discordbotfoundation.tests.MainCommand;
import com.greazi.discordbotfoundation.constants.Constants;
import com.greazi.discordbotfoundation.debug.BotException;
import com.greazi.discordbotfoundation.mysql.SqlManager;
Expand Down Expand Up @@ -173,7 +173,11 @@ public SimpleBot() {
onBotLoad();

registerCommands(
new PingCommand(),
new PingCommand()
);

// Register tests commands
registerCommands(
new ReplyCommand(),
new MainCommand()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onSlashCommandInteraction(@NotNull final SlashCommandInteractionEven
simpleCommand.execute(event, simpleCommand);
} else {
final Optional<SimpleCommand> sub = simpleCommand
.getSubcommands()
.getSubcommandsList()
.stream()
.filter(subcommand -> subcommand.getCommand().equals(event.getSubcommandName()))
.findFirst();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.greazi.discordbotfoundation.command.tests;
package com.greazi.discordbotfoundation.tests;

import com.greazi.discordbotfoundation.command.SimpleCommand;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.greazi.discordbotfoundation.command;
package com.greazi.discordbotfoundation.tests;

import com.greazi.discordbotfoundation.command.SimpleCommand;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
Expand All @@ -16,6 +17,10 @@ public ReplyCommand() {
}

public void onCommand(String message, User user) {

if (user == null) {
reply(message);
} else {
reply(user.getAsMention() + ", " + message);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.greazi.discordbotfoundation.command.tests;
package com.greazi.discordbotfoundation.tests;

import com.greazi.discordbotfoundation.command.SimpleCommand;
import net.dv8tion.jda.api.entities.Message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.greazi.discordbotfoundation.command.tests;
package com.greazi.discordbotfoundation.tests;

import com.greazi.discordbotfoundation.command.SimpleCommand;

Expand Down

0 comments on commit b0699cd

Please sign in to comment.