@Override public MessageAction sendFile(InputStream data, String fileName, Message message) { checkVerification(); checkPermission(Permission.MESSAGE_READ); checkPermission(Permission.MESSAGE_WRITE); checkPermission(Permission.MESSAGE_ATTACH_FILES); //Call MessageChannel's default method return TextChannel.super.sendFile(data, fileName, message); }
InputStream stream = new URL(interactionImages.get(imageIndex)).openStream(); context.getChannel().sendFile(stream, getClass().getSimpleName() + "-" + imageIndex + ".gif", messageBuilder.build()).queue(); } catch (IOException e) { e.printStackTrace();
@Override public boolean onCommand(CommandMessage context, String[] args) { RequestFactory.makeGET("https://i.imgur.com/ZupgGkI.jpg") .send((Consumer<Response>) response -> { ResponseBody body = response.getResponse().body(); if (body == null) { return; } context.getChannel().sendFile(body.byteStream(), "just-monika.jpg", new MessageBuilder().setEmbed( new EmbedBuilder() .setImage("attachment://just-monika.jpg") .setDescription("Just Monika") .setFooter("Just Monika", null) .build() ).build() ).queue(); }); return true; } }