more shit
i should mention im doing live tests before upload, and this is pre-maintenance, anything worth noting will be written in comments Signed-off-by: deepCurse <leverplays@gmail.com>
This commit is contained in:
parent
573443e4b4
commit
1380bc2a22
24 changed files with 663 additions and 288 deletions
|
@ -7,15 +7,14 @@ import pkg.deepCurse.nopalmo.command.GuildCommand;
|
|||
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Global;
|
||||
import pkg.deepCurse.nopalmo.manager.Argument;
|
||||
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
|
||||
import pkg.deepCurse.nopalmo.manager.GuildCommandManager;
|
||||
import pkg.deepCurse.nopalmo.utils.UptimePing;
|
||||
|
||||
public class Ping extends GuildCommand {
|
||||
|
||||
@Override
|
||||
public void runCommand(GuildCommandBlob blob, GuildCommandManager commandManager,
|
||||
HashMap<String, Argument> argumentMap) throws Exception {
|
||||
public void runCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
|
||||
|
||||
GuildMessageReceivedEvent event = blob.getGuildMessageEvent();
|
||||
GuildMessageReceivedEvent event = blob.getEvent();
|
||||
|
||||
if (argumentMap.isEmpty()) {
|
||||
event.getChannel().sendMessage("Pong!\n" + event.getJDA().getGatewayPing() + "ms\n").queue();
|
||||
|
@ -27,17 +26,28 @@ public class Ping extends GuildCommand {
|
|||
event.getChannel().sendMessage("Gathering data. . .").queue(msg -> {
|
||||
long timeToProcess = System.currentTimeMillis();
|
||||
|
||||
try { // TODO rewrite this block, all tries are not good practice
|
||||
|
||||
String out = "Pong!\n" + "Google: " + services.UptimePing.sendPing("www.google.com") + "ms\n"
|
||||
+ "JDA Gateway: " + event.getJDA().getGatewayPing() + "ms\n" + "www.discord.com: "
|
||||
+ services.UptimePing.sendPing("www.discord.com") + "ms";
|
||||
|
||||
msg.editMessage(out + "\nTime to process: " + (System.currentTimeMillis() - timeToProcess) + "ms")
|
||||
.queue();
|
||||
long jdaPing = event.getJDA().getGatewayPing();
|
||||
long googlePing = -1;
|
||||
try {
|
||||
googlePing = UptimePing.sendPing("www.google.com");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long discordPing = -1;
|
||||
try {
|
||||
discordPing = UptimePing.sendPing("www.discord.com");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String out = "Ping:\n"
|
||||
+ (googlePing > 0 ? "Google: " + googlePing + "ms\n" : "Could not connect to www.google.com\n")
|
||||
+ (discordPing > 0 ? "Discord: " + discordPing + "ms\n"
|
||||
: "Could not connect to www.discord.com\n")
|
||||
+ "JDA-Discord heartbeat: "+jdaPing+"ms";
|
||||
|
||||
msg.editMessage(out + "\nTime to process: " + (System.currentTimeMillis() - timeToProcess) + "ms")
|
||||
.queue();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -64,7 +74,7 @@ public class Ping extends GuildCommand {
|
|||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Global.prefix+"ping [" + Argument.argumentPrefix + "all]";
|
||||
return Global.prefix + "ping [" + Argument.argumentPrefix + "all]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue