Java 类net.dv8tion.jda.core.entities.Category 实例源码

项目:JDA    文件:CategoryOrderAction.java   
@Nonnull
private static Collection<? extends Channel> getChannelsOfType(Category category, ChannelType type)
{
    Checks.notNull(type, "ChannelType");
    Checks.notNull(category, "Category");
    // In the event Discord allows a new channel type to be nested in categories,
    // supporting them via CategoryOrderAction is just a matter of adding a new case here.
    switch(type)
    {
        case TEXT:
            return category.getTextChannels();
        case VOICE:
            return category.getVoiceChannels();
        default:
            throw new IllegalArgumentException("Cannot order category with specified channel type " + type);
    }
}
项目:Amme    文件:overflowListener.java   
public void onGuildJoin(GuildJoinEvent event) {
    Guild g = event.getGuild();
        SQL.createServer(g);
        System.out.println("[Amme]System started on: " + g.getName());
    Guild guild = event.getGuild();
    GuildController controller = guild.getController();

    new Timer().schedule(new TimerTask() {
        @Override
        public void run() {

            controller.createCategory("Amme").queue(cat -> {

                controller.modifyCategoryPositions()
                        .selectPosition(cat.getPosition())
                        .moveTo(0).queue();

                String[] list = {"music", "commands", "log", "randomstuff"};

                Arrays.stream(list).forEach(s ->
                        controller.createTextChannel(s).queue(chan -> chan.getManager().setParent((Category) cat).queue())
                );
            });
            SQL.updateValue(guild, "music", event.getGuild().getTextChannelsByName("music", true).get(0).getName());
            SQL.updateValue(guild, "logchannel", event.getGuild().getTextChannelsByName("log", true).get(0).getId());
            SQL.updateValue(guild, "joinchannel", event.getGuild().getTextChannelsByName("randomstuff", true).get(0).getId());
        }
    }, 5000);


}
项目:GabrielBot    文件:GabrielBot.java   
public Category getCategoryById(long id) {
    for(Shard s : shards) {
        Category c = s.getJDA().getCategoryById(id);
        if(c != null) return c;
    }
    return null;
}
项目:GabrielBot    文件:GabrielBot.java   
public SnowflakeCacheView<Category> getCategories() {
    return view(JDA::getCategoryCache);
}
项目:JDA    文件:VoiceChannelUpdateParentEvent.java   
public VoiceChannelUpdateParentEvent(JDA api, long responseNumber, VoiceChannel channel, Category oldParent)
{
    super(api, responseNumber, channel);
    this.oldParent = oldParent;
}
项目:JDA    文件:VoiceChannelUpdateParentEvent.java   
public Category getOldParent()
{
    return oldParent;
}
项目:JDA    文件:TextChannelUpdateParentEvent.java   
public TextChannelUpdateParentEvent(JDA api, long responseNumber, TextChannel channel, Category oldParent)
{
    super(api, responseNumber, channel);
    this.oldParent = oldParent;
}
项目:JDA    文件:TextChannelUpdateParentEvent.java   
public Category getOldParent()
{
    return oldParent;
}
项目:JDA    文件:CategoryDeleteEvent.java   
public CategoryDeleteEvent(JDA api, long responseNumber, Category category)
{
    super(api, responseNumber, category);
}
项目:JDA    文件:GenericCategoryEvent.java   
public GenericCategoryEvent(JDA api, long responseNumber, Category category)
{
    super(api, responseNumber);
    this.category = category;
}
项目:JDA    文件:CategoryUpdateNameEvent.java   
public CategoryUpdateNameEvent(JDA api, long responseNumber, Category category, String oldName)
{
    super(api, responseNumber, category);
    this.oldName = oldName;
}
项目:JDA    文件:GenericCategoryUpdateEvent.java   
public GenericCategoryUpdateEvent(JDA api, long responseNumber, Category category)
{
    super(api, responseNumber, category);
}
项目:JDA    文件:CategoryUpdatePositionEvent.java   
public CategoryUpdatePositionEvent(JDA api, long responseNumber, Category category, int oldPosition)
{
    super(api, responseNumber, category);
    this.oldPosition = oldPosition;
}
项目:JDA    文件:CategoryUpdatePermissionsEvent.java   
public CategoryUpdatePermissionsEvent(JDA api, long responseNumber, Category category, List<IPermissionHolder> changed)
{
    super(api, responseNumber, category);
    this.changed = changed;
}
项目:JDA    文件:CategoryCreateEvent.java   
public CategoryCreateEvent(JDA api, long responseNumber, Category category)
{
    super(api, responseNumber, category);
}
项目:JDA    文件:CategoryOrderAction.java   
/**
 * Creates a new CategoryOrderAction for the specified {@link net.dv8tion.jda.core.entities.Category Category}
 *
 * @param  category
 *         The target {@link net.dv8tion.jda.core.entities.Category Category}
 *         which the new CategoryOrderAction will order channels from.
 * @param  type
 *         The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} that
 *         matches the returning value of {@link net.dv8tion.jda.core.entities.Channel#getType() Channel#getType()}
 *         for the generic {@link net.dv8tion.jda.core.entities.Channel Channel} type {@code T}.
 *
 * @throws java.lang.IllegalArgumentException
 *         If the {@code ChannelType} is not one that can be retrieved from a {@code Category}.
 *         Currently the only two allowed are {@link ChannelType#TEXT} and {@link ChannelType#VOICE}.
 */
@SuppressWarnings("unchecked")
public CategoryOrderAction(Category category, ChannelType type)
{
    super(category.getGuild(), type, (Collection<T>) getChannelsOfType(category, type));
    this.category = category;
}
项目:JDA    文件:ChannelManager.java   
/**
 * Sets the <b><u>{@link net.dv8tion.jda.core.entities.Category Parent Category}</u></b>
 * of the selected {@link net.dv8tion.jda.core.entities.Channel Channel}.
 *
 *
 * @param  category
 *         The new parent for the selected {@link net.dv8tion.jda.core.entities.Channel Channel}
 *
 * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException
 *         If the currently logged in account does not have the Permission {@link net.dv8tion.jda.core.Permission#MANAGE_CHANNEL MANAGE_CHANNEL}
 * @throws IllegalArgumentException
 *         If the provided category is not from the same Guild
 * @throws UnsupportedOperationException
 *         If the target is a category itself
 *
 * @return {@link net.dv8tion.jda.core.requests.restaction.AuditableRestAction AuditableRestAction}
 *         <br>Update RestAction from {@link ChannelManagerUpdatable#update() #update()}
 *
 * @since  3.4.0
 *
 * @see    net.dv8tion.jda.core.managers.ChannelManagerUpdatable#getParentField()
 * @see    net.dv8tion.jda.core.managers.ChannelManagerUpdatable#update()
 */
@CheckReturnValue
public AuditableRestAction<Void> setParent(Category category)
{
    return updatable.getParentField().setValue(category).update();
}
项目:JDA    文件:GenericCategoryEvent.java   
/**
 * The responsible {@link net.dv8tion.jda.core.entities.Category Category}
 *
 * @return The Category
 */
public Category getCategory()
{
    return category;
}
项目:JDA    文件:CategoryOrderAction.java   
/**
 * Gets the {@link net.dv8tion.jda.core.entities.Category Category}
 * controlled by this CategoryOrderAction.
 *
 * @return The {@link net.dv8tion.jda.core.entities.Category Category}
 *         of this CategoryOrderAction.
 */
@Nonnull
public Category getCategory()
{
    return category;
}