Search in sources :

Example 1 with BotMillIllegalAttachmentException

use of co.aurasphere.botmill.core.internal.exception.BotMillIllegalAttachmentException in project fb-botmill by BotMill.

the class AttachmentAutoReply method createResponse.

/**
	 * {@inheritDoc} Replies with an attachment.
	 */
@Override
public FbBotMillResponse createResponse(MessageEnvelope envelope) {
    FbBotMillResponse response = null;
    switch(attachmentType) {
        case FILE:
            response = ReplyFactory.addFileAttachment(url).build(envelope);
            break;
        case IMAGE:
            response = ReplyFactory.addImageAttachment(url).build(envelope);
            break;
        case AUDIO:
            response = ReplyFactory.addAudioAttachment(url).build(envelope);
            break;
        case VIDEO:
            response = ReplyFactory.addVideoAttachment(url).build(envelope);
            break;
        default:
            String message = "Illegal attachment of type [ " + attachmentType.name() + " ] for AttachmentAutoReply";
            logger.error(message);
            throw new BotMillIllegalAttachmentException(message);
    }
    return response;
}
Also used : FbBotMillResponse(co.aurasphere.botmill.fb.model.outcoming.FbBotMillResponse) BotMillIllegalAttachmentException(co.aurasphere.botmill.core.internal.exception.BotMillIllegalAttachmentException)

Aggregations

BotMillIllegalAttachmentException (co.aurasphere.botmill.core.internal.exception.BotMillIllegalAttachmentException)1 FbBotMillResponse (co.aurasphere.botmill.fb.model.outcoming.FbBotMillResponse)1