JDA icon indicating copy to clipboard operation
JDA copied to clipboard

Add category feature to ChannelOrderAction

Open MinnDevelopment opened this issue 3 years ago • 0 comments

Pull Request Etiquette

Changes

  • [ ] Internal code
  • [x] Library interface (affecting end-user code)
  • [ ] Documentation
  • [ ] Other: _____

Closes Issue: NaN

Description

Adds support for lock_permissions, parent_id, and new move operations moveAbove and moveBelow.

~~Note: moveAbove will actually behave unexpectedly for modifyRolePositions because it uses the reverse order by default. Using guild.modifyRolePositions().selectPosition(b).moveAbove(a) will actually move it below a in the role list.~~

Breaking Change

The order of Guild#modifyRolePositions is now descending by default. This better aligns with all other role orders used in JDA, such as Member#getRoles and Guild#getRoles, which are both descending as well. In addition, this also makes more sense for moveAbove and moveBelow.

Example

var category = guild.getCategoryById(936772770262552626);
var marker = guild.getTextChannelById(936772801807933480);

guild.createTextChannel("test-b").queue(it -> {
    guild.modifyTextChannelPositions()
        .selectPosition(it)
        .setCategory(category, true)
        .moveAbove(marker)
        .queue();
});

MinnDevelopment avatar May 20 '22 17:05 MinnDevelopment