Search in sources :

Example 1 with ThreadRevealedEvent

use of net.dv8tion.jda.api.events.thread.ThreadRevealedEvent in project JDA by DV8FromTheWorld.

the class ThreadListSyncHandler method handleInternally.

@Override
protected Long handleInternally(DataObject content) {
    long guildId = content.getLong("guild_id");
    if (api.getGuildSetupController().isLocked(guildId))
        return guildId;
    EntityBuilder entityBuilder = api.getEntityBuilder();
    DataArray threadsArrayJson = content.getArray("threads");
    for (int i = 0; i < threadsArrayJson.length(); i++) {
        DataObject threadJson = threadsArrayJson.getObject(i);
        ThreadChannel thread = entityBuilder.createThreadChannel(threadJson, guildId);
        api.handleEvent(new ThreadRevealedEvent(api, responseNumber, thread));
    }
    return null;
}
Also used : DataObject(net.dv8tion.jda.api.utils.data.DataObject) ThreadRevealedEvent(net.dv8tion.jda.api.events.thread.ThreadRevealedEvent) EntityBuilder(net.dv8tion.jda.internal.entities.EntityBuilder) ThreadChannel(net.dv8tion.jda.api.entities.ThreadChannel) DataArray(net.dv8tion.jda.api.utils.data.DataArray)

Aggregations

ThreadChannel (net.dv8tion.jda.api.entities.ThreadChannel)1 ThreadRevealedEvent (net.dv8tion.jda.api.events.thread.ThreadRevealedEvent)1 DataArray (net.dv8tion.jda.api.utils.data.DataArray)1 DataObject (net.dv8tion.jda.api.utils.data.DataObject)1 EntityBuilder (net.dv8tion.jda.internal.entities.EntityBuilder)1