本文整理汇总了Java中sx.blah.discord.handle.obj.IUser.getLongID方法的典型用法代码示例。如果您正苦于以下问题:Java IUser.getLongID方法的具体用法?Java IUser.getLongID怎么用?Java IUser.getLongID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sx.blah.discord.handle.obj.IUser
的用法示例。
在下文中一共展示了IUser.getLongID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasPermission
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
/**
* Checks if the client ID of a user is equal to the client ID of Vauff or the user is administrator in the supplied guild
*
* @param user The user to check
* @param guild The guild to check for permissions in
* @return true if the client IDs match and the given user is Vauff or the user is a guild administrator, false otherwise
*/
public static boolean hasPermission(IUser user, IGuild guild)
{
if (user.getLongID() == 129448521861431296L)
{
return true;
}
else
{
if (user.getPermissionsForGuild(guild).contains(Permissions.ADMINISTRATOR))
{
return true;
}
else
{
return false;
}
}
}
示例2: getUser
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
/**
* Grabs a user from a string
*
* @param toLookFor The String to look with
* @param guild The guild
* @return The user if found, null otherwise
*/
public static long getUser(String toLookFor, IGuild guild) {
toLookFor = GeneralUtils.trim(toLookFor);
final String lower = toLookFor.toLowerCase();
if (lower.matches("@!?[0-9]+") || lower.matches("[0-9]+")) {
final String parse = toLookFor.replaceAll("[<@!>]", "");
IUser exists = guild.getUserByID(Long.parseLong(toLookFor.replaceAll("[<@!>]", "")));
if (exists != null) {
return exists.getLongID();
}
}
List<IUser> users = new ArrayList<>();
List<IUser> us = guild.getUsers();
users.addAll(us.stream().filter(u -> u.getName().equalsIgnoreCase(lower)).collect(Collectors.toList()));
users.addAll(us.stream().filter(u -> u.getName().toLowerCase().contains(lower)).collect(Collectors.toList()));
users.addAll(us.stream().filter(u -> (u.getName() + "#" + u.getDiscriminator()).equalsIgnoreCase(lower)).collect(Collectors.toList()));
users.addAll(us.stream().filter(u -> u.getDiscriminator().equalsIgnoreCase(lower)).collect(Collectors.toList()));
users.addAll(us.stream().filter(u -> u.getDisplayName(guild).equalsIgnoreCase(lower)).collect(Collectors.toList()));
users.addAll(us.stream().filter(u -> u.getDisplayName(guild).toLowerCase().contains(lower)).collect(Collectors.toList()));
if (!users.isEmpty()) {
return users.get(0).getLongID();
}
return 0;
}
示例3: name
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static String name(IUser u, IGuild g, boolean showRealName) {
String s = StringEscapeUtils.escapeHtml4(u.getName()+"#"+u.getDiscriminator());
if(!u.getName().equals(u.getDisplayName(g)) && showRealName)s+=" ("+u.getDisplayName(g)+") ";
if(u.isBot())s+=" <span class='usermod_bot'>"+Main.lang.getLangage("tools.usermod.bot").toUpperCase()+"</span>";
try{if(Main.appid==u.getLongID())s+=" <span class='usermod_me'>"+Main.lang.getLangage("tools.usermod.me").toUpperCase()+"</span>";}catch(Exception e) {}
return s;
}
示例4: Quote
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public Quote(String quote, String quotee, IUser owner) {
this(quote, quotee);
this.owner = owner.getLongID();
}
示例5: getDBUser
import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static DBUser getDBUser(IGuild guild, IUser user) {
return new DBUser(guild, user.getLongID());
}