本文整理匯總了Java中net.dv8tion.jda.core.entities.User.isFake方法的典型用法代碼示例。如果您正苦於以下問題:Java User.isFake方法的具體用法?Java User.isFake怎麽用?Java User.isFake使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.dv8tion.jda.core.entities.User
的用法示例。
在下文中一共展示了User.isFake方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import net.dv8tion.jda.core.entities.User; //導入方法依賴的package包/類
public Result run(String[] args, MessageReceivedEvent e) {
Config.update();
//If the author used the admin keyword and is an elevated user
boolean elevated = false;
if (args.length > 0 && args[0].equals("admin") && Config.getElevatedUsers().contains(e.getAuthor().getId())) {
elevated = true;
}
//Calculate memory (taken from stackoverflow)
long value = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
final long[] dividers = new long[] {T, G, M, K, 1};
final String[] units = new String[] {"TB", "GB", "MB", "KB", "B"};
if (value < 1) {
throw new IllegalArgumentException("Invalid file size: " + value);
}
String memory = null;
for (int i = 0; i < dividers.length; i++) {
final long divider = dividers[i];
if (value >= divider) {
memory = format(value, divider, units[i]);
break;
}
}
//Build message
EmbedBuilder eb = new EmbedBuilder();
eb.setColor(Color.GREEN);
eb.addField("Author", "@Tis_awesomeness#8617", true);
eb.addField("Version", Bot.getVersion(), true);
String guilds = DiscordUtils.getGuilds().size() + "";
String channels = DiscordUtils.getTextChannels().size() + "";
String users = DiscordUtils.getUsers().size() + "";
if (Config.getShardCount() > 1) {
String shards = e.getJDA().getShardInfo().getShardId() + 1 + "/" + Config.getShardCount();
eb.addField("Shard", shards, true);
guilds += " {" + e.getJDA().getGuilds().size() + "}";
channels += " {" + e.getJDA().getTextChannels().size() + "}";
users += " {" + e.getJDA().getUsers().size() + "}";
}
eb.addField("Guilds", guilds + "", true);
eb.addField("Channels", channels, true);
eb.addField("Users", users, true);
ArrayList<User> userArray = new ArrayList<User>(DiscordUtils.getUsers());
for (User u : new ArrayList<User>(userArray)) {
if (u.isBot() || u.isFake()) {
userArray.remove(u);
}
}
eb.addField("Humans", userArray.size() + "", true);
eb.addField("Uptime", DateUtils.getUptime(), true);
if (Config.getShowMemory() || elevated) {
eb.addField("Memory", memory, true);
}
eb.addField("Invite", Config.getInvite(), true);
eb.addField("Help Server", Bot.helpServer, true);
eb.addField("Website", Bot.website, true);
eb.addField("Credits", "Mojang API, Crafatar, and MCAPI", true);
eb.addField("Library", "Java `1.8.0_101`, JDA `3.3.1_301`", true);
eb = MessageUtils.addFooter(eb);
return new Result(Outcome.SUCCESS, eb.build());
}