use of io.discloader.discloader.client.command.Command in project DiscLoader by R3alCl0ud.
the class Main method main.
public static void main(String... args) throws IOException {
System.setProperty("http.agent", "DiscLoader");
String content = "";
if (new File("options.json").exists()) {
Object[] lines = Files.readAllLines(Paths.get("./options.json")).toArray();
for (Object line : lines) content += line;
Options options = gson.fromJson(content, Options.class);
token = options.auth.token;
}
boolean myBool = false;
if (myBool && args.length > 1)
System.out.println("hello");
else
System.out.println("fuck");
DLOptions options = parseArgs(args);
if (options.shards > 1) {
ShardManager manager = new ShardManager(options);
manager.addShardingListener(new ShardingListenerAdapter() {
@Override
public void onShardLaunched(ShardLaunchedEvent e) {
LOGGER.info(String.format("Shard #%d: Launched", e.getShard().getShardID()));
e.getShard().getLoader().addEventListener(new EventListenerAdapter() {
public void Ready(ReadyEvent e) {
for (Command command : CommandRegistry.commands.entries()) {
LOGGER.info(command.getUnlocalizedName());
}
}
@Override
public void RawPacket(RawEvent data) {
WebSocketFrame frame = data.getFrame();
if (data.isGateway() && frame.isTextFrame() && !frame.getPayloadText().contains("PRESENCE_UPDATE")) {
// LOGGER.fine(frame.getPayloadText());
} else if (data.isREST()) {
LOGGER.info(data.getHttpResponse().getBody());
LOGGER.info("" + data.getHttpResponse().getStatus());
}
}
@Override
public void GuildMessageCreate(GuildMessageCreateEvent e) {
if (e.getGuild().getID() != 282226852616077312l)
return;
if (e.getMessage().getContent().startsWith("logs")) {
String[] args = e.getMessage().getContent().split(" ");
if (args.length == 1) {
} else if (args.length == 2) {
}
}
}
});
}
});
manager.launchShards();
} else {
loader = new DiscLoader(options);
loader.addEventListener(new EventListenerAdapter() {
@Override
public void MessageCreate(MessageCreateEvent e) {
if (e.getMessage().getContent().equals("#$close")) {
e.getLoader().gateway.websocket.disconnect(1001);
}
}
public void Ready(ReadyEvent e) {
LOGGER.info(e.getLoader().user.getUsername());
for (Command command : CommandRegistry.commands.entries()) {
LOGGER.info(command.getUnlocalizedName());
}
LOGGER.info(EntityRegistry.getGuildByID(282226852616077312l).getDefaultChannel().getName());
// .sendMessage("testing 125");
}
@Override
public void RawPacket(RawEvent data) {
WebSocketFrame frame = data.getFrame();
if (data.isGateway() && frame.isTextFrame() && !frame.getPayloadText().contains("PRESENCE_UPDATE")) {
LOGGER.info(frame.getPayloadText());
} else if (data.isREST() && data.getHttpResponse() != null) {
LOGGER.info(data.getHttpResponse().getBody());
}
}
});
loader.login();
}
}
Aggregations