some shit to do with the command manager, again
Signed-off-by: deepCurse <leverplays@gmail.com>
This commit is contained in:
parent
22837cf438
commit
cda31cfaa0
9 changed files with 237 additions and 108 deletions
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Global;
|
||||
import pkg.deepCurse.nopalmo.manager.Argument;
|
||||
import pkg.deepCurse.nopalmo.manager.CommandBlob;
|
||||
import pkg.deepCurse.nopalmo.manager.DirectCommandBlob;
|
||||
|
@ -33,14 +34,11 @@ public interface CommandInterface { // TODO rewrite to implement type args?
|
|||
General, Moderation, Fun, Info, Extra, TESTING, DEV, EGG
|
||||
}
|
||||
|
||||
public default String getHelp() {
|
||||
return null;
|
||||
}
|
||||
public String getHelp();
|
||||
|
||||
public default String getUsage() {
|
||||
return null;
|
||||
return Global.prefix + getCommandName();
|
||||
}
|
||||
|
||||
public default int getTimeout() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package pkg.deepCurse.nopalmo.command.commands.general;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import pkg.deepCurse.nopalmo.command.CommandInterface.GuildCommandInterface;
|
||||
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Global;
|
||||
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Guild;
|
||||
import pkg.deepCurse.nopalmo.manager.Argument;
|
||||
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
|
||||
|
||||
public class Prefix implements GuildCommandInterface {
|
||||
|
||||
@Override
|
||||
public String[] getCommandCalls() {
|
||||
return new String[] { "prefix", };
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpPage getHelpPage() {
|
||||
return HelpPage.General;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runGuildCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception {
|
||||
|
||||
if (argumentList.get("prefix") != null) {
|
||||
// System.out.println(argumentList.get("prefix").getWildCardString());
|
||||
Guild.Prefix.setPrefix(
|
||||
blob.getEvent().getGuild().getIdLong(), argumentList.get("prefix").getWildCardString());
|
||||
blob.getEvent().getChannel().sendMessage("Set prefix to " + argumentList.get("prefix").getWildCardString()).queue();
|
||||
} else {
|
||||
Guild.Prefix.setPrefix(
|
||||
blob.getEvent().getGuild().getIdLong(), Global.prefix);
|
||||
blob.getEvent().getChannel().sendMessage("Reset prefix to default").queue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Argument> getArguments() {
|
||||
HashMap<String, Argument> args = new HashMap<String, Argument>();
|
||||
|
||||
args.put("prefix", new Argument("prefix").setPosition(0).setIsWildcard(true));
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Global.prefix + getCommandName() + " <prefix>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Sets a prefix for your guild";
|
||||
}
|
||||
|
||||
}
|
|
@ -7,12 +7,12 @@ import pkg.deepCurse.nopalmo.manager.Argument;
|
|||
import pkg.deepCurse.nopalmo.manager.CommandBlob;
|
||||
|
||||
public class Git implements DualCommandInterface {
|
||||
|
||||
|
||||
@Override
|
||||
public void runDualCommand(CommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
|
||||
blob.getChannel().sendMessage("Heres the link: https://github.com/lever1209/nopalmo").queue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getCommandCalls() {
|
||||
return new String[] { "git", "source", "github" };
|
||||
|
@ -23,4 +23,21 @@ public class Git implements DualCommandInterface {
|
|||
return HelpPage.Info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Argument> getArguments() {
|
||||
HashMap<String, Argument> args = new HashMap<String, Argument>();
|
||||
|
||||
args.put("test", new Argument("test", (CommandBlob blob) -> {
|
||||
|
||||
blob.getChannel().sendMessage("This is the automatically running argument inside of " + this.getCommandName()).queue();
|
||||
|
||||
}).setPrefixRequirement(true).setAutoStartRunnable(true));
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Posts my github link";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class Ping implements DualCommandInterface {
|
|||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Global.prefix + "ping [" + Argument.argumentPrefix + "all]";
|
||||
return Global.prefix + getCommandName()+" [" + Argument.argumentPrefix + "all]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,4 +76,9 @@ public class Ping implements DualCommandInterface {
|
|||
return args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Returns the jda heartbeat ping";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package pkg.deepCurse.nopalmo.command.commands.info;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import pkg.deepCurse.nopalmo.command.CommandInterface.GuildCommandInterface;
|
||||
import pkg.deepCurse.nopalmo.manager.Argument;
|
||||
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
|
||||
|
||||
public class Prefix implements GuildCommandInterface {
|
||||
|
||||
@Override
|
||||
public String[] getCommandCalls() {
|
||||
return new String[] { "prefix", };
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpPage getHelpPage() {
|
||||
return HelpPage.General;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runGuildCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Argument> getArguments() {
|
||||
HashMap<String, Argument> args = new HashMap<String, Argument>();
|
||||
|
||||
args.put("prefix", new Argument("prefix").setIsWildcard(true));
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
|
@ -92,7 +92,7 @@ public class DatabaseTools {
|
|||
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
// throw new IllegalArgumentException("Input cannot be empty");
|
||||
prefix = ";";
|
||||
prefix = Global.prefix;
|
||||
}
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
|
@ -114,7 +114,7 @@ public class DatabaseTools {
|
|||
SQLCode.sqlTranslate(pstmt, e);
|
||||
for (int i : new int[] { 1062 }) {
|
||||
if (i == e.getErrorCode()) {
|
||||
return setPrefix(connection, guildID, prefix);
|
||||
return setPrefix(guildID, prefix);
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
@ -126,7 +126,7 @@ public class DatabaseTools {
|
|||
}
|
||||
}
|
||||
|
||||
public static String setPrefix(Connection conn, long guildID, String prefix)
|
||||
public static String setPrefix(long guildID, String prefix)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
if (prefix.isEmpty()) {
|
||||
|
@ -137,7 +137,7 @@ public class DatabaseTools {
|
|||
|
||||
String query = "update guilds set prefix = ? where guildid = ?;";
|
||||
try {
|
||||
pstmt = conn.prepareStatement(query);
|
||||
pstmt = connection.prepareStatement(query);
|
||||
|
||||
pstmt.setLong(2, guildID);
|
||||
pstmt.setString(1, prefix);
|
||||
|
@ -146,12 +146,12 @@ public class DatabaseTools {
|
|||
int[] updateCounts = pstmt.executeBatch();
|
||||
checkUpdateCounts(pstmt, updateCounts);
|
||||
pstmt.close();
|
||||
conn.commit();
|
||||
// conn.commit();
|
||||
return prefix;
|
||||
} catch (SQLException e) {
|
||||
SQLCode.sqlTranslate(pstmt, e);
|
||||
try {
|
||||
conn.rollback();
|
||||
connection.rollback();
|
||||
} catch (Exception e2) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class GuildMessageReceivedListener extends ListenerAdapter {
|
|||
if (messageRaw.contentEquals(Global.prefix + Global.prefix)
|
||||
&& DatabaseTools.Tools.Developers.canPowerOffBot(event.getAuthor().getIdLong())) {
|
||||
|
||||
// message.addReaction(Reactions.getReaction("galaxyThumb")).complete();
|
||||
// message.addReaction(Reactions.getReaction("galaxyThumb")).complete();
|
||||
// TODO re enable
|
||||
|
||||
message.delete().complete();
|
||||
|
@ -36,30 +36,8 @@ public class GuildMessageReceivedListener extends ListenerAdapter {
|
|||
System.exit(0);
|
||||
}
|
||||
|
||||
String[] prefixArray = new String[] { DatabaseTools.Tools.Guild.Prefix.getPrefix(event.getGuild().getIdLong()),
|
||||
"<@!" + event.getJDA().getSelfUser().getIdLong() + ">" }; // FIXME BROKEN PING PREFIX
|
||||
|
||||
boolean shouldReturn = true;
|
||||
for (String i : prefixArray) { // TODO switch to [] to skip for loop?
|
||||
|
||||
if (messageRaw.startsWith(i)) {
|
||||
shouldReturn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO add pre manager commands
|
||||
|
||||
if (shouldReturn) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getAuthor().isBot()) {
|
||||
|
||||
Boot.guildCommandManager.startCommand(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package pkg.deepCurse.nopalmo.manager;
|
||||
|
||||
import pkg.deepCurse.nopalmo.command.CommandInterface;
|
||||
|
||||
public class Argument {
|
||||
|
||||
// README
|
||||
|
@ -22,6 +24,11 @@ public class Argument {
|
|||
private Argument[] subArgs = null;
|
||||
private boolean requiresPrefix = false;
|
||||
private Boolean isWildcard;
|
||||
private int position = -1;
|
||||
private String wildCardString = null;
|
||||
private boolean autoStartRunnable = false;
|
||||
private boolean skipOriginalTaskOnRunnable = false;
|
||||
private RunnableArg runnableArg = null;
|
||||
|
||||
public static final String argumentPrefix = "-"; // This exists for the sole reason of customization and will
|
||||
// generally not change, ever, its recommended you keep it to
|
||||
|
@ -54,6 +61,7 @@ public class Argument {
|
|||
this.requiredArgs = requiredArgs;
|
||||
this.argName = argName;
|
||||
this.subArgs = subArgs;
|
||||
this.runnableArg = runnableArg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,6 +86,7 @@ public class Argument {
|
|||
*/
|
||||
public Argument(String argName, RunnableArg runnableArg) {
|
||||
this.argName = argName;
|
||||
this.runnableArg = runnableArg;
|
||||
}
|
||||
|
||||
public int getRequiredArgs() {
|
||||
|
@ -113,6 +122,11 @@ public class Argument {
|
|||
}
|
||||
|
||||
public Argument setIsWildcard(Boolean bool) {
|
||||
|
||||
if (this.position<=-1) {
|
||||
throw new IllegalArgumentException("Cannot create a wildcard without a position; set a position first");
|
||||
}
|
||||
|
||||
this.isWildcard = bool;
|
||||
return this;
|
||||
}
|
||||
|
@ -125,10 +139,50 @@ public class Argument {
|
|||
return this.requiresPrefix;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public Argument setPosition(int position) {
|
||||
this.position = position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface RunnableArg {
|
||||
|
||||
public void run(Argument[] argArray);
|
||||
public void run(CommandBlob blob);
|
||||
|
||||
}
|
||||
|
||||
public Argument setWildCardString(String wildCardString) {
|
||||
this.wildCardString = wildCardString;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWildCardString() {
|
||||
return wildCardString;
|
||||
}
|
||||
|
||||
public Argument setAutoStartRunnable(boolean bool) {
|
||||
this.autoStartRunnable = bool;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isAutoStartRunnable() {
|
||||
return autoStartRunnable;
|
||||
}
|
||||
|
||||
public boolean isSkipOriginalTaskOnRunnable() {
|
||||
return skipOriginalTaskOnRunnable;
|
||||
}
|
||||
|
||||
public Argument setSkipOriginalTaskOnRunnable(boolean skipOriginalTaskOnRunnable) {
|
||||
this.skipOriginalTaskOnRunnable = skipOriginalTaskOnRunnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunnableArg getRunnableArg() {
|
||||
return runnableArg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ import java.util.regex.Pattern;
|
|||
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import pkg.deepCurse.nopalmo.command.CommandInterface.GuildCommandInterface;
|
||||
import pkg.deepCurse.nopalmo.command.commands.general.Prefix;
|
||||
import pkg.deepCurse.nopalmo.command.commands.info.Git;
|
||||
import pkg.deepCurse.nopalmo.command.commands.info.Help;
|
||||
import pkg.deepCurse.nopalmo.command.commands.info.Ping;
|
||||
import pkg.deepCurse.nopalmo.command.commands.info.Prefix;
|
||||
import pkg.deepCurse.nopalmo.core.Boot;
|
||||
import pkg.deepCurse.nopalmo.database.DatabaseTools;
|
||||
import pkg.deepCurse.nopalmo.global.Tools;
|
||||
|
@ -58,12 +58,31 @@ public class GuildCommandManager extends CommandManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void startCommand(GuildMessageReceivedEvent guildMessage) {
|
||||
public void startCommand(GuildMessageReceivedEvent guildMessageEvent) { // TODO SPLIT UP AND INHERIT
|
||||
|
||||
final String message = guildMessage.getMessage().getContentRaw();
|
||||
final String message = guildMessageEvent.getMessage().getContentRaw();
|
||||
String prefix = DatabaseTools.Tools.Guild.Prefix.getPrefix(guildMessageEvent.getGuild().getIdLong());
|
||||
String pingPrefix = "<@!" + guildMessageEvent.getJDA().getSelfUser().getIdLong() + ">";
|
||||
|
||||
final String[] split = message.replaceFirst("(?i)" + Pattern.quote(DatabaseTools.Tools.Global.prefix), "")
|
||||
.split("\\s+");
|
||||
// String splicer = null;
|
||||
// String[] prefixArray = new String[] { DatabaseTools.Tools.Guild.Prefix.getPrefix(guildMessageEvent.getGuild().getIdLong()),
|
||||
// "<@!" + guildMessageEvent.getJDA().getSelfUser().getIdLong() + ">" }; // FIXME BROKEN PING PREFIX
|
||||
// for () {
|
||||
//
|
||||
// }
|
||||
|
||||
String splicer = null;
|
||||
if (message.startsWith(pingPrefix + " ")) {
|
||||
splicer = pingPrefix + " ";
|
||||
} else if (message.startsWith(prefix)) {
|
||||
splicer = prefix;
|
||||
} else if (message.startsWith(pingPrefix)) {
|
||||
splicer = pingPrefix;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] split = message.replaceFirst("(?i)" + Pattern.quote(splicer), "").split("\\s+");
|
||||
final String command = split[0].toLowerCase();
|
||||
|
||||
if (guildCommandMap.containsKey(command)) {
|
||||
|
@ -76,55 +95,90 @@ public class GuildCommandManager extends CommandManager {
|
|||
// ArrayList<String> newArguments = new ArrayList<String>();
|
||||
// ArrayList<String> commandFlags = new ArrayList<String>();
|
||||
|
||||
GuildCommandBlob commandBlob = new GuildCommandBlob(guildMessage);
|
||||
GuildCommandBlob commandBlob = new GuildCommandBlob(guildMessageEvent);
|
||||
GuildCommandInterface guildCommand = guildCommandMap.get(command);
|
||||
HashMap<String, Argument> argumentList = new HashMap<String, Argument>();
|
||||
|
||||
boolean printTime = false;
|
||||
byte argSkipCount = 0;
|
||||
boolean remainsValid = true;
|
||||
boolean isWildCard = false;
|
||||
// int id = 0;
|
||||
|
||||
for (String x : args) {
|
||||
boolean taken = false;
|
||||
HashMap<Integer, Argument> positionalArgs = new HashMap<Integer, Argument>();
|
||||
|
||||
for (Argument i : guildCommand.getArguments().values()) {
|
||||
if (i.getPosition() >= 0) {
|
||||
positionalArgs.put(i.getPosition(), i);
|
||||
}
|
||||
|
||||
if (i.isSkipOriginalTaskOnRunnable()) {
|
||||
remainsValid = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < args.size(); i++) {
|
||||
String x = args.get(i);
|
||||
x = x.toLowerCase();
|
||||
switch (x) {
|
||||
case "\\time":
|
||||
printTime = true;
|
||||
break;
|
||||
case "\\perm":
|
||||
// commandFlags.add("user:380045419381784576");
|
||||
commandBlob.setUserID(380045419381784576L);
|
||||
break;
|
||||
case "\\del":
|
||||
guildMessage.getMessage().delete().queue();
|
||||
guildMessageEvent.getMessage().delete().queue();
|
||||
break;
|
||||
default: // in the rewrite process
|
||||
default:
|
||||
if (argSkipCount <= 0) {
|
||||
|
||||
if (guildCommand.getArguments() != null) {
|
||||
if (x.startsWith(Argument.argumentPrefix)) {
|
||||
|
||||
String pre = x.substring(Argument.argumentPrefix.length());
|
||||
if (guildCommand.getArguments().keySet().contains(pre)) {
|
||||
argumentList.put(pre, guildCommand.getArguments().get(pre));
|
||||
taken = true;
|
||||
if (positionalArgs.get(i) == null) {
|
||||
|
||||
if (x.startsWith(Argument.argumentPrefix)) {
|
||||
|
||||
String pre = x.substring(Argument.argumentPrefix.length());
|
||||
if (guildCommand.getArguments().keySet().contains(pre)) {
|
||||
argumentList.put(pre, guildCommand.getArguments().get(pre));
|
||||
if (guildCommand.getArguments().get(pre).isAutoStartRunnable()
|
||||
&& guildCommand.getArguments().get(pre)
|
||||
.getRunnableArg() != null) {
|
||||
guildCommand.getArguments().get(pre).getRunnableArg()
|
||||
.run(new CommandBlob(commandBlob));
|
||||
}
|
||||
} else {
|
||||
Tools.wrongUsage(guildMessageEvent.getChannel(), guildCommand);
|
||||
remainsValid = false;
|
||||
}
|
||||
} else {
|
||||
Tools.wrongUsage(guildMessage.getChannel(), guildCommand);
|
||||
remainsValid = false;
|
||||
if (guildCommand.getArguments().get(x) != null) {
|
||||
if (guildCommand.getArguments().get(x).getPrefixRequirement()) {
|
||||
Tools.wrongUsage(guildMessageEvent.getChannel(), guildCommand);
|
||||
remainsValid = false;
|
||||
} else {
|
||||
argumentList.put(x, guildCommand.getArguments().get(x));
|
||||
if (guildCommand.getArguments().get(x).isAutoStartRunnable()
|
||||
&& guildCommand.getArguments().get(x)
|
||||
.getRunnableArg() != null) {
|
||||
guildCommand.getArguments().get(x).getRunnableArg()
|
||||
.run(new CommandBlob(commandBlob));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Tools.wrongUsage(guildMessageEvent.getChannel(), guildCommand);
|
||||
remainsValid = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if (!guildCommand.getArguments().get(x).getIsWildcard()) {
|
||||
if (guildCommand.getArguments().get(x).getPrefixRequirement()) {
|
||||
Tools.wrongUsage(guildMessage.getChannel(), guildCommand);
|
||||
remainsValid = false;
|
||||
} else {
|
||||
argumentList.put(x, guildCommand.getArguments().get(x));
|
||||
taken = true;
|
||||
if (positionalArgs.get(i).getIsWildcard()) {
|
||||
argumentList.put(positionalArgs.get(i).getArgName(),
|
||||
positionalArgs.get(i).setWildCardString(x));
|
||||
}
|
||||
if (positionalArgs.get(i).isAutoStartRunnable()
|
||||
&& positionalArgs.get(i).getRunnableArg() != null) {
|
||||
positionalArgs.get(i).getRunnableArg().run(new CommandBlob(commandBlob));
|
||||
}
|
||||
// } else {
|
||||
// argumentList.put(x, guildCommand.getArguments().get(x));
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,31 +192,31 @@ public class GuildCommandManager extends CommandManager {
|
|||
}
|
||||
|
||||
if (printTime) {
|
||||
guildMessage.getChannel()
|
||||
guildMessageEvent.getChannel()
|
||||
.sendMessage("Time to run: " + (System.currentTimeMillis() - commandStartTime) + "ms")
|
||||
.queue();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (Boot.isProd) {
|
||||
guildMessage.getChannel().sendMessage("```properties\n" + e + "```").queue();
|
||||
guildMessageEvent.getChannel().sendMessage("```properties\n" + e + "```").queue();
|
||||
} else {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
e.printStackTrace(pw);
|
||||
guildMessage.getChannel().sendMessage("```properties\n" + sw.toString() + "```").queue();
|
||||
guildMessageEvent.getChannel().sendMessage("```properties\n" + sw.toString() + "```").queue();
|
||||
System.err.println("Exception caught in: " + e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
|
||||
if (Boot.isProd) {
|
||||
guildMessage.getChannel().sendMessage("```mathematica\n" + t + "```").queue();
|
||||
guildMessageEvent.getChannel().sendMessage("```mathematica\n" + t + "```").queue();
|
||||
} else {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
t.printStackTrace(pw);
|
||||
guildMessage.getChannel().sendMessage("```mathematica\n" + sw.toString() + "```").queue();
|
||||
guildMessageEvent.getChannel().sendMessage("```mathematica\n" + sw.toString() + "```").queue();
|
||||
System.err.println("Error caught in: " + t.toString());
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue