Search in sources :

Example 21 with MessageJSON

use of io.discloader.discloader.network.json.MessageJSON in project DiscLoader by R3alCl0ud.

the class FetchMessage method complete.

@Override
public void complete(String s, Throwable ex) {
    if (ex != null) {
        future.completeExceptionally(ex);
        return;
    }
    MessageJSON data = DLUtil.gson.fromJson(s, MessageJSON.class);
    IMessage message = new Message<>(channel, data);
    channel.getMessages().put(message.getID(), message);
    future.complete(message);
}
Also used : IMessage(io.discloader.discloader.entity.message.IMessage) Message(io.discloader.discloader.core.entity.message.Message) MessageJSON(io.discloader.discloader.network.json.MessageJSON) IMessage(io.discloader.discloader.entity.message.IMessage)

Aggregations

IMessage (io.discloader.discloader.entity.message.IMessage)21 MessageJSON (io.discloader.discloader.network.json.MessageJSON)21 SendableMessage (io.discloader.discloader.entity.sendable.SendableMessage)15 RESTOptions (io.discloader.discloader.network.rest.RESTOptions)15 CompletableFuture (java.util.concurrent.CompletableFuture)15 Attachment (io.discloader.discloader.entity.sendable.Attachment)9 File (java.io.File)7 Message (io.discloader.discloader.core.entity.message.Message)3 ITextChannel (io.discloader.discloader.entity.channel.ITextChannel)3 HashMap (java.util.HashMap)2 GroupMessageCreateEvent (io.discloader.discloader.common.event.message.GroupMessageCreateEvent)1 GroupMessageDeleteEvent (io.discloader.discloader.common.event.message.GroupMessageDeleteEvent)1 GroupMessageUpdateEvent (io.discloader.discloader.common.event.message.GroupMessageUpdateEvent)1 GuildMessageCreateEvent (io.discloader.discloader.common.event.message.GuildMessageCreateEvent)1 GuildMessageDeleteEvent (io.discloader.discloader.common.event.message.GuildMessageDeleteEvent)1 GuildMessageUpdateEvent (io.discloader.discloader.common.event.message.GuildMessageUpdateEvent)1 MessageCreateEvent (io.discloader.discloader.common.event.message.MessageCreateEvent)1 MessageDeleteEvent (io.discloader.discloader.common.event.message.MessageDeleteEvent)1 MessageUpdateEvent (io.discloader.discloader.common.event.message.MessageUpdateEvent)1 PrivateMessageCreateEvent (io.discloader.discloader.common.event.message.PrivateMessageCreateEvent)1