/** * The url of the old splash * * @return The url of the old splash, or null */ public String getOldSplashUrl() { return previous == null ? null : "https://cdn.discordapp.com/splashes/" + guild.getId() + "/" + previous + ".png"; }
/** * The url of the new icon * * @return The url of the new icon, or null */ public String getNewIconUrl() { return next == null ? null : "https://cdn.discordapp.com/icons/" + guild.getId() + "/" + next + ".png"; } }
/** * The url of the old icon * * @return The url of the old icon, or null */ public String getOldIconUrl() { return previous == null ? null : "https://cdn.discordapp.com/icons/" + guild.getId() + "/" + previous + ".png"; }
/** * The url of the new splash * * @return The url of the new splash, or null */ public String getNewSplashUrl() { return next == null ? null : "https://cdn.discordapp.com/splashes/" + guild.getId() + "/" + next + ".png"; } }
private void resume() { LOG.debug("Sending resume payload..."); JSONObject resumeObj = new JSONObject() .put("server_id", guild.getId()) .put("session_id", sessionId) .put("token", token); send(VoiceCode.RESUME, resumeObj); }
public MemberAction(JDA api, Guild guild, String userId, String accessToken) { super(api, Route.Guilds.ADD_MEMBER.compile(guild.getId(), userId)); this.accessToken = accessToken; this.userId = userId; this.guild = guild; }
private void identify() { JSONObject connectObj = new JSONObject() .put("server_id", guild.getId()) .put("user_id", getJDA().getSelfUser().getId()) .put("session_id", sessionId) .put("token", token); send(VoiceCode.IDENTIFY, connectObj); }
@Override public void onThreadCreated(WebSocket websocket, ThreadType threadType, Thread thread) { final String identifier = getJDA().getIdentifierString(); final String guildId = guild.getId(); switch (threadType) { case CONNECT_THREAD: thread.setName(identifier + " AudioWS-ConnectThread (guildId: " + guildId + ')'); break; case FINISH_THREAD: thread.setName(identifier + " AudioWS-FinishThread (guildId: " + guildId + ')'); break; case WRITING_THREAD: thread.setName(identifier + " AudioWS-WriteThread (guildId: " + guildId + ')'); break; case READING_THREAD: thread.setName(identifier + " AudioWS-ReadThread (guildId: " + guildId + ')'); break; default: thread.setName(identifier + " AudioWS-" + threadType + " (guildId: " + guildId + ')'); } }
/** * Gets the banner image for the specified guild of the specified type. * <br>This banner will only be available if the guild in question has the * Widget enabled. * * @param guild * The guild * @param type * The type (visual style) of the banner * * @return A String containing the URL of the banner image */ public static String getWidgetBanner(Guild guild, BannerType type) { Checks.notNull(guild, "Guild"); return getWidgetBanner(guild.getId(), type); }
/** * Gets the pre-made HTML Widget for the specified guild using the specified * settings. The widget will only display correctly if the guild in question * has the Widget enabled. * * @param guild * the guild * @param theme * the theme, light or dark * @param width * the width of the widget * @param height * the height of the widget * * @return a String containing the pre-made widget with the supplied settings */ public static String getPremadeWidgetHtml(Guild guild, WidgetTheme theme, int width, int height) { Checks.notNull(guild, "Guild"); return getPremadeWidgetHtml(guild.getId(), theme, width, height); }
@Override protected Route.CompiledRoute finalizeRoute() { Route.CompiledRoute route = super.finalizeRoute(); String limit, before, everyone, role; limit = String.valueOf(super.getLimit()); before = last != null ? last.getId() : null; everyone = String.valueOf(isEveryone); role = String.valueOf(isRole); route = route.withQueryParams("limit", limit, "roles", role, "everyone", everyone); if (guild != null) route = route.withQueryParams("guild_id", guild.getId()); if (before != null) route = route.withQueryParams("before", before); return route; }
@Override public String getJumpUrl() { return String.format("https://discordapp.com/channels/%s/%s/%s", getGuild() == null ? "@me" : getGuild().getId(), getChannel().getId(), getId()); }
public GuildManager(Guild guild) { super(guild.getJDA(), Route.Guilds.MODIFY_GUILD.compile(guild.getId())); this.guild = new UpstreamReference<>(guild); if (isPermissionChecksEnabled()) checkPermissions(); }
public AuditLogPaginationAction(Guild guild) { super(guild.getJDA(), Route.Guilds.GET_AUDIT_LOGS.compile(guild.getId()), 1, 100, 100); if (!guild.getSelfMember().hasPermission(Permission.VIEW_AUDIT_LOGS)) throw new InsufficientPermissionException(Permission.VIEW_AUDIT_LOGS); this.guild = guild; }
Route.CompiledRoute route = Route.Guilds.CREATE_CHANNEL.compile(getGuild().getId()); return new ChannelAction(route, name, getGuild(), ChannelType.CATEGORY);
Route.CompiledRoute route = Route.Roles.CREATE_ROLE.compile(getGuild().getId()); return new RoleAction(route, getGuild());
/** * Creates a new EmoteManager instance * * @param emote * The target {@link net.dv8tion.jda.core.entities.impl.EmoteImpl EmoteImpl} to modify * * @throws java.lang.IllegalStateException * If the specified Emote is {@link net.dv8tion.jda.core.entities.Emote#isFake() fake} or {@link net.dv8tion.jda.core.entities.Emote#isManaged() managed}. */ public EmoteManager(EmoteImpl emote) { super(emote.getJDA(), Route.Emotes.MODIFY_EMOTE.compile(notNullGuild(emote).getId(), emote.getId())); this.emote = emote; if (isPermissionChecksEnabled()) checkPermissions(); }
/** * Creates a new RoleManager instance * * @param role * {@link net.dv8tion.jda.core.entities.Role Role} that should be modified */ public RoleManager(Role role) { super(role.getJDA(), Route.Roles.MODIFY_ROLE.compile(role.getGuild().getId(), role.getId())); this.role = new UpstreamReference<>(role); if (isPermissionChecksEnabled()) checkPermissions(); }
public AudioConnection(AudioManagerImpl manager, String endpoint, String sessionId, String token) { VoiceChannel channel = manager.getQueuedAudioConnection(); this.channel = new UpstreamReference<>(channel); final JDAImpl api = (JDAImpl) channel.getJDA(); this.api = new UpstreamReference<>(api); this.threadIdentifier = api.getIdentifierString() + " AudioConnection Guild: " + channel.getGuild().getId(); this.webSocket = new AudioWebSocket(this, manager.getListenerProxy(), endpoint, channel.getGuild(), sessionId, token, manager.isAutoReconnect()); }
@Override public AuditableRestAction<Void> delete() { if (!getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) throw new InsufficientPermissionException(Permission.MANAGE_ROLES); if(!PermissionUtil.canInteract(getGuild().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(getGuild().getId(), getId()); return new AuditableRestAction<Void>(getJDA(), route) { @Override protected void handleResponse(Response response, Request<Void> request) { if (response.isOk()) request.onSuccess(null); else request.onFailure(response); } }; }