Java Code Examples for net.dv8tion.jda.internal.utils.PermissionUtil#canInteract()
The following examples show how to use
net.dv8tion.jda.internal.utils.PermissionUtil#canInteract() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoleImpl.java From JDA with Apache License 2.0 | 5 votes |
@Nonnull @Override public AuditableRestAction<Void> delete() { Guild guild = getGuild(); if (!guild.getSelfMember().hasPermission(Permission.MANAGE_ROLES)) throw new InsufficientPermissionException(guild, Permission.MANAGE_ROLES); if(!PermissionUtil.canInteract(guild.getSelfMember(), this)) throw new HierarchyException("Can't delete role >= highest self-role"); if (managed) throw new UnsupportedOperationException("Cannot delete a Role that is managed. "); Route.CompiledRoute route = Route.Roles.DELETE_ROLE.compile(guild.getId(), getId()); return new AuditableRestActionImpl<>(getJDA(), route); }
Example 2
Source File: MemberImpl.java From JDA with Apache License 2.0 | 4 votes |
@Override public boolean canInteract(@Nonnull Member member) { return PermissionUtil.canInteract(this, member); }
Example 3
Source File: MemberImpl.java From JDA with Apache License 2.0 | 4 votes |
@Override public boolean canInteract(@Nonnull Role role) { return PermissionUtil.canInteract(this, role); }
Example 4
Source File: MemberImpl.java From JDA with Apache License 2.0 | 4 votes |
@Override public boolean canInteract(@Nonnull Emote emote) { return PermissionUtil.canInteract(this, emote); }
Example 5
Source File: RoleImpl.java From JDA with Apache License 2.0 | 4 votes |
@Override public boolean canInteract(@Nonnull Role role) { return PermissionUtil.canInteract(this, role); }
Example 6
Source File: Emote.java From JDA with Apache License 2.0 | 2 votes |
/** * Whether the specified Member can interact with this Emote * * @param issuer * The User to test * * @return True, if the provided Member can use this Emote */ default boolean canInteract(Member issuer) { return PermissionUtil.canInteract(issuer, this); }
Example 7
Source File: Emote.java From JDA with Apache License 2.0 | 2 votes |
/** * Whether the specified User can interact with this Emote within the provided MessageChannel * <br>Same logic as {@link #canInteract(User, MessageChannel, boolean) canInteract(issuer, channel, true)}! * * @param issuer * The User to test * @param channel * The MessageChannel to test * * @return True, if the provided Member can use this Emote */ default boolean canInteract(User issuer, MessageChannel channel) { return PermissionUtil.canInteract(issuer, this, channel); }
Example 8
Source File: Emote.java From JDA with Apache License 2.0 | 2 votes |
/** * Whether the specified User can interact with this Emote within the provided MessageChannel * <br>Special override to exclude elevated bot permissions in case of (for instance) reacting to messages. * * @param issuer * The User to test * @param channel * The MessageChannel to test * @param botOverride * Whether bots can use non-managed emotes in other guilds * * @return True, if the provided Member can use this Emote */ default boolean canInteract(User issuer, MessageChannel channel, boolean botOverride) { return PermissionUtil.canInteract(issuer, this, channel, botOverride); }