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


Java IGuild类代码示例

本文整理汇总了Java中sx.blah.discord.handle.obj.IGuild的典型用法代码示例。如果您正苦于以下问题:Java IGuild类的具体用法?Java IGuild怎么用?Java IGuild使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IGuild类属于sx.blah.discord.handle.obj包,在下文中一共展示了IGuild类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: moduleDisCalInfo

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
private void moduleDisCalInfo(MessageReceivedEvent event, GuildSettings settings) {
      IGuild guild = event.getGuild();

      EmbedBuilder em = new EmbedBuilder();
      em.withAuthorIcon(Main.client.getGuildByID(266063520112574464L).getIconURL());
      em.withAuthorName("DisCal!");
      em.withTitle(MessageManager.getMessage("Embed.DisCal.Info.Title", settings));
      em.appendField(MessageManager.getMessage("Embed.DisCal.Info.Developer", settings), "NovaFox161", true);
      em.appendField(MessageManager.getMessage("Embed.Discal.Info.Version", settings), Main.version, true);
em.appendField(MessageManager.getMessage("Embed.DisCal.Info.Library", settings), "Discord4J, version 2.9.2", false);
      em.appendField(MessageManager.getMessage("Embed.DisCal.Info.TotalGuilds", settings), Main.client.getGuilds().size() + "", true);
      em.appendField(MessageManager.getMessage("Embed.DisCal.Info.TotalCalendars", settings), DatabaseManager.getManager().getCalendarCount() + "", true);
      em.appendField(MessageManager.getMessage("Embed.DisCal.Info.TotalAnnouncements", settings), DatabaseManager.getManager().getAnnouncementCount() + "", true);
if (BotSettings.RUN_API.get().equalsIgnoreCase("True")) {
	//TODO: Add to translations
	em.appendField("Users in Dashboard", DiscordAccountHandler.getHandler().accountCount() + "", true);
}
em.appendField(MessageManager.getMessage("Embed.DisCal.Info.Ping", "%shard%", (guild.getShard().getInfo()[0] + 1) + "/" + Main.client.getShardCount(), settings), guild.getShard().getResponseTime() + "ms", false);
      em.withFooterText(MessageManager.getMessage("Embed.DisCal.Info.Patron", settings) + ": https://www.patreon.com/Novafox");
      em.withUrl("https://www.cloudcraftgaming.com/discal/");
      em.withColor(56, 138, 237);
      Message.sendMessage(em.build(), event);
  }
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:24,代码来源:DisCalCommand.java

示例2: moduleListGuilds

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
private void moduleListGuilds(MessageReceivedEvent event) {

		Message.sendMessage("Sending a list of all Guilds! This may take awhile...", event);
		StringBuilder msg = new StringBuilder();

		for (IGuild g : Main.client.getGuilds()) {
			msg.append(MessageUtils.lineBreak).append(g.getName()).append(" | ").append(g.getLongID()).append(" | Members: ").append(g.getTotalMemberCount()).append(" | Bots: ").append(botPercent(g)).append("%");

			if (msg.length() >= 1500) {
				Message.sendMessage(msg.toString(), event);
				msg = new StringBuilder();
			}
		}
		Message.sendMessage(msg.toString(), event);
		Message.sendMessage("All Guilds listed!", event);
	}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:17,代码来源:DevCommand.java

示例3: getRole

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public static long getRole(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("[<@&>]", "");
		IRole exists = guild.getRoleByID(Long.parseLong(toLookFor.replaceAll("[<@&>]", "")));
		if (exists != null) {
			return exists.getLongID();
		}
	}


	List<IRole> roles = new ArrayList<>();
	List<IRole> rs = guild.getRoles();
	roles.addAll(rs.stream().filter(r -> r.getName().equalsIgnoreCase(lower)).collect(Collectors.toList()));
	roles.addAll(rs.stream().filter(r -> r.getName().toLowerCase().contains(lower)).collect(Collectors.toList()));
	final StringBuilder builder = new StringBuilder(); // DEBUG
	roles.forEach(r -> builder.append(r.getName()).append(", ")); // DEBUG
	if (!roles.isEmpty()) {
		return roles.get(0).getLongID();
	}

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

示例4: serverElement

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public static String serverElement(IGuild g, Account acc) {
	String s = "<table class='table_list usermod'><tr class='table_list_top'>"
			+ "<td>"+Main.lang.getLangage("tools.usermod.guild.icon")+"</td>"
			+ "<td>"+Main.lang.getLangage("tools.usermod.guild.name")+"</td>";
		if(acc.hasPerm("guildmod"))s+="<td class='usermod_gtool'>"+Main.lang.getLangage("tools.usermod.guild.tool")+"</td>";
		s+="<td class='usermod_id'>"+Main.lang.getLangage("tools.usermod.guild.id")+"</td></tr>"
			+ "\n<tr>"
			+ "\n<td class='usermod_gimg'><img src='"+g.getIconURL()+"' alt='"+Main.lang.getLangage("tools.usermod.guild.icon")+"' /></td>"
			+ "\n<td>"+g.getName()+"</td>";
		if(acc.hasPerm("guildmod")) s+="\n<td>\n <ul>"
			+ "\n  <a href='tools.ap?app=guildmod&guild="+g.getLongID()+"#text_edit'><li>"+Main.lang.getLangage("tools.guildmod.channel.text")+"</li></a>"
			+ "\n  <a href='tools.ap?app=guildmod&guild="+g.getLongID()+"#voice_edit'><li>"+Main.lang.getLangage("tools.guildmod.channel.voice")+"</li></a>"
			+ "\n  <a href='tools.ap?app=guildmod&guild="+g.getLongID()+"#role_edit'><li>"+Main.lang.getLangage("tools.guildmod.role")+"</li></a>"
			+ "\n  <a href='tools.ap?app=usermod&guild="+g.getLongID()+"#user_edit'><li>"+Main.lang.getLangage("tools.usermod")+"</li></a>"
			+ "\n </ul>\n</td>";
		s+="\n<td>"+g.getLongID()+"</td>"
			+ "\n</tr></table>";
	return s;
}
 
开发者ID:ate47,项目名称:ATEBot,代码行数:20,代码来源:UserModHandler.java

示例5: action

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public static void action(final Predicate<Channel> filter, final Consumer<IChannel> a) {
	EEWBot.instance.getChannels().entrySet()
			.forEach(entry -> {
				final IGuild guild = EEWBot.instance.getClient().getGuildByID(entry.getKey());
				if (guild!=null)
					entry.getValue().stream().filter(filter)
							.forEach(channel -> {
								final IChannel dc = guild.getChannelByID(channel.id);
								if (dc!=null)
									try {
										a.accept(dc);
									} catch (final MissingPermissionsException ex) {
										Log.logger.warn("権限がありません: "+guild.getName()+" #"+dc.getName());
									}
							});
			});
}
 
开发者ID:Team-Fruit,项目名称:EEWBot,代码行数:18,代码来源:EEWEventListener.java

示例6: hasPermission

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public boolean hasPermission(IUser user, IGuild server, String permission) {
    boolean check = false;
    if (permission.equalsIgnoreCase(Globals.BOT_OWNER)) {
        if (user.equals(INIT.BOT.getApplicationOwner())) {
            check = true;
        }
    } else {
        for (IRole role : user.getRolesForGuild(server)) {
            if (grouppermissions.get(role) != null && grouppermissions.get(role).contains(permission)) {
                check = true;
            }
        }
    }
    if (DRIVER.getPropertyOnly(DRIVER.CONFIG, "ownerbypass").equals(true) && user.equals(INIT.BOT.getApplicationOwner())) {
        check = true;
    }
    return check;
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:19,代码来源:PermissionController.java

示例7: putvaluesfromlist

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public static void putvaluesfromlist(String gender, JSONArray list) {
    if (list != null) {
        HashMap<IGuild, List<IRole>> serverrolesmap = new HashMap<>();
        for (int i = 0; i < list.length(); i++) {
            JSONObject serverroles = Utils.objectToJSONObject(list.get(i));
            if (serverroles != null) {
                for (Object serverid : serverroles.keySet()) {
                    JSONArray array = Utils.objectToJSONArray(serverroles.get(serverid.toString()));
                    ArrayList<IRole> roles = new ArrayList<>();
                    for (int j = 0; j < array.length(); j++) {
                        roles.add(INIT.BOT.getRoleByID(Long.valueOf(array.getString(i))));
                    }
                    serverrolesmap.put(INIT.BOT.getGuildByID(Long.valueOf(serverid.toString())), roles);
                }
            }

        }
        gendersave.put(gender, serverrolesmap);
    }
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:21,代码来源:RoleManagement.java

示例8: getServer

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
@Command(
        command = "getserver",
        arguments = {},
        description = "Get Servers",
        alias = "gets",
        permission = Globals.BOT_OWNER,
        prefix = Globals.ADMIN_PREFIX
)
public boolean getServer(MessageReceivedEvent event, String[] args) {
    try {
        List<IGuild> server = INIT.BOT.getGuilds();
        EmbedBuilder builder = new EmbedBuilder();
        builder.withTitle("ServerList");
        builder.withDescription(Markdown.bold("Size: "+server.size())+" \n");
        for (IGuild serverinst: server) {
            builder.appendDesc(Markdown.bold(serverinst.getName())+": "+serverinst.getStringID()+" \n");
        }
        builder.withColor(Color.green);
        BotUtils.sendPrivEmbMessage(event.getAuthor().getOrCreatePMChannel(), builder, false);
    } catch (Exception ex) {
        BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(String.format(LANG.SUCCESS+LANG.getTranslation("commonmessage_error"), ex.getMessage())), true);
    }
    return true;
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:25,代码来源:ServerManager.java

示例9: leaveServer

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
@Command(
        command = "leaveserver",
        arguments = {"ServerID"},
        description = "Leaves a specific Server",
        alias = "leaves",
        permission = Globals.BOT_OWNER,
        prefix = Globals.ADMIN_PREFIX
)
public boolean leaveServer(MessageReceivedEvent event, String[] args) {
    try {
        IGuild guild = INIT.BOT.getGuildByID(Long.valueOf(args[0]));
        guild.leave();
        BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(LANG.SUCCESS+LANG.getTranslation("command_success")), true);
    } catch (Exception ex) {
        BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(String.format(LANG.SUCCESS+LANG.getTranslation("commonmessage_error"), ex.getMessage())), true);
    }
    return true;
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:19,代码来源:ChangeCommands.java

示例10: muteServer

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
@Command(
        command = "muteserver",
        arguments = {"ServerID", "true or false"},
        description = "Mutes a specific Server",
        alias = "mutes",
        permission = Globals.BOT_OWNER,
        prefix = Globals.ADMIN_PREFIX
)
public boolean muteServer(MessageReceivedEvent event, String[] args) {
    try {
        IGuild guild = INIT.BOT.getGuildByID(Long.valueOf(args[0]));
        INIT.BOT.mute(guild, Boolean.valueOf(args[1]));
        BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(LANG.SUCCESS+LANG.getTranslation("command_success")), true);
    } catch (Exception ex) {
        BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(String.format(LANG.SUCCESS+LANG.getTranslation("commonmessage_error"), ex.getMessage())), true);
    }
    return true;
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:19,代码来源:ChangeCommands.java

示例11: addDisabledServer

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public void addDisabledServer(IGuild guild, boolean newserver, String module) {
    try {
        if (disabledlist.get(module) != null && !disabledlist.get(module).contains(guild.getStringID())) {
            if (newserver) {
                Console.debug(module+"| Server added as New");
                disabledlist.get(module).add(guild.getStringID());
                DRIVER.setProperty(DRIVER.CONFIG, module+"_disabled_servers", disabledlist.get(module));
            } else {
                Console.debug(module+"| Server exists");
                disabledlist.get(module).add(guild.getStringID());
                DRIVER.getProperty(DRIVER.CONFIG, module+"_disabled_servers", disabledlist.get(module));
            }
            Console.debug("Saved: |"+guild.getStringID()+"   "+module+"    "+guild.getStringID());
        }
    } catch (Exception ex) {
        Console.error(module+"| Cant add Server");
        Console.error(ex);
    }
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:20,代码来源:ServerControl.java

示例12: onGuildCreate

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
@EventSubscriber
public void onGuildCreate(GuildCreateEvent event) {
    Console.println("==================NEW SERVER |" + event.getGuild().getName() + "| " + event.getGuild().getStringID());
    if (SERVER_CONTROL.checkServerisBanned(event.getGuild())) {
        Console.println("Leave Banned Server: "+event.getGuild().getName());
        BotUtils.sendPrivMessage(event.getGuild().getOwner().getOrCreatePMChannel(), "Your Server is on the banned Server List. Please contact [email protected] and describe why do you want to get unbanned.", false);
        event.getGuild().leave();
    } else {
        if (running) {
            Stats.addServer(event.getGuild());
            Console.debug("Adding Permission for new Server");
            List<IGuild> server = new ArrayList<>();
            server.add(event.getGuild());
            PERM.setDefaultPermissions(server, true);
            Console.debug("Adding Disabled Server for new Server");
            saveGuild(event.getGuild());
            DRIVER.saveJson();
        }
        Console.debug("===================new Server added====");
    }
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:22,代码来源:ServerListener.java

示例13: saveGuild

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
private void saveGuild(IGuild server) {
    if (DRIVER.hasKey(DRIVER.CONFIG, SERVER_CONTROL.MUSIC_MODULE + "_disabled_default") || DRIVER.hasKey(DRIVER.CONFIG, SERVER_CONTROL.JOIN_MODULE + "_disabled_default")) {
        if (DRIVER.hasKey(DRIVER.CONFIG, SERVER_CONTROL.MUSIC_MODULE + "_disabled_servers")) {
            SERVER_CONTROL.addDisabledServer(server, running, SERVER_CONTROL.MUSIC_MODULE);
        }
        if (DRIVER.hasKey(DRIVER.CONFIG, SERVER_CONTROL.JOIN_MODULE + "_disabled_servers")) {
            SERVER_CONTROL.addDisabledServer(server, running, SERVER_CONTROL.JOIN_MODULE);
        }
        if (!DRIVER.hasKey(DRIVER.CONFIG, SERVER_CONTROL.MUSIC_MODULE + "_disabled_servers")) {
            SERVER_CONTROL.addDisabledServer(server, true, SERVER_CONTROL.MUSIC_MODULE);
        }
        if (!DRIVER.hasKey(DRIVER.CONFIG, SERVER_CONTROL.JOIN_MODULE + "_disabled_servers")) {
            SERVER_CONTROL.addDisabledServer(server, true, SERVER_CONTROL.JOIN_MODULE);
        }
    }
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:17,代码来源:ServerListener.java

示例14: sanitize

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
public static String sanitize(@Nullable IGuild guild, String message) {
    if (message == null) return null;
    if (guild == null) return message;
    
	Matcher matcher = REGEX_MENTION.matcher(message);
	while (matcher.find()) {
	    long id = Long.parseLong(matcher.group(1));
	    String name;
	    if (matcher.group().contains("&")) {
	        name = "the " + MCBot.instance.getRoleByID(id).getName();
	    } else {
	        IUser user = guild.getUserByID(id);
	        if (matcher.group().contains("!")) {
	            name = user.getDisplayName(guild).replaceAll("@", "@\u200B");
	        } else {
	            name = user.getName();
	        }
	    }

		message = message.replace(matcher.group(), name);
    }
    return message.replace("@here", "everyone").replace("@everyone", "everyone").replace("@", "@\u200B");
}
 
开发者ID:tterrag1098,项目名称:MCBot,代码行数:24,代码来源:CommandContext.java

示例15: check

import sx.blah.discord.handle.obj.IGuild; //导入依赖的package包/类
private synchronized void check(IGuild guild) {
	IVoiceChannel botVoiceChannel = guild.getClient().getOurUser().getVoiceStateForGuild(guild).getChannel();
	if(botVoiceChannel == null) {
		return;
	}

	GuildMusic guildMusic = GuildMusicManager.GUILD_MUSIC_MAP.get(guild.getLongID());
	if(guildMusic == null) {
		return;
	}

	if(this.isAlone(botVoiceChannel) && !guildMusic.isLeavingScheduled()) {
		BotUtils.sendMessage(Emoji.INFO + " Nobody is listening anymore, music paused. I will leave the voice channel in 1 minute.", guildMusic.getChannel());
		guildMusic.getScheduler().getAudioPlayer().setPaused(true);
		guildMusic.scheduleLeave();

	} else if(!this.isAlone(botVoiceChannel) && guildMusic.isLeavingScheduled()) {
		BotUtils.sendMessage(Emoji.INFO + " Somebody joined me, music resumed.", guildMusic.getChannel());
		guildMusic.getScheduler().getAudioPlayer().setPaused(false);
		guildMusic.cancelLeave();
	}
}
 
开发者ID:Shadorc,项目名称:Shadbot,代码行数:23,代码来源:UserVoiceChannelListener.java


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