Search in sources :

Example 1 with ThreadCreateEventImpl

use of org.javacord.core.event.channel.thread.ThreadCreateEventImpl in project Javacord by BtoBastian.

the class ThreadCreateHandler method handleThread.

/**
 * Handles the creation of a thread.
 *
 * @param channel The channel data from which to build the thread.
 */
private void handleThread(final JsonNode channel) {
    final long serverId = channel.get("guild_id").asLong();
    api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
        final ServerThreadChannel serverThreadChannel = ((ServerImpl) server).getOrCreateServerThreadChannel(channel);
        final ThreadCreateEvent event = new ThreadCreateEventImpl(serverThreadChannel);
        api.getEventDispatcher().dispatchThreadCreateEvent((DispatchQueueSelector) server, serverThreadChannel, event);
    });
}
Also used : ServerImpl(org.javacord.core.entity.server.ServerImpl) ServerThreadChannel(org.javacord.api.entity.channel.ServerThreadChannel) ThreadCreateEventImpl(org.javacord.core.event.channel.thread.ThreadCreateEventImpl) ThreadCreateEvent(org.javacord.api.event.channel.thread.ThreadCreateEvent)

Aggregations

ServerThreadChannel (org.javacord.api.entity.channel.ServerThreadChannel)1 ThreadCreateEvent (org.javacord.api.event.channel.thread.ThreadCreateEvent)1 ServerImpl (org.javacord.core.entity.server.ServerImpl)1 ThreadCreateEventImpl (org.javacord.core.event.channel.thread.ThreadCreateEventImpl)1