Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.*;
import java.util.*;

import static com.diamondfire.helpbot.util.textgen.CacheData.CacheData; //use this if you want to add more data to ai sam
import static com.diamondfire.helpbot.util.textgen.MarkovManipulation.getNextWord;

public class SamQuotesCommand extends Command {
Expand All @@ -35,7 +36,14 @@ public String getName() {
public HelpContext getHelpContext() {
return new HelpContext()
.description("Gets a quote from Sam the Man.")
.category(CommandCategory.OTHER);
.category(CommandCategory.OTHER)
.addArgument(
new HelpContextArgument()
.name("get"),
new HelpContextArgument()
.name("submit"),
new HelpContextArgument()
.name("generate"));
}

@Override
Expand All @@ -46,12 +54,10 @@ public Permission getPermission() {
@Override
public void run(CommandEvent event) {

if (event.getArgument("action") == "submit") {
if (event.getArgument("action").equals("submit")) {

String[] message = event.getMessage().getContentRaw().split("/");

System.out.println(message.length);

if(message.length != 7 || message[5] == null || message[6] == null || message[5].length() != 18 || message[6].length() != 18) {

PresetBuilder error = new PresetBuilder();
Expand All @@ -60,6 +66,8 @@ public void run(CommandEvent event) {
new InformativeReply(InformativeReplyType.ERROR, "This is not a samquote!")
);

event.reply(error);

return;
}

Expand Down Expand Up @@ -194,6 +202,8 @@ public void run(CommandEvent event) {
new InformativeReply(InformativeReplyType.SUCCESS, "Your SamQuote has been added!")
);

event.reply(success);

} catch (IOException e) {

e.printStackTrace();
Expand All @@ -208,10 +218,12 @@ public void run(CommandEvent event) {
new InformativeReply(InformativeReplyType.ERROR, "This is not a samquote!")
);

event.reply(error);

}

});
} else if (event.getArgument("action") == "generate") {
} else if (event.getArgument("action").equals("generate")) {

File file = new File("samquotes.txt");

Expand Down