This commit is contained in:
Nilstrieb 2021-02-16 15:51:34 +01:00
parent b79a06cafa
commit 12cb753083
2 changed files with 9 additions and 8 deletions

View file

@ -16,13 +16,16 @@ public class HugCommand extends Command {
@Override
public void called(String args) {
Member member = event.getMember();
Member sender = event.getMember();
List<Member> 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");
}

View file

@ -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;