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


Java Guild.getName方法代码示例

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


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

示例1: execute

import net.dv8tion.jda.entities.Guild; //导入方法依赖的package包/类
@Override
protected boolean execute(Object[] args, MessageReceivedEvent event) {
    String id = (String)args[0];
    //String reason = (String)args[1];
    Guild guild = event.getJDA().getGuildById(id);
    if(guild==null)
    {
        Sender.sendResponse(SpConst.ERROR+"Not a valid Guild ID", event);
        return false;
    }
    if(lists.getState(id)==GlobalLists.ListState.GOLDLIST)
    {
        Sender.sendResponse(SpConst.WARNING+"**"+guild.getName()+"** is already goldlisted!", event);
        return false;
    }
    String[] entry = new String[lists.getSize()];
    entry[GlobalLists.ID] = id;
    entry[GlobalLists.LISTTYPE] = "GOLDLIST";
    entry[GlobalLists.REASON] = guild.getName();
    entry[GlobalLists.IDTYPE] = "GUILD";
    lists.set(entry);
    Sender.sendResponse(SpConst.SUCCESS+entry[GlobalLists.IDTYPE]+" with ID `"+id+"` ("+guild.getName()+") added to goldlist", event);
    return true;
}
 
开发者ID:jagrosh,项目名称:Spectra,代码行数:25,代码来源:GoldList.java

示例2: execute

import net.dv8tion.jda.entities.Guild; //导入方法依赖的package包/类
@Override
protected boolean execute(Object[] args, MessageReceivedEvent event) {
    Guild guild = event.getGuild();
    long onlineCount = guild.getUsers().stream().filter((u) -> 
            (u.getOnlineStatus()==OnlineStatus.ONLINE || u.getOnlineStatus()==OnlineStatus.AWAY))
            .count();
    long botCount = guild.getUsers().stream().filter(User::isBot).count();
    String str = "\uD83D\uDDA5 Information about **"+guild.getName()+"**:\n"
            +SpConst.LINESTART+"ID: **"+guild.getId()+"**\n"
            +SpConst.LINESTART+"Owner: **"+guild.getOwner().getUsername()+"** #"+guild.getOwner().getDiscriminator()+"\n"
        
            +SpConst.LINESTART+"Location: **"+guild.getRegion().getName()+"**\n"
            +SpConst.LINESTART+"Creation: **"+MiscUtil.getCreationTime(guild.getId()).format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**\n"
        
            +SpConst.LINESTART+"Users: **"+guild.getUsers().size()+"** ("+onlineCount+" online, "+botCount+" bots)\n"
            +SpConst.LINESTART+"Channels: **"+guild.getTextChannels().size()+"** Text, **"+guild.getVoiceChannels().size()+"** Voice\n"
            +SpConst.LINESTART+"Verification: **"+(guild.getVerificationLevel().equals(VerificationLevel.HIGH)?"(╯°□°)╯︵ ┻━┻":guild.getVerificationLevel())+"**";
    if(guild.getIconUrl()!=null)
        str+="\n"+SpConst.LINESTART+"Server Icon: "+guild.getIconUrl();
    
    Sender.sendResponse(str, event);
    return true;
}
 
开发者ID:jagrosh,项目名称:Spectra,代码行数:24,代码来源:Server.java

示例3: execute

import net.dv8tion.jda.entities.Guild; //导入方法依赖的package包/类
@Override
protected boolean execute(Object[] args, MessageReceivedEvent event) {
    String id = (String)args[0];
    String details = (String)args[1];
    Guild guild = event.getJDA().getGuildById(id);
    if(lists.getState(id)==GlobalLists.ListState.WHITELIST)
    {
        Sender.sendResponse(SpConst.WARNING+(guild==null?"[???]":"**"+guild.getName()+"**")+" is already whitelisted!", event);
        return false;
    }
    String[] entry = new String[lists.getSize()];
    entry[GlobalLists.ID] = id;
    entry[GlobalLists.LISTTYPE] = "WHITELIST";
    entry[GlobalLists.REASON] = guild==null ? details : guild.getName();
    entry[GlobalLists.IDTYPE] = "GUILD";
    lists.set(entry);
    Sender.sendResponse(SpConst.SUCCESS+entry[GlobalLists.IDTYPE]+" with ID `"+id+"` ("+(guild==null ? "???" : guild.getName())+") added to whitelist", event);
    return true;
}
 
开发者ID:jagrosh,项目名称:Spectra,代码行数:20,代码来源:WhiteList.java

示例4: execute

import net.dv8tion.jda.entities.Guild; //导入方法依赖的package包/类
@Override
protected boolean execute(Object[] args, MessageReceivedEvent event) {
    Guild g = event.getJDA().getGuildById((String)args[0]);
    if(g==null)
    {
        Sender.sendResponse(SpConst.ERROR+"Guild with ID `"+args[0]+"` not found!", event);
        return false;
    }
    long botcount = g.getUsers().stream().filter(User::isBot).count();
    long usercount = g.getUsers().stream().filter(u -> {
            return !u.isBot() && u.getAvatarId()!=null && MiscUtil.getCreationTime(u.getId()).plusDays(7).isBefore(OffsetDateTime.now());
        }).count();
    int requirements = spectra.meetsRequirements(g);
    StringBuilder builder = new StringBuilder(SpConst.SUCCESS+"Found **"+g.getName()+"**:");
    builder.append("\nOwner: ").append(FormatUtil.fullUser(g.getOwner()))
           .append("\nCreated: ").append(MiscUtil.getCreationTime(g.getId()).format(DateTimeFormatter.RFC_1123_DATE_TIME))
           .append("\nTotal users: ").append(g.getUsers().size())
           .append("\nReal users: ").append(usercount)
           .append("\nBots: ").append(botcount)
           .append("\nRequirements? ").append(requirements > 0 ? "No" : "Yes").append(" (").append(requirements).append(")");
    Sender.sendResponse(builder.toString(), event);
    return true;
}
 
开发者ID:jagrosh,项目名称:Spectra,代码行数:24,代码来源:SystemCmd.java


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