@Override public boolean isDeleted() { return getGuild().getChannelByID(id) != this; }
@Override public IChannel getChannel() { return getGuild().getChannelByID(channelID); }
@Override public IChannel getChannelByID(long id) { IChannel channel = guildCache.findResult((guildID, guild) -> guild.getChannelByID(id)); return channel == null ? privateChannels.get(id) : channel; }
/** * Converts a json {@link AuditLogObject} to a {@link AuditLog}. * * @param guild The guild the audit log belongs to. * @param json The json object representing the audit log. * @return The converted audit log object. */ public static AuditLog getAuditLogFromJSON(IGuild guild, AuditLogObject json) { LongMap<IUser> users = Arrays.stream(json.users) .map(u -> DiscordUtils.getUserFromJSON(guild.getShard(), u)) .collect(LongMapCollector.toLongMap()); LongMap<IWebhook> webhooks = Arrays.stream(json.webhooks) .map(w -> DiscordUtils.getWebhookFromJSON(guild.getChannelByID(Long.parseUnsignedLong(w.channel_id)), w)) .collect(LongMapCollector.toLongMap()); LongMap<AuditLogEntry> entries = Arrays.stream(json.audit_log_entries) .map(e -> DiscordUtils.getAuditLogEntryFromJSON(guild, users, webhooks, e)) .collect(LongMapCollector.toLongMap()); return new AuditLog(entries); }
IChannel chan = event.getGuild().getChannelByID(Long.parseLong(finder.getChan())); if (chan != null && chan.isDeleted()) { finder.removeToDatabase(); IChannel chan = event.getGuild().getChannelByID(finder.getChannelId()); if (chan != null && chan.isDeleted()) { finder.removeToDatabase(); IChannel chan = event.getGuild().getChannelByID(Long.parseLong(finder.getChan())); if (chan != null && chan.isDeleted()) { finder.removeToDatabase();
case CHANNEL_OVERWRITE_UPDATE: case CHANNEL_OVERWRITE_DELETE: IChannel channel = guild.getChannelByID(targetID); if (channel == null) channel = guild.getVoiceChannelByID(targetID);