Class PermissionErrorHandler
java.lang.Object
de.chojo.jdautil.util.PermissionErrorHandler
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanassertAndHandle(GuildMessageChannel channel, ILocalizer localizer, List<Long> ignoredGuilds, Permission... permissions) Checks if the self user has the permissions in this channel and sends an permission error if one is missing.static voidassertPermissions(GuildMessageChannel channel, Permission... permissions) Assert that the user has permissions.static voidassertPermissions(Guild guild, Permission... permissions) static voidhandle(InsufficientPermissionException permissionException, GuildMessageChannel channel, ILocalizer localizer, List<Long> ignoredGuilds) static voidhandle(InsufficientPermissionException permissionException, Guild guild, ILocalizer localizer, List<Long> ignoredGuilds) static voidhandle(InsufficientPermissionException permissionException, ShardManager shardManager, ILocalizer localizer, List<Long> ignoredGuilds) static voidsendPermissionError(GuildMessageChannel channel, Permission permission, ILocalizer localizer, List<Long> ignoredGuilds)
-
Method Details
-
handle
public static void handle(InsufficientPermissionException permissionException, ShardManager shardManager, ILocalizer localizer, List<Long> ignoredGuilds) -
handle
public static void handle(InsufficientPermissionException permissionException, Guild guild, ILocalizer localizer, List<Long> ignoredGuilds) -
handle
public static void handle(InsufficientPermissionException permissionException, GuildMessageChannel channel, ILocalizer localizer, List<Long> ignoredGuilds) -
sendPermissionError
public static void sendPermissionError(GuildMessageChannel channel, Permission permission, ILocalizer localizer, List<Long> ignoredGuilds) -
assertPermissions
public static void assertPermissions(GuildMessageChannel channel, Permission... permissions) throws InsufficientPermissionException Assert that the user has permissions.- Parameters:
channel- channel to checkpermissions- permissions to check- Throws:
InsufficientPermissionException- when the bot user doesn't have a permission
-
assertPermissions
public static void assertPermissions(Guild guild, Permission... permissions) throws InsufficientPermissionException - Throws:
InsufficientPermissionException
-
assertAndHandle
public static boolean assertAndHandle(GuildMessageChannel channel, ILocalizer localizer, List<Long> ignoredGuilds, Permission... permissions) Checks if the self user has the permissions in this channel and sends an permission error if one is missing.- Parameters:
channel- channel to checklocalizer- localizerignoredGuilds- guild where no error handling should be done.permissions- permissions to check- Returns:
- true if a permission was missing and a message was send
-