use of io.discloader.discloader.network.json.MessageJSON in project DiscLoader by R3alCl0ud.
the class TextChannel method sendMessage.
@Override
public CompletableFuture<IMessage> sendMessage(String content, RichEmbed embed, File file, boolean tts) {
Attachment attachment = file == null ? null : new Attachment(file.getName());
SendableMessage sendable = new SendableMessage(content, tts, embed, attachment, file);
CompletableFuture<IMessage> future = new CompletableFuture<>();
CompletableFuture<MessageJSON> mcf = loader.rest.request(Methods.POST, Endpoints.messages(getID()), new RESTOptions(sendable), MessageJSON.class);
mcf.thenAcceptAsync(e -> {
future.complete(new Message<>(this, e));
});
mcf.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
return future;
}
use of io.discloader.discloader.network.json.MessageJSON in project DiscLoader by R3alCl0ud.
the class TextChannel method sendMessage.
@Override
public CompletableFuture<IMessage> sendMessage(String content, RichEmbed embed, Resource resource, boolean tts) {
Attachment attachment = resource == null ? null : new Attachment(resource.getFileName());
SendableMessage sendable = new SendableMessage(content, tts, embed, attachment, resource);
CompletableFuture<IMessage> future = new CompletableFuture<>();
CompletableFuture<MessageJSON> mcf = loader.rest.request(Methods.POST, Endpoints.messages(getID()), new RESTOptions(sendable), MessageJSON.class);
mcf.thenAcceptAsync(e -> {
future.complete(new Message<>(this, e));
});
mcf.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
return future;
}
use of io.discloader.discloader.network.json.MessageJSON in project DiscLoader by R3alCl0ud.
the class GroupChannel method sendMessage.
@Override
public CompletableFuture<IMessage> sendMessage(String content, RichEmbed embed, Attachment attachment, boolean tts) {
CompletableFuture<IMessage> future = new CompletableFuture<>();
File file = attachment == null ? null : new File(attachment.filename);
SendableMessage sendable = new SendableMessage(content, tts, embed, attachment, file);
CompletableFuture<MessageJSON> mcf = loader.rest.request(Methods.POST, Endpoints.messages(getID()), new RESTOptions(sendable), MessageJSON.class);
mcf.thenAcceptAsync(e -> {
future.complete(new Message<>(this, e));
});
mcf.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
return future;
}
use of io.discloader.discloader.network.json.MessageJSON in project DiscLoader by R3alCl0ud.
the class GroupChannel method sendMessage.
@Override
public CompletableFuture<IMessage> sendMessage(String content, RichEmbed embed, Resource resource, boolean tts) {
Attachment attachment = resource == null ? null : new Attachment(resource.getFileName());
SendableMessage sendable = new SendableMessage(content, tts, embed, attachment, resource);
CompletableFuture<IMessage> future = new CompletableFuture<>();
CompletableFuture<MessageJSON> mcf = loader.rest.request(Methods.POST, Endpoints.messages(getID()), new RESTOptions(sendable), MessageJSON.class);
mcf.thenAcceptAsync(e -> {
future.complete(new Message<>(this, e));
});
mcf.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
return future;
}
use of io.discloader.discloader.network.json.MessageJSON in project DiscLoader by R3alCl0ud.
the class GroupChannel method sendMessage.
@Override
public CompletableFuture<IMessage> sendMessage(String content, RichEmbed embed, File file, boolean tts) {
Attachment attachment = file == null ? null : new Attachment(file.getName());
SendableMessage sendable = new SendableMessage(content, tts, embed, attachment, file);
CompletableFuture<IMessage> future = new CompletableFuture<>();
CompletableFuture<MessageJSON> mcf = loader.rest.request(Methods.POST, Endpoints.messages(getID()), new RESTOptions(sendable), MessageJSON.class);
mcf.thenAcceptAsync(e -> {
future.complete(new Message<>(this, e));
});
mcf.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
return future;
}
Aggregations