简体   繁体   中英

Public Role permissions sometimes doesn't work

I create with a action a new channel, i wanna deny the reading permission for the public role but it works only sometimes. Sometimes everybody can read it sometimes the permission is denied. Can anybody help me?

TextChannel channel = cat.createTextChannel(getFormatedName()  + "-ticket-" + User.getId())
                .addPermissionOverride(guild.getPublicRole(), null, EnumSet.of(Permission.MESSAGE_READ))
                .addPermissionOverride(getAdminRole(), EnumSet.of(Permission.MESSAGE_READ), null)
                .addPermissionOverride(guild.getMemberById(User.getId()), EnumSet.of(Permission.MESSAGE_READ), null)
                .complete();

This seems to be a bug in versions older than 4.2.0_174 . I recommend you update to fix this issue.

Why does this happen?

When you create a channel in a category using Category#createTextChannel it will first apply all the permission overrides from that category. After this, you apply your manual overrides which might collide with the existing overrides from the category. Due to a bug this would end up with 2 overrides in the request. This causes inconsistent output that can cause strange results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM