Search in sources :

Example 1 with WebhooksUpdateEventImpl

use of org.javacord.core.event.channel.server.text.WebhooksUpdateEventImpl in project Javacord by BtoBastian.

the class WebhooksUpdateHandler method handle.

@Override
public void handle(JsonNode packet) {
    long channelId = packet.get("channel_id").asLong();
    Optional<ServerTextChannel> optionalChannel = api.getServerTextChannelById(channelId);
    if (optionalChannel.isPresent()) {
        ServerTextChannel channel = optionalChannel.get();
        WebhooksUpdateEvent event = new WebhooksUpdateEventImpl(channel);
        api.getEventDispatcher().dispatchWebhooksUpdateEvent((DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event);
    } else {
        LoggerUtil.logMissingChannel(logger, channelId);
    }
}
Also used : ServerTextChannel(org.javacord.api.entity.channel.ServerTextChannel) WebhooksUpdateEvent(org.javacord.api.event.channel.server.text.WebhooksUpdateEvent) WebhooksUpdateEventImpl(org.javacord.core.event.channel.server.text.WebhooksUpdateEventImpl)

Aggregations

ServerTextChannel (org.javacord.api.entity.channel.ServerTextChannel)1 WebhooksUpdateEvent (org.javacord.api.event.channel.server.text.WebhooksUpdateEvent)1 WebhooksUpdateEventImpl (org.javacord.core.event.channel.server.text.WebhooksUpdateEventImpl)1