Search in sources :

Example 1 with UnavailableGuildJoinedEvent

use of net.dv8tion.jda.api.events.guild.UnavailableGuildJoinedEvent in project JDA by DV8FromTheWorld.

the class GuildSetupNode method handleCreate.

void handleCreate(DataObject obj) {
    if (partialGuild == null) {
        partialGuild = obj;
    } else {
        for (String key : obj.keys()) {
            partialGuild.put(key, obj.opt(key).orElse(null));
        }
    }
    boolean unavailable = partialGuild.getBoolean("unavailable");
    boolean wasMarkedUnavailable = this.markedUnavailable;
    this.markedUnavailable = unavailable;
    if (unavailable) {
        if (!firedUnavailableJoin && isJoin()) {
            firedUnavailableJoin = true;
            JDAImpl api = getController().getJDA();
            api.handleEvent(new UnavailableGuildJoinedEvent(api, api.getResponseTotal(), id));
        }
        return;
    }
    ensureMembers();
}
Also used : UnavailableGuildJoinedEvent(net.dv8tion.jda.api.events.guild.UnavailableGuildJoinedEvent) JDAImpl(net.dv8tion.jda.internal.JDAImpl)

Aggregations

UnavailableGuildJoinedEvent (net.dv8tion.jda.api.events.guild.UnavailableGuildJoinedEvent)1 JDAImpl (net.dv8tion.jda.internal.JDAImpl)1