Made @ChromaBot not count as mentioning

This commit is contained in:
Norbi Peti 2016-12-02 21:19:12 +01:00
parent e4871b2785
commit 95ab347ef6

View file

@ -2,6 +2,7 @@ package buttondevteam.discordplugin.commands;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import buttondevteam.discordplugin.DiscordPlayer;
import buttondevteam.discordplugin.DiscordPlugin;
@ -27,13 +28,17 @@ public class UserinfoCommand extends DiscordCommandBase {
IUser target = null;
if (args.length() == 0)
target = message.getAuthor();
else if (message.getMentions().size() > 0)
target = message.getMentions().get(0);
else {
final Stream<IUser> mentions = message.getMentions().stream()
.filter(m -> !m.getID().equals(DiscordPlugin.dc.getOurUser().getID()));
if (mentions.findFirst().isPresent())
target = mentions.findFirst().get();
else if (args.contains("#")) {
String[] targettag = args.split("#");
final List<IUser> targets = getUsers(message, targettag[0]);
if (targets.size() == 0) {
DiscordPlugin.sendMessageToChannel(message.getChannel(), "The user cannot be found (by name): " + args);
DiscordPlugin.sendMessageToChannel(message.getChannel(),
"The user cannot be found (by name): " + args);
return;
}
for (IUser ptarget : targets) {
@ -43,8 +48,9 @@ public class UserinfoCommand extends DiscordCommandBase {
}
}
if (target == null) {
DiscordPlugin.sendMessageToChannel(message.getChannel(), "The user cannot be found (by discriminator): "
+ args + "(Found " + targets.size() + " users with the name.)");
DiscordPlugin.sendMessageToChannel(message.getChannel(),
"The user cannot be found (by discriminator): " + args + "(Found " + targets.size()
+ " users with the name.)");
return;
}
} else {
@ -61,6 +67,7 @@ public class UserinfoCommand extends DiscordCommandBase {
}
target = targets.get(0);
}
}
boolean found = false;
for (TBMCPlayer player : TBMCPlayer.getLoadedPlayers().values()) {
DiscordPlayer dp = player.asPluginPlayer(DiscordPlayer.class);