use of net.dv8tion.jda.api.events.guild.invite.GuildInviteDeleteEvent in project JDA by DV8FromTheWorld.
the class InviteDeleteHandler method handleInternally.
@Override
protected Long handleInternally(DataObject content) {
long guildId = content.getUnsignedLong("guild_id");
if (getJDA().getGuildSetupController().isLocked(guildId))
return guildId;
Guild guild = getJDA().getGuildById(guildId);
if (guild == null) {
EventCache.LOG.debug("Caching INVITE_DELETE for unknown guild {}", guildId);
getJDA().getEventCache().cache(EventCache.Type.GUILD, guildId, responseNumber, allContent, this::handle);
return null;
}
long channelId = content.getUnsignedLong("channel_id");
GuildChannel channel = guild.getGuildChannelById(channelId);
if (channel == null) {
EventCache.LOG.debug("Caching INVITE_DELETE for unknown channel {} in guild {}", channelId, guildId);
getJDA().getEventCache().cache(EventCache.Type.CHANNEL, channelId, responseNumber, allContent, this::handle);
return null;
}
String code = content.getString("code");
getJDA().handleEvent(new GuildInviteDeleteEvent(getJDA(), responseNumber, code, channel));
return null;
}
Aggregations