/** * The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} for this message * * @return The ChannelType */ public ChannelType getChannelType() { return channel.getType(); }
/** * Indicates whether the message is from the specified {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} * * @param type * The ChannelType * * @return True, if the message is from the specified channel type */ public boolean isFromType(ChannelType type) { return channel.getType() == type; }
/** * Whether the user started typing in a channel of the specified type. * * @param type * {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} * * @return True, if the user started typing in a channel of the specified type */ public boolean isFromType(ChannelType type) { return channel.getType() == type; }
@Override public ChannelType getChannelType() { return channel.getType(); }
/** * The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} * this Reaction was used in. * * @return The ChannelType */ public ChannelType getChannelType() { return channel.getType(); }
/** * The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} * * @return The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} */ public ChannelType getType() { return channel.getType(); }
/** * The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} of * the targeted {@link net.dv8tion.jda.core.entities.MessageChannel MessageChannel}. * * @return {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} */ public ChannelType getType() { return getChannel().getType(); }
private boolean hasPermission(Permission permission) { switch (channel.getType()) { case TEXT: return getMember().hasPermission(getTextChannel(), permission); default: return true; } }
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); }
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); } }
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 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; }
switch (channel.getType())
if (!user.equals(getJDA().getSelfUser())) if (channel.getType() == ChannelType.TEXT)
switch (channel.getType())
switch (channel.getType())
public static boolean hasPermission(MessageChannel channel, User user, Permission permission) { if (channel == null) { return false; } switch (channel.getType()) { case PRIVATE: return true; case TEXT: TextChannel textChannel = (TextChannel) channel; return PermissionUtil.checkPermission(textChannel, textChannel.getGuild().getMember(user), permission); default: return false; } }
public String formatGuild(MessageChannel channel, Object... vars) { if (channel.getType().equals(ChannelType.TEXT)) { return formatFull(((TextChannel) channel).getGuild().getIdLong(), false, vars); } return formatFull(0, false, vars); }
public void addReaction(Message message) { if (!(message.getChannel().getType() == ChannelType.TEXT && message.getGuild().getSelfMember() .hasPermission(message.getTextChannel(), Permission.MESSAGE_HISTORY))) { message.getChannel().sendMessage("I can't add buttons due to not having the `Message History` permission!").queue(); return; } this.message = message; if (unicode != null) message.addReaction(unicode).queue(); else { try { message.addReaction(Getters.getEmoteById(emoteId)).queue(); } catch (IllegalArgumentException ignored) {} } }