diff --git a/src/main/java/com/github/nilstrieb/commands/fun/HugCommand.java b/src/main/java/com/github/nilstrieb/commands/fun/HugCommand.java index 7063021..41c63fe 100644 --- a/src/main/java/com/github/nilstrieb/commands/fun/HugCommand.java +++ b/src/main/java/com/github/nilstrieb/commands/fun/HugCommand.java @@ -16,13 +16,16 @@ public class HugCommand extends Command { @Override public void called(String args) { - Member member = event.getMember(); + Member sender = event.getMember(); List mentions = event.getMessage().getMentionedMembers(); EmbedBuilder builder = Config.getDefaultEmbed(); - if (mentions.size() == 1 && !mentions.get(0).getId().equalsIgnoreCase(Objects.requireNonNull(member).getId())) { - member = mentions.get(0); - builder.setDescription(mentions.get(0).getEffectiveName() +" is giving " + member.getEffectiveName() + " a hug! :)"); + if (sender != null + && mentions.size() >= 1 + && mentions.get(0).getIdLong() != sender.getIdLong()) { + + sender = mentions.get(0); + builder.setDescription(sender.getEffectiveName() + " is giving " + mentions.get(0).getEffectiveName() + " a hug! :)"); } else { builder.setDescription("Get a hug, bro <3"); } diff --git a/src/main/java/com/github/nilstrieb/core/Main.java b/src/main/java/com/github/nilstrieb/core/Main.java index d896915..9baf484 100644 --- a/src/main/java/com/github/nilstrieb/core/Main.java +++ b/src/main/java/com/github/nilstrieb/core/Main.java @@ -1,12 +1,10 @@ package com.github.nilstrieb.core; import com.github.nilstrieb.cofig.Config; +import com.github.nilstrieb.cofig.Secrets; import com.github.nilstrieb.commands.fun.*; import com.github.nilstrieb.commands.fun.trivia.TriviaCommand; -import com.github.nilstrieb.commands.info.InviteCommand; -import com.github.nilstrieb.commands.info.EvalCommand; -import com.github.nilstrieb.commands.info.HelpCommand; -import com.github.nilstrieb.commands.info.ToukaCommand; +import com.github.nilstrieb.commands.info.*; import com.github.nilstrieb.commands.util.EmoteAddCommand; import com.github.nilstrieb.core.sections.ChannelMessageListener; import com.github.nilstrieb.core.command.CommandListener;