mass code dump
Signed-off-by: deepCurse <leverplays@gmail.com>
This commit is contained in:
parent
f71abeb499
commit
573443e4b4
17 changed files with 438 additions and 289 deletions
|
@ -1,58 +1,70 @@
|
|||
package pkg.deepCurse.nopalmo.command.guildCommand.info;
|
||||
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import pkg.deepCurse.nopalmo.command.GuildCommand;
|
||||
import pkg.deepCurse.nopalmo.core.Boot;
|
||||
import pkg.deepCurse.nopalmo.global.Tools;
|
||||
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;
|
||||
|
||||
public class Ping extends GuildCommand {
|
||||
|
||||
@Override
|
||||
public void run(GuildCommandBlob blob, GuildCommandManager commandManager)
|
||||
throws Exception {
|
||||
|
||||
public void runCommand(GuildCommandBlob blob, GuildCommandManager commandManager,
|
||||
HashMap<String, Argument> argumentMap) throws Exception {
|
||||
|
||||
GuildMessageReceivedEvent event = blob.getGuildMessageEvent();
|
||||
|
||||
TextChannel channel = event.getChannel();
|
||||
if (argumentMap.isEmpty()) {
|
||||
event.getChannel().sendMessage("Pong!\n" + event.getJDA().getGatewayPing() + "ms\n").queue();
|
||||
return;
|
||||
}
|
||||
|
||||
channel.sendMessage("You are: " + blob.getUserID()).queue();
|
||||
|
||||
if (blob.getArgs().size() == 0) {
|
||||
// new Main();
|
||||
channel.sendMessage("Pong!\n" + event.getJDA().getGatewayPing() + "ms\n"
|
||||
// + "Sorry if the ping is too high, im currently hosting on an under powered
|
||||
// laptop out in the countryside...\n"
|
||||
// + "This will be fixed in at most 2 days..."
|
||||
).queue();
|
||||
// long pang = Main.bot.getGatewayPing();
|
||||
if (argumentMap.get("all") != null) {
|
||||
|
||||
} else if (blob.getArgs().get(0).contentEquals("all")) {
|
||||
event.getChannel().sendMessage("Gathering data. . .").queue(msg -> {
|
||||
long timeToProcess = System.currentTimeMillis();
|
||||
|
||||
try { // TODO rewrite this block, all tries are not good practice
|
||||
|
||||
channel.sendMessage("Gathering data...").queue(msg -> {
|
||||
try {
|
||||
long timeToProcess = System.currentTimeMillis();
|
||||
|
||||
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: " + (timeToProcess - System.currentTimeMillis()) + "ms").queue();
|
||||
msg.editMessage(out + "\nTime to process: " + (System.currentTimeMillis() - timeToProcess) + "ms")
|
||||
.queue();
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
} else
|
||||
Tools.wrongUsage(channel, this);
|
||||
}
|
||||
|
||||
// if (argumentArray == null || argumentArray.isEmpty()) {
|
||||
//
|
||||
// return;
|
||||
// } else {
|
||||
//
|
||||
// for (Argument i : argumentArray) {
|
||||
// if (i.getArgName().contentEquals("all")) {
|
||||
//
|
||||
// } else {
|
||||
// Tools.wrongUsage(event.getChannel(), this);
|
||||
// }
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCommandCalls() {
|
||||
return new String[] {"ping"};
|
||||
return new String[] { "ping" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Global.prefix+"ping [" + Argument.argumentPrefix + "all]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,4 +72,13 @@ public class Ping extends GuildCommand {
|
|||
return HelpPage.Info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Argument> getArguments() {
|
||||
HashMap<String, Argument> args = new HashMap<String, Argument>();
|
||||
|
||||
args.put("all", new Argument("all").setPrefixRequirement(true));
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue