protected boolean hasPermission(Permission perm) { if (channel.getType() != ChannelType.TEXT) return true; TextChannel text = (TextChannel) channel; Member self = text.getGuild().getSelfMember(); return self.hasPermission(text, perm); }
/** * The {@link net.dv8tion.jda.core.entities.Guild Guild} this Reaction was used in, * this might return {@code null} when this Reaction was not used in a MessageChannel * from the ChannelType {@link net.dv8tion.jda.core.entities.ChannelType#TEXT TEXT}! * * @return {@link net.dv8tion.jda.core.entities.Guild Guild} this Reaction was used in, or {@code null} */ public Guild getGuild() { TextChannel channel = getTextChannel(); return channel != null ? channel.getGuild() : null; }
public MessagePaginationAction(MessageChannel channel) { super(channel.getJDA(), Route.Messages.GET_MESSAGE_HISTORY.compile(channel.getId()), 1, 100, 100); if (channel.getType() == ChannelType.TEXT) { TextChannel textChannel = (TextChannel) channel; if (!textChannel.getGuild().getSelfMember().hasPermission(textChannel, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(Permission.MESSAGE_HISTORY); } this.channel = channel; }
public PermOverrideData(PermissionOverride override) { if (override.isMemberOverride()) { this.id = override.getMember().getUser().getIdLong(); this.type = MEMBER_TYPE; } else { this.id = override.getRole().getIdLong(); this.type = ROLE_TYPE; } this.allow = override.getAllowedRaw(); this.deny = override.getDeniedRaw(); }
private void checkPermission(Permission permission) { if (channel.getType() == ChannelType.TEXT) { Channel location = (Channel) channel; if (!location.getGuild().getSelfMember().hasPermission(location, permission)) throw new InsufficientPermissionException(permission); } }
public GuildVoiceMoveEvent(JDA api, long responseNumber, Member member, VoiceChannel channelLeft) { super(api, responseNumber, member, channelLeft); this.channelJoined = member.getVoiceState().getChannel(); }
public GuildVoiceDeafenEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.deafened = member.getVoiceState().isDeafened(); }
public GuildVoiceMuteEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.muted = member.getVoiceState().isMuted(); }
public GuildVoiceSelfMuteEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.selfMuted = member.getVoiceState().isSelfMuted(); }
public GuildVoiceGuildDeafenEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.guildDeafened = member.getVoiceState().isGuildDeafened(); }
public GuildVoiceGuildMuteEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.guildMuted = member.getVoiceState().isGuildMuted(); }
public GuildVoiceSuppressEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.suppressed = member.getVoiceState().isSuppressed(); }
public GuildVoiceSelfDeafenEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.selfDeafened = member.getVoiceState().isSelfDeafened(); }
public MessageReaction.ReactionEmote getReactionEmote() { return reaction.getReactionEmote(); } }
public GenericGroupMessageReactionEvent(JDA api, long responseNumber, User user, MessageReaction reaction) { super(api, responseNumber, reaction.getMessageIdLong(), (Group) reaction.getChannel()); this.issuer = user; this.reaction = reaction; }
private static void checkArguments(MessageChannel channel, String messageId) { Checks.isSnowflake(messageId, "Message ID"); Checks.notNull(channel, "Channel"); if (channel.getType() == ChannelType.TEXT) { TextChannel t = (TextChannel) channel; if (!t.getGuild().getSelfMember().hasPermission(t, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(Permission.MESSAGE_HISTORY); } }
public GuildVoiceJoinEvent(JDA api, long responseNumber, Member member) { super(api, responseNumber, member); this.channelJoined = member.getVoiceState().getChannel(); }