Search in sources :

Example 6 with CommandPermissionException

use of com.discordbolt.api.command.exceptions.CommandPermissionException in project BoltBot by DiscordBolt.

the class Playlist method addContributor.

public void addContributor(IUser requestor, IUser contributor) throws CommandStateException, CommandPermissionException {
    if (!ownerID.equals(requestor.getLongID()))
        throw new CommandPermissionException("You are not allowed to add contributors to " + this.getTitle() + ".");
    if (contributors.contains(contributor.getLongID()))
        throw new CommandStateException(contributor.getName() + " is already a contributor to " + this.getTitle() + ".");
    contributors.add(contributor.getLongID());
    PlaylistManager.writePlaylistFile(this);
}
Also used : CommandPermissionException(com.discordbolt.api.command.exceptions.CommandPermissionException) CommandStateException(com.discordbolt.api.command.exceptions.CommandStateException)

Aggregations

CommandPermissionException (com.discordbolt.api.command.exceptions.CommandPermissionException)6 CommandStateException (com.discordbolt.api.command.exceptions.CommandStateException)6 BotCommand (com.discordbolt.api.command.BotCommand)1 TagData (com.discordbolt.boltbot.system.mysql.data.persistent.TagData)1