use of gg.projecteden.nexus.models.nickname.NicknameService in project Nexus by ProjectEdenGG.
the class NicknameAppCommand method deny.
@Command("Deny a nickname request")
void deny(@Desc("Player") Nickname player, @Desc("Reason") String reason) {
for (NicknameHistoryEntry entry : player.getNicknameHistory()) {
if (!entry.isPending())
continue;
entry.deny(reason);
new NicknameService().save(player);
reply("Successfully denied nickname request");
return;
}
replyEphemeral("No pending nickname request found for " + player.getNickname());
}
use of gg.projecteden.nexus.models.nickname.NicknameService in project Nexus by ProjectEdenGG.
the class IngameBridgeListener method parseMentions.
public static String parseMentions(String message) {
if (message != null && message.contains("@")) {
Matcher matcher = Pattern.compile("@[\\w]+").matcher(message);
while (matcher.find()) {
String group = matcher.group();
String search = group.replace("@", "");
Nerd nerd = new NerdService().findExact(search);
if (nerd != null) {
DiscordUser mentioned = new DiscordUserService().get(nerd);
if (mentioned.getUserId() != null) {
message = message.replace(group, "<@" + mentioned.getUserId() + ">");
} else {
Nickname fromNickname = new NicknameService().getFromNickname(search);
if (fromNickname != null) {
mentioned = new DiscordUserService().get(fromNickname);
if (mentioned.getUserId() != null)
message = message.replace(group, "<@" + mentioned.getUserId() + ">");
}
}
}
}
}
return message;
}
Aggregations