use of net.dv8tion.jda.internal.entities.StageChannelImpl in project JDA by DV8FromTheWorld.
the class StageInstanceDeleteHandler method handleInternally.
@Override
protected Long handleInternally(DataObject content) {
long guildId = content.getUnsignedLong("guild_id", 0L);
if (getJDA().getGuildSetupController().isLocked(guildId))
return guildId;
GuildImpl guild = (GuildImpl) getJDA().getGuildById(guildId);
if (guild == null) {
EventCache.LOG.debug("Caching STAGE_INSTANCE_DELETE for uncached guild with id {}", guildId);
getJDA().getEventCache().cache(EventCache.Type.GUILD, guildId, responseNumber, allContent, this::handle);
return null;
}
long channelId = content.getUnsignedLong("channel_id", 0L);
StageChannelImpl channel = (StageChannelImpl) guild.getStageChannelById(channelId);
if (channel == null)
return null;
StageInstance instance = channel.getStageInstance();
channel.setStageInstance(null);
if (instance != null)
getJDA().handleEvent(new StageInstanceDeleteEvent(getJDA(), responseNumber, instance));
return null;
}
Aggregations