use of io.discloader.discloader.core.entity.message.Message in project DiscLoader by R3alCl0ud.
the class FetchMessages method complete.
@Override
public void complete(String s, Throwable ex) {
if (ex != null) {
future.completeExceptionally(ex);
return;
} else {
MessageJSON[] data = DLUtil.gson.fromJson(s, MessageJSON[].class);
HashMap<Long, IMessage> messages = new HashMap<>();
for (MessageJSON m : data) {
IMessage message = new Message<>(channel, m);
channel.getMessages().put(message.getID(), message);
messages.put(message.getID(), message);
}
future.complete(messages);
}
}
use of io.discloader.discloader.core.entity.message.Message in project DiscLoader by R3alCl0ud.
the class PinnedMessages method complete.
@Override
public void complete(String s, Throwable ex) {
if (ex != null) {
future.completeExceptionally(ex);
return;
} else {
MessageJSON[] data = DLUtil.gson.fromJson(s, MessageJSON[].class);
HashMap<Long, IMessage> messages = new HashMap<>();
for (MessageJSON m : data) {
IMessage message = new Message<T>(channel, m);
channel.getMessages().put(message.getID(), message);
messages.put(message.getID(), message);
}
future.complete(messages);
}
}
use of io.discloader.discloader.core.entity.message.Message 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);
}
Aggregations