use of net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent in project JDA by DV8FromTheWorld.
the class InteractionCreateHandler method handleInternally.
@Override
protected Long handleInternally(DataObject content) {
int type = content.getInt("type");
if (content.getInt("version", 1) != 1) {
WebSocketClient.LOG.debug("Received interaction with version {}. This version is currently unsupported by this version of JDA. Consider updating!", content.getInt("version", 1));
return null;
}
long guildId = content.getUnsignedLong("guild_id", 0);
if (api.getGuildSetupController().isLocked(guildId))
return guildId;
if (guildId != 0 && api.getGuildById(guildId) == null)
// discard event if it is not from a guild we are currently in
return null;
switch(InteractionType.fromKey(type)) {
case // slash commands
COMMAND:
handleCommand(content);
break;
case // buttons/components
COMPONENT:
handleAction(content);
break;
case COMMAND_AUTOCOMPLETE:
api.handleEvent(new CommandAutoCompleteInteractionEvent(api, responseNumber, new CommandAutoCompleteInteractionImpl(api, content)));
break;
default:
api.handleEvent(new GenericInteractionCreateEvent(api, responseNumber, new InteractionImpl(api, content)));
}
return null;
}
Aggregations