Package org.javacord.api.entity.channel
Class ServerChannelUpdater
- java.lang.Object
-
- org.javacord.api.entity.channel.ServerChannelUpdater
-
- Direct Known Subclasses:
ServerTextChannelUpdater,ServerVoiceChannelUpdater
public class ServerChannelUpdater extends Object
This class can be used to update server channels.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedServerChannelUpdater()Creates a new server channel updater without delegate.ServerChannelUpdater(ServerChannel channel)Creates a new server channel updater.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Permissionable & DiscordEntity>
ServerChannelUpdateraddPermissionOverwrite(T permissionable, Permissions permissions)Adds a permission overwrite for the given entity.<T extends Permissionable & DiscordEntity>
ServerChannelUpdaterremovePermissionOverwrite(T permissionable)Removes a permission overwrite for the given entity.ServerChannelUpdatersetAuditLogReason(String reason)Sets the reason for this update.ServerChannelUpdatersetName(String name)Queues the name to be updated.ServerChannelUpdatersetRawPosition(int rawPosition)Queues the raw position to be updated.CompletableFuture<Void>update()Performs the queued updates.
-
-
-
Constructor Detail
-
ServerChannelUpdater
protected ServerChannelUpdater()
Creates a new server channel updater without delegate.
-
ServerChannelUpdater
public ServerChannelUpdater(ServerChannel channel)
Creates a new server channel updater.- Parameters:
channel- The channel to update.
-
-
Method Detail
-
setAuditLogReason
public ServerChannelUpdater setAuditLogReason(String reason)
Sets the reason for this update. This reason will be visible in the audit log entry(s).- Parameters:
reason- The reason for this update.- Returns:
- The current instance in order to chain call methods.
-
setName
public ServerChannelUpdater setName(String name)
Queues the name to be updated.- Parameters:
name- The new name of the channel.- Returns:
- The current instance in order to chain call methods.
-
setRawPosition
public ServerChannelUpdater setRawPosition(int rawPosition)
Queues the raw position to be updated.- Parameters:
rawPosition- The new position of the channel. If you want to update the position based on other channels, make sure to useServerChannel.getRawPosition()instead ofServerChannel.getPosition()!- Returns:
- The current instance in order to chain call methods.
-
addPermissionOverwrite
public <T extends Permissionable & DiscordEntity> ServerChannelUpdater addPermissionOverwrite(T permissionable, Permissions permissions)
Adds a permission overwrite for the given entity.- Type Parameters:
T- The type of entity to hold the permission, usuallyUserorRole- Parameters:
permissionable- The entity whose permissions should be overwritten.permissions- The permission overwrites.- Returns:
- The current instance in order to chain call methods.
-
removePermissionOverwrite
public <T extends Permissionable & DiscordEntity> ServerChannelUpdater removePermissionOverwrite(T permissionable)
Removes a permission overwrite for the given entity.- Type Parameters:
T- The type of entity to hold the permission, usuallyUserorRole- Parameters:
permissionable- The entity which permission overwrite should be removed.- Returns:
- The current instance in order to chain call methods.
-
update
public CompletableFuture<Void> update()
Performs the queued updates.- Returns:
- A future to check if the update was successful.
-
-