本文整理汇总了Java中sx.blah.discord.handle.obj.IUser.getName方法的典型用法代码示例。如果您正苦于以下问题:Java IUser.getName方法的具体用法?Java IUser.getName怎么用?Java IUser.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sx.blah.discord.handle.obj.IUser
的用法示例。
在下文中一共展示了IUser.getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sanitize
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static String sanitize(@Nullable IGuild guild, String message) {
if (message == null) return null;
if (guild == null) return message;
Matcher matcher = REGEX_MENTION.matcher(message);
while (matcher.find()) {
long id = Long.parseLong(matcher.group(1));
String name;
if (matcher.group().contains("&")) {
name = "the " + MCBot.instance.getRoleByID(id).getName();
} else {
IUser user = guild.getUserByID(id);
if (matcher.group().contains("!")) {
name = user.getDisplayName(guild).replaceAll("@", "@\u200B");
} else {
name = user.getName();
}
}
message = message.replace(matcher.group(), name);
}
return message.replace("@here", "everyone").replace("@everyone", "everyone").replace("@", "@\u200B");
}
示例2: asContent
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
@Override
public String asContent(Map<String, Object> dataMap) {
String guildSpec = (String) dataMap.get("guilds");
List<String> guilds = null;
if (guildSpec != null) {
guilds = Arrays.asList(guildSpec.split("[,;]"));
}
if (guilds == null) {
return null;
}
if (guilds.contains(getSource().getGuild().getStringID())) {
IUser user = getSource().getUser();
String imagesSpec = (String) dataMap.get("images");
String image = "";
if (imagesSpec != null) {
String[] images = imagesSpec.split(";");
image = "\n" + images[random.nextInt(images.length)];
}
String emojiSpec = (String) dataMap.get("emoji");
String emoji = emoji("angel");
if (emojiSpec != null) {
String[] emojis = emojiSpec.split(";");
emoji = "\n" + emojis[random.nextInt(emojis.length)];
if (emoji.startsWith("alias:")) {
emoji = emoji(emoji);
}
}
return user.getName() + "#" + user.getDiscriminator() + " " + emoji + image;
} else {
return null;
}
}
示例3: asContent
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
@Override
public String asContent(Map<String, Object> dataMap) {
String guildSpec = (String) dataMap.get("guilds");
List<String> guilds = null;
if (guildSpec != null) {
guilds = Arrays.asList(guildSpec.split("[,;]"));
}
if (guilds == null) {
return null;
}
if (guilds.contains(getSource().getGuild().getStringID())) {
IUser user = getSource().getUser();
String imagesSpec = (String) dataMap.get("images");
String image = "";
if (imagesSpec != null) {
String[] images = imagesSpec.split(";");
image = "\n" + images[random.nextInt(images.length)];
}
String emojiSpec = (String) dataMap.get("emoji");
String emoji = emoji("hammer");
if (emojiSpec != null) {
String[] emojis = emojiSpec.split(";");
emoji = "\n" + emojis[random.nextInt(emojis.length)];
if (emoji.startsWith("alias:")) {
emoji = emoji(emoji);
}
}
return user.getName() + "#" + user.getDiscriminator() + " " + emoji + image;
} else {
return null;
}
}
示例4: Songs
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public Songs(Track track) {
title = track.getTrack().getInfo().title;
identifier = track.getTrack().getIdentifier();
requester = track.getMeta().getOrDefault("requester", "dick").toString();
length = track.getTrack().getDuration();
progress = track.getTrack().getPosition();
IUser user = FlareBot.getInstance().getClient().getUserByID(requester);
if (user != null) {
discrim = user.getDiscriminator();
name = user.getName();
if (user.getAvatar() != null)
avatar = user.getAvatarURL();
}
}
示例5: format
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
private String format(IUser user) {
return user.getName() + " " + user.toString();
}
示例6: DiscordUser
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public DiscordUser(IUser user) {
this.id = user.getID();
this.name = user.getName();
}
示例7: getTag
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static String getTag(IUser user) {
return user.getName() + '#' + user.getDiscriminator();
}
示例8: convertUser
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static String convertUser(IUser user) {
return user.getName() + "#" + user.getDiscriminator() + " (" + user.getID() + ")";
}
示例9: getUserTag
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static String getUserTag (IUser user) {
return user.getName() + "#" + user.getDiscriminator();
}