final commit for tonight aaaaaaaaaaaaaaaaaaaaa

This commit is contained in:
lever1209 2021-12-02 00:38:10 -04:00
commit 92842e12bf
10 changed files with 334 additions and 45 deletions

View file

@ -1,19 +1,53 @@
package pkg.deepCurse.nopalmo.command.guildCommand;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import pkg.deepCurse.nopalmo.command.GuildCommand;
import pkg.deepCurse.nopalmo.database.DatabaseTools;
import pkg.deepCurse.nopalmo.manager.CommandBlob;
import pkg.deepCurse.nopalmo.core.Boot;
import pkg.deepCurse.nopalmo.global.Tools;
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
import pkg.deepCurse.nopalmo.manager.GuildCommandManager;
public class Ping extends GuildCommand {
@Override
public void run(CommandBlob blob, GuildMessageReceivedEvent guildMessage, GuildCommandManager commandManager)
public void run(GuildCommandBlob blob, GuildCommandManager commandManager)
throws Exception {
DatabaseTools.Tools.Guild.Prefix.createPrefix(guildMessage.getGuild().getIdLong(), blob.getArgs().get(0));
GuildMessageReceivedEvent event = blob.getGuildMessageEvent();
TextChannel channel = event.getChannel();
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();
} else if (blob.getArgs().get(0).contentEquals("all")) {
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();
} catch (Exception e) {
}
});
} else
Tools.wrongUsage(channel, this);
}
@Override
@ -25,4 +59,5 @@ public class Ping extends GuildCommand {
public HelpPage getHelpPage() {
return HelpPage.Info;
}
}