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


Java IRole.getName方法代码示例

本文整理汇总了Java中sx.blah.discord.handle.obj.IRole.getName方法的典型用法代码示例。如果您正苦于以下问题:Java IRole.getName方法的具体用法?Java IRole.getName怎么用?Java IRole.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sx.blah.discord.handle.obj.IRole的用法示例。


在下文中一共展示了IRole.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromRole

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public WebRole fromRole(IRole r, GuildSettings settings) {
	id = r.getLongID();
	name = r.getName();

	managed = r.isManaged();

	if (r.isEveryoneRole() && settings.getControlRole().equalsIgnoreCase("everyone")) {
		controlRole = true;
	} else {
		controlRole = settings.getControlRole().equalsIgnoreCase(String.valueOf(id));
	}

	return this;
}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:15,代码来源:WebRole.java

示例2: getRoleNameFromID

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public static String getRoleNameFromID(String id, MessageReceivedEvent event) {
	IRole role = getRoleFromID(id, event);
	if (role != null) {
		return role.getName();
	} else {
		return "ERROR";
	}
}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:9,代码来源:RoleUtils.java

示例3: runCommand

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public boolean runCommand(MessageReceivedEvent event, String[] args, String message) {
	String s = "";
	if(event.getGuild()!=null){
		s+="\nR�les: {";
		List<IRole> r = event.getAuthor().getRolesForGuild(event.getGuild());
		for (int i = 0; i < r.size(); i++) {
			if(i>0)s+=",";
			IRole d = r.get(i);
			s+="[id:"+d.getStringID()+", name:"+d.getName()+"]";
		}
		s+="}";
	}
	event.getChannel().sendMessage("Client Information: \nAuteur: "+event.getAuthor()+s+"\nId: "+event.getAuthor().getStringID());
	return true;
}
 
开发者ID:ate47,项目名称:ATEBot,代码行数:16,代码来源:InformationCommand.java

示例4: toString

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public static String toString (List<IRole> roles, String delimiter) {

        if (roles.isEmpty() || roles.size() == 1 && roles.get(0).isEveryoneRole()) {
            return "None";
        }

        String ret = "";

        for (final IRole role : roles) {
            if (!role.isEveryoneRole()) {
                ret += role.getName() + delimiter;
            }
        }
        return ret.substring(0, ret.length() - delimiter.length());
    }
 
开发者ID:MinecraftModDevelopment,项目名称:MMDBot,代码行数:16,代码来源:Utilities.java

示例5: randomizer

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
private String randomizer(IUser user, MessageReceivedEvent event, Random rng){
    List<IRole> rollRoles = event.getGuild().getRoles().stream().filter(x -> x.getName().contains("lotto-")).collect(Collectors.toList());
    for (IRole role : user.getRolesForGuild(event.getGuild())) {
        if (role.getName().contains("lotto-")) {
            event.getAuthor().removeRole(role);
            rollRoles.remove(role);
        }
    }
    IRole rngRole = rollRoles.get(rng.nextInt(rollRoles.size()));
    event.getAuthor().addRole(rngRole);
    return rngRole.getName();
}
 
开发者ID:ripxfrostbite,项目名称:karren-sama,代码行数:13,代码来源:RoleRoll.java

示例6: DiscordRole

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public DiscordRole(IRole role) {
    this.id = role.getID();
    this.name = role.getName();
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:5,代码来源:DiscordRole.java

示例7: userChat

import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
@EventSubscriber
public void userChat(MessageReceivedEvent event) {
    if (commands && event.getMessage().getContent().startsWith(commandPrefix) && event.getMessage().getContent().length() > 1) {
        // Commands enabled and it is a valid command
        switch (event.getMessage().getContent().substring(1)) {
            case "help":
                MessageAPI.sendToDiscord("Available commands: list");
                break;
            case "list":
                List<String> online = Bukkit.getOnlinePlayers().stream().map((Function<Player, String>) Player::getName).collect(Collectors.toList());

                MessageAPI.sendToDiscord("There are " + online.size() + "/"
                        + Bukkit.getMaxPlayers() + " players online:"
                        + "\n" + StringUtils.join(online.toArray(), ", "));
                break;
            default:
                break;
        }
    } else {
        if (relayChat) {
            if (!DiscordMC.getDiscordToMinecraft().contains(event.getMessage().getChannel())) {
                return;
            }
            
            String content = event.getMessage().getContent();
            List<IUser> mentions = event.getMessage().getMentions();
            List<IRole> roleMentions = event.getMessage().getRoleMentions();

            for (IUser u : mentions) {
                String name = u.getNicknameForGuild(event.getMessage().getGuild());
                String id = u.getStringID();

                // User name
                content = content.replaceAll("<@" + id + ">", "@" + name);
                // Nick name
                content = content.replaceAll("<@!" + id + ">", "@" + name);
            }

            for (IRole r : roleMentions) {
                String roleName = r.getName();
                String roleId = r.getStringID();

                content = content.replaceAll("<@&" + roleId + ">", "@" + roleName);
            }

            final String finalContent = content;
            final String nickname;
            if (useNickname) {
                nickname = event.getMessage().getAuthor().getNicknameForGuild(event.getMessage().getGuild());
            } else {
                nickname = event.getMessage().getAuthor().getName();
            }
            MessageAPI.sendToMinecraft(event.getMessage().getChannel(), nickname, finalContent);

            if (sendToConsole) {
                MessageAPI.sendToMinecraftConsole(event.getMessage().getChannel(), nickname, finalContent);
            }
        }
    }
}
 
开发者ID:manuelgu,项目名称:DiscordMC,代码行数:61,代码来源:DiscordEventListener.java


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