-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from t0gepi/bugFix_indexOutOfBounds
IndexOutOfBounds bugs fixed
- Loading branch information
Showing
4 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package ca.tristan.testbot; | ||
|
||
import ca.tristan.easycommands.commands.prefix.PrefixExecutor; | ||
import ca.tristan.easycommands.commands.prefix.PrefixOption; | ||
import ca.tristan.easycommands.database.MySQL; | ||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; | ||
|
||
import java.util.List; | ||
|
||
public class ExampleCommand extends PrefixExecutor { | ||
|
||
public ExampleCommand() { | ||
super(); | ||
options.add(new PrefixOption("someOption", "first option")); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "example"; | ||
} | ||
|
||
@Override | ||
public List<String> getAliases() { | ||
return List.of("s"); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "!example [options] - The bot will say all the options."; | ||
} | ||
|
||
@Override | ||
public boolean isOwnerOnly() { | ||
return false; | ||
} | ||
|
||
|
||
public void execute(MessageReceivedEvent event, MySQL mySQL) { | ||
// the bot simply prints all the options of the !example command | ||
String reply = options.stream().map(PrefixOption::getStringValue).reduce("", (r,u) -> r + " " + u); | ||
event.getChannel().sendMessage(reply).queue(); | ||
} | ||
|
||
|
||
} |