Search in sources :

Example 1 with ServerChannelInviteCreateEvent

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

the class InviteCreateHandler method handle.

@Override
protected void handle(JsonNode packet) {
    InviteImpl invite = new InviteImpl(api, packet);
    invite.getServer().ifPresent(server -> {
        // An error here means a missing channel for the invite, which should have already thrown an error
        ServerChannel channel = invite.getChannel().orElseThrow(AssertionError::new);
        ServerChannelInviteCreateEvent event = new ServerChannelInviteCreateEventImpl(invite, channel);
        api.getEventDispatcher().dispatchServerChannelInviteCreateEvent((DispatchQueueSelector) server, server, event);
    });
}
Also used : ServerChannelInviteCreateEvent(org.javacord.api.event.channel.server.invite.ServerChannelInviteCreateEvent) ServerChannelInviteCreateEventImpl(org.javacord.core.event.channel.server.invite.ServerChannelInviteCreateEventImpl) ServerChannel(org.javacord.api.entity.channel.ServerChannel) InviteImpl(org.javacord.core.entity.server.invite.InviteImpl)

Aggregations

ServerChannel (org.javacord.api.entity.channel.ServerChannel)1 ServerChannelInviteCreateEvent (org.javacord.api.event.channel.server.invite.ServerChannelInviteCreateEvent)1 InviteImpl (org.javacord.core.entity.server.invite.InviteImpl)1 ServerChannelInviteCreateEventImpl (org.javacord.core.event.channel.server.invite.ServerChannelInviteCreateEventImpl)1