public static WebhookMessage files(Map<String, ?> attachments)
    {
        Checks.notNull(attachments, "Attachments");
        Set<? extends Map.Entry<String, ?>> entries = attachments.entrySet();
        Checks.notEmpty(entries, "Attachments");
        int fileAmount = attachments.size();
        Checks.check(fileAmount <= WebhookMessageBuilder.MAX_FILES, "Cannot add more than %d files to a message", WebhookMessageBuilder.MAX_FILES);
        MessageAttachment[] files = new MessageAttachment[fileAmount];
        int i = 0;
        for (Map.Entry<String, ?> attachment : entries)
        {
            String name = attachment.getKey();
            Checks.notEmpty(name, "Name");
            Object data = attachment.getValue();
            files[i++] = convertAttachment(name, data);
        }
        return new WebhookMessage(null, null, null, null, false, files);
    }
public static WebhookMessage files ( Map < String , ? > attachments ) { Checks . notNull ( attachments , "Attachments" ) ; Set < ? extends Map . Entry < String , ? > > entries = attachments . entrySet ( ) ; Checks . notEmpty ( entries , "Attachments" ) ; int fileAmount = attachments . size ( ) ; Checks . check ( fileAmount <= WebhookMessageBuilder . MAX_FILES , "Cannot add more than %d files to a message" , WebhookMessageBuilder . MAX_FILES ) ; MessageAttachment [ ] files = new MessageAttachment [ fileAmount ] ; int i = 0 ; for ( Map . Entry < String , ? > attachment : entries ) { String name = attachment . getKey ( ) ; Checks . notEmpty ( name , "Name" ) ; Object data = attachment . getValue ( ) ; files [ i ++ ] = convertAttachment ( name , data ) ; } return new WebhookMessage ( null , null , null , null , false , files ) ; }
Constructs a message around pairs of (Name, Data).
<br>You can add up to {@value WebhookMessageBuilder#MAX_FILES} attachments to one message.
<br>The supported data types are {@link InputStream}, {@link File}, and {@code byte[]}.

<h2>Example</h2>
<pre><code>
{@literal Map<String, Object>} map = {@literal new HashMap<>()};
map.put("dog", new File("dog.png"));
map.put("cat", new URL("https://random.cat/meow").openStream());
map.put("bird", new byte[100]);
WebhookMessage message = WebhookMessage.files(map);
</code></pre>

@param  attachments
Map containing pairs from file names to data streams

@throws IllegalArgumentException
If one of the provided files is not readable
or the provided map is null/empty

@return WebhookMessage for the provided files

@see    WebhookMessageBuilder#addFile(String, InputStream)
@see    WebhookMessageBuilder#addFile(String, byte[])
@see    WebhookMessageBuilder#addFile(String, File)
@see    WebhookMessageBuilder#addFile(File)