当前位置: 首页>>代码示例>>Java>>正文


Java IUser.getLongID方法代码示例

本文整理汇总了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;
		}
	}
}
 
开发者ID:Vauff,项目名称:Maunz-Discord,代码行数:26,代码来源:Util.java

示例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;
}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:36,代码来源:UserUtils.java

示例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;
}
 
开发者ID:ate47,项目名称:ATEBot,代码行数:8,代码来源:UserModHandler.java

示例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();
}
 
开发者ID:tterrag1098,项目名称:MCBot,代码行数:5,代码来源:CommandQuote.java

示例5: getDBUser

import sx.blah.discord.handle.obj.IUser; //导入方法依赖的package包/类
public static DBUser getDBUser(IGuild guild, IUser user) {
	return new DBUser(guild, user.getLongID());
}
 
开发者ID:Shadorc,项目名称:Shadbot,代码行数:4,代码来源:Database.java


注:本文中的sx.blah.discord.handle.obj.IUser.getLongID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。