/** * The {@link net.dv8tion.jda.core.entities.SelfUser SelfUser} * * @return The {@link net.dv8tion.jda.core.entities.SelfUser SelfUser} */ public SelfUser getSelfUser() { return api.getSelfUser(); }
public String getIdentifierString() { if (shardInfo != null) return "JDA " + shardInfo.getShardString(); else return "JDA"; }
@Override public String toString() { return getName(); } }
@Override public boolean equals(Object o) { if (!(o instanceof ShardInfo)) return false; ShardInfo oInfo = (ShardInfo) o; return shardId == oInfo.getShardId() && shardTotal == oInfo.getShardTotal(); } }
public MessageBuilder(EmbedBuilder builder) { if (builder != null) this.embed = builder.build(); }
/** * Creates a JDABuilder with the predefined token. * * @param token * The bot token to use * * @see #setToken(String) */ public JDABuilder(String token) { this(); setToken(token); }
/** * Sets the Author of the embed. The author appears in the top left of the embed and can have a small * image beside it along with the author's name being made clickable by way of providing a url. * This convenience method just sets the name. * * <p><b><a href="http://i.imgur.com/JgZtxIM.png">Example</a></b> * * @param name * the name of the author of the embed. If this is not set, the author will not appear in the embed * * @return the builder after the author has been set */ public EmbedBuilder setAuthor(String name) { return setAuthor(name, null, null); }
/** * An unmodifiable list of all {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels} of all connected * {@link net.dv8tion.jda.core.entities.Guild Guilds}. * * @return Possible-empty list of all known {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels}. */ default List<VoiceChannel> getVoiceChannels() { return getVoiceChannelCache().asList(); }
/** * Creates a new PermissionException instance * * @param permission * The required {@link net.dv8tion.jda.core.Permission Permission} */ protected PermissionException(Permission permission) { this(permission, "Cannot perform action due to a lack of Permission. Missing permission: " + permission.toString()); }
/** * Creates a new Event from the given JDA instance * <br>Uses the current {@link net.dv8tion.jda.core.JDA#getResponseTotal()} as sequence * * @param api * Current JDA instance */ public Event(JDA api) { this(api, api.getResponseTotal()); }
public Requester(JDA api) { this(api, api.getAccountType()); }
public VoiceChannel getChannel(JDA api) { return api.getVoiceChannelById(channelId); }
/** * All {@link net.dv8tion.jda.core.entities.Role Roles} this JDA instance can see. <br>This will iterate over each * {@link net.dv8tion.jda.core.entities.Guild Guild} retrieved from {@link #getGuilds()} and collect its {@link * net.dv8tion.jda.core.entities.Guild#getRoles() Guild.getRoles()}. * * @return Immutable List of all visible Roles */ default List<Role> getRoles() { return getRoleCache().asList(); }
/** * Contains all {@code cf-ray} headers that JDA received in this session. * <br>These receive a new value whenever the WebSockedClient reconnects to the gateway. * * <p>This is useful to monitor cloudflare activity from the Discord Developer perspective. * <br>Use this list to report connection issues. * * @return Immutable list of all cf-ray values for this session */ public List<String> getCloudflareRays() { return api.getCloudflareRays(); }
/** * This method will block until JDA has reached the status {@link Status#CONNECTED}. * <br>This status means that JDA finished setting up its internal cache and is ready to be used. * * @throws InterruptedException * If this thread is interrupted while waiting * @throws IllegalStateException * If JDA is shutdown during this wait period * * @return The current JDA instance, for chaining convenience */ default JDA awaitReady() throws InterruptedException { return awaitStatus(Status.CONNECTED); }
/** * Creates a new {@link SplitPolicy} splitting on the specified chars. * * @param chars * the chars to split on * @param remove * weather to remove the chars when splitting on them * * @return a new {@link SplitPolicy} */ static SplitPolicy onChars(CharSequence chars, boolean remove) { return new CharSequenceSplitPolicy(chars, remove); }
/** * Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in * the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution * and should be handled carefully. <b>Only change this pool if you know what you're doing.</b> * <br><b>This automatically disables the automatic shutdown of the rate-limit pool, you can enable * it using {@link #setRateLimitPool(ScheduledExecutorService, boolean) setRateLimitPool(executor, true)}</b> * * @param pool * The thread-pool to use for rate-limit handling * * @return The JDABuilder instance. Useful for chaining. */ public JDABuilder setRateLimitPool(ScheduledExecutorService pool) { return setRateLimitPool(pool, pool == null); }
/** * Sets the {@link ScheduledExecutorService ScheduledExecutorService} used by * the main WebSocket connection for workers. These workers spend most of their lifetime * sleeping because they only activate for sending messages over the gateway. * <br><b>Only change this pool if you know what you're doing. * <br>This automatically disables the automatic shutdown of the main-ws pool, you can enable * it using {@link #setGatewayPool(ScheduledExecutorService, boolean) setGatewayPool(pool, true)}</b> * * @param pool * The thread-pool to use for WebSocket workers * * @return The JDABuilder instance. Useful for chaining. */ public JDABuilder setGatewayPool(ScheduledExecutorService pool) { return setGatewayPool(pool, pool == null); }
@Override public String toString() { return "Shard " + getShardString(); }
public InsufficientPermissionException(Permission permission) { super(permission, "Cannot perform action due to a lack of Permission. Missing permission: " + permission.toString()); }