/** * The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} * * @return The ChannelType */ public ChannelType getType() { return getChannel().getType(); }
Checks.check(channels.stream().allMatch(c -> guild.equals(c.getGuild())), "One or more channels are not from the correct guild"); Checks.check(channels.stream().allMatch(c -> c.getType().equals(type)), "One or more channels did not match the expected type of " + type.name());
@Override public boolean onCommand(CommandMessage context, String[] args) { if (args.length == 0) { return sendErrorMessage(context, context.i18n("missingArgument")); } Channel channel = MentionableUtil.getChannel(context.getMessage(), args); if (channel == null) { return handleSlowmode(context, context.getChannel(), args); } if (!channel.getType().equals(ChannelType.TEXT)) { return sendErrorMessage(context, "invalidTextChannel", channel.getName()); } return handleSlowmode(context, (TextChannel) channel, Arrays.copyOfRange(args, 1, args.length)); }
private void handleChannelCreate(GuildWrapper wrapper, Channel channel) { if (cannotHandle(wrapper, ModlogEvent.CHANNEL_CREATE)) return; AuditLogEntry entry = wrapper.getGuild().getAuditLogs().complete().get(0); EmbedBuilder builder = new EmbedBuilder() .addField("Type", channel.getType().name().toLowerCase(), true) .addField("Name", channel.getName(), true); if (channel.getParent() != null) { builder.addField("Category", channel.getParent().getName(), true); } ModlogHandler.getInstance().postToModlog(wrapper, ModlogEvent.CHANNEL_CREATE, entry.getUser(), builder); }
private void handleChannelDelete(GuildWrapper wrapper, Channel channel) { if (wrapper == null) return; if (cannotHandle(wrapper, ModlogEvent.CHANNEL_DELETE)) return; AuditLogEntry entry = wrapper.getGuild().getAuditLogs().complete().get(0); EmbedBuilder builder = new EmbedBuilder() .addField("Type", channel.getType().name().toLowerCase(), true) .addField("Name", channel.getName(), true); if (channel.getParent() != null) { builder.addField("Category", channel.getParent().getName(), true); } ModlogHandler.getInstance().postToModlog(wrapper, ModlogEvent.CHANNEL_DELETE, entry.getUser(), builder); }