Search in sources :

Example 1 with ServerChannelInviteDeleteEvent

use of org.javacord.api.event.channel.server.invite.ServerChannelInviteDeleteEvent in project Javacord by BtoBastian.

the class InviteDeleteHandler method handle.

@Override
protected void handle(JsonNode packet) {
    String code = packet.get("code").asText();
    Channel channel = api.getChannelById(packet.get("channel_id").asLong()).orElseThrow(AssertionError::new);
    channel.asServerChannel().ifPresent(serverChannel -> {
        Server server = serverChannel.getServer();
        ServerChannelInviteDeleteEvent event = new ServerChannelInviteDeleteEventImpl(code, serverChannel);
        api.getEventDispatcher().dispatchServerChannelInviteDeleteEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : Server(org.javacord.api.entity.server.Server) ServerChannelInviteDeleteEventImpl(org.javacord.core.event.channel.server.invite.ServerChannelInviteDeleteEventImpl) Channel(org.javacord.api.entity.channel.Channel) ServerChannelInviteDeleteEvent(org.javacord.api.event.channel.server.invite.ServerChannelInviteDeleteEvent)

Aggregations

Channel (org.javacord.api.entity.channel.Channel)1 Server (org.javacord.api.entity.server.Server)1 ServerChannelInviteDeleteEvent (org.javacord.api.event.channel.server.invite.ServerChannelInviteDeleteEvent)1 ServerChannelInviteDeleteEventImpl (org.javacord.core.event.channel.server.invite.ServerChannelInviteDeleteEventImpl)1