From fa0f6f62596ba07c1e76235494373b1b7f04c814 Mon Sep 17 00:00:00 2001 From: ProjectDF <61924259+ProjectDF@users.noreply.github.com> Date: Mon, 15 Feb 2021 10:25:56 -0600 Subject: [PATCH 1/2] hyperlink for nbs --- .../helpbot/bot/command/impl/other/NbsCommand.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java index a5601a6c..22707388 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java @@ -5,6 +5,9 @@ import com.diamondfire.helpbot.bot.command.help.HelpContext; import com.diamondfire.helpbot.bot.command.impl.Command; import com.diamondfire.helpbot.bot.command.permissions.Permission; +import com.diamondfire.helpbot.bot.command.reply.PresetBuilder; +import com.diamondfire.helpbot.bot.command.reply.feature.informative.InformativeReply; +import com.diamondfire.helpbot.bot.command.reply.feature.informative.InformativeReplyType; import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.util.nbs.*; import com.google.gson.Gson; @@ -44,16 +47,18 @@ public HelpContext getHelpContext() { @Override public void run(CommandEvent event) { TextChannel channel = event.getChannel(); + PresetBuilder preset = new PresetBuilder(); + preset.withPreset(new InformativeReply(InformativeReplyType.ERROR,"You need to attach an nbs file!")); EmbedBuilder warning = new EmbedBuilder() .addField("Warning!","You need to attach an nbs file!",false) .setColor(Color.RED); if(event.getMessage().getAttachments().isEmpty()) { - channel.sendMessage(warning.build()).queue(); + event.reply(preset); return; } Message.Attachment attachment = event.getMessage().getAttachments().get(0); if(!attachment.getFileExtension().equals("nbs")) { - channel.sendMessage(warning.build()).queue(); + event.reply(preset); return; } EmbedBuilder errorEmbed = new EmbedBuilder() @@ -75,8 +80,8 @@ public void run(CommandEvent event) { .setColor(new Color(70,199,82)) .setTitle("Function Generated!") .setThumbnail("https://static.wikia.nocookie.net/minecraft/images/9/9b/Note_Block.png/revision/latest?cb=20190921170620") - .addField("Link: *Expires in 2 mins*","https://derpystuff.gitlab.io/code/l?link=" + json.get("link").getAsString(),false) - .addField("Info:","Click the link shown above and click the button in the bottom left corner to copy the give command for the template. You will need this function to play songs: https://derpystuff.gitlab.io/code/l?link=7cf5d91c35bbde31c28567d8d8945c40",false); + .addField("Link: __Expires in 2 mins__","[Function Link](https://derpystuff.gitlab.io/code/l?link=" + json.get("link").getAsString() + ")",false) + .addField("Info:","Click the link shown above and click the button in the bottom left corner to copy the give command for the template. You will need [this function](https://derpystuff.gitlab.io/code/l?link=7cf5d91c35bbde31c28567d8d8945c40) to play songs.",false); channel.sendMessage(embed.build()).queue(); } catch(OutdatedNBSException e) { From 62fc308d3089640cb084d7aea68bad29ea2eda6d Mon Sep 17 00:00:00 2001 From: ProjectDF <61924259+ProjectDF@users.noreply.github.com> Date: Mon, 15 Feb 2021 10:31:17 -0600 Subject: [PATCH 2/2] removed useless embed builder --- .../diamondfire/helpbot/bot/command/impl/other/NbsCommand.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java index 22707388..ecf23771 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/NbsCommand.java @@ -49,9 +49,6 @@ public void run(CommandEvent event) { TextChannel channel = event.getChannel(); PresetBuilder preset = new PresetBuilder(); preset.withPreset(new InformativeReply(InformativeReplyType.ERROR,"You need to attach an nbs file!")); - EmbedBuilder warning = new EmbedBuilder() - .addField("Warning!","You need to attach an nbs file!",false) - .setColor(Color.RED); if(event.getMessage().getAttachments().isEmpty()) { event.reply(preset); return;