Search in sources :

Example 21 with FileContainer

use of org.javacord.core.util.FileContainer in project Javacord by BtoBastian.

the class MessageBuilderBaseDelegateImpl method addAttachment.

@Override
public void addAttachment(BufferedImage image, String fileName) {
    if (image == null || fileName == null) {
        throw new IllegalArgumentException("image and fileName cannot be null!");
    }
    attachments.add(new FileContainer(image, fileName));
    attachmentsChanged = true;
}
Also used : FileContainer(org.javacord.core.util.FileContainer)

Example 22 with FileContainer

use of org.javacord.core.util.FileContainer in project Javacord by BtoBastian.

the class MessageBuilderBaseDelegateImpl method addAttachment.

@Override
public void addAttachment(Icon icon) {
    if (icon == null) {
        throw new IllegalArgumentException("icon cannot be null!");
    }
    attachments.add(new FileContainer(icon));
    attachmentsChanged = true;
}
Also used : FileContainer(org.javacord.core.util.FileContainer)

Example 23 with FileContainer

use of org.javacord.core.util.FileContainer in project Javacord by BtoBastian.

the class MessageBuilderBaseDelegateImpl method addAttachment.

@Override
public void addAttachment(InputStream stream, String fileName) {
    if (stream == null || fileName == null) {
        throw new IllegalArgumentException("stream and fileName cannot be null!");
    }
    attachments.add(new FileContainer(stream, fileName));
    attachmentsChanged = true;
}
Also used : FileContainer(org.javacord.core.util.FileContainer)

Example 24 with FileContainer

use of org.javacord.core.util.FileContainer in project Javacord by BtoBastian.

the class EmbedBuilderDelegateImpl method setImage.

@Override
public void setImage(InputStream image, String fileType) {
    imageUrl = null;
    if (image == null) {
        imageContainer = null;
    } else {
        imageContainer = new FileContainer(image, fileType);
        imageContainer.setFileTypeOrName(UUID.randomUUID().toString() + "." + fileType);
    }
}
Also used : FileContainer(org.javacord.core.util.FileContainer)

Example 25 with FileContainer

use of org.javacord.core.util.FileContainer in project Javacord by BtoBastian.

the class EmbedBuilderDelegateImpl method setAuthor.

@Override
public void setAuthor(String name, String url, InputStream icon, String fileType) {
    authorName = name;
    authorUrl = url;
    authorIconUrl = null;
    if (icon == null) {
        authorIconContainer = null;
    } else {
        authorIconContainer = new FileContainer(icon, fileType);
        authorIconContainer.setFileTypeOrName(UUID.randomUUID().toString() + "." + fileType);
    }
}
Also used : FileContainer(org.javacord.core.util.FileContainer)

Aggregations

FileContainer (org.javacord.core.util.FileContainer)29 RestRequest (org.javacord.core.util.rest.RestRequest)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 ArrayList (java.util.ArrayList)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 Message (org.javacord.api.entity.message.Message)3 EmbedBuilder (org.javacord.api.entity.message.embed.EmbedBuilder)3 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)2 List (java.util.List)2 MultipartBody (okhttp3.MultipartBody)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1