use of io.discloader.discloader.entity.sendable.Packet in project DiscLoader by R3alCl0ud.
the class GatewayListener method sendResume.
public void sendResume() {
if (tries >= 3) {
sendNewIdentify();
return;
}
Packet d = new Packet(OPCodes.RESUME, new GatewayResume(socket.sessionID, token, socket.s));
socket.send(d, true);
}
use of io.discloader.discloader.entity.sendable.Packet in project DiscLoader by R3alCl0ud.
the class GatewayListener method sendNewIdentify.
public void sendNewIdentify() {
if (!loader.token.startsWith("Bot ")) {
token = loader.token;
}
System.out.println(token);
GatewayIdentify payload = new GatewayIdentify(token, 250, new Properties("DiscLoader", "DiscLoader", "DiscLoader"));
try {
if (this.loader.shards > 1) {
payload.setShard(loader.shardid, loader.shards);
}
} catch (NullPointerException e) {
logger.throwing(e.getStackTrace()[0].getClassName(), e.getStackTrace()[0].getMethodName(), e);
}
Packet packet = new Packet(OPCodes.IDENTIFY, payload);
socket.send(packet, true);
socket.s = -1;
tries = 0;
}
use of io.discloader.discloader.entity.sendable.Packet in project DiscLoader by R3alCl0ud.
the class DiscLoader method syncGuilds.
/**
* Syncs guilds to client if the logged in user is not a bot
*
* @param guildIDs
* the ids of the guilds to sync
* @throws AccountTypeException
* @throws GuildSyncException
*/
public void syncGuilds(long... guildIDs) throws AccountTypeException, GuildSyncException {
if (user.isBot())
throw new AccountTypeException("Only user accounts are allowed to sync guilds");
String[] ids = new String[guildIDs.length];
for (int i = 0; i < guildIDs.length; i++) {
ids[i] = Long.toUnsignedString(guildIDs[i], 10);
}
Packet packet = new Packet(12, ids);
socket.send(packet, true);
}
use of io.discloader.discloader.entity.sendable.Packet in project DiscLoader by R3alCl0ud.
the class DiscLoader method syncGuilds.
/**
* Syncs guilds to client if the logged in user is not a bot
*
* @param guildIDs
* the ids of the guilds to sync
* @throws AccountTypeException
* @throws GuildSyncException
*/
public void syncGuilds(String... guildIDs) throws AccountTypeException, GuildSyncException {
if (user.isBot())
throw new AccountTypeException("Only user accounts are allowed to sync guilds");
for (String id : guildIDs) {
if (isGuildSyncing(id))
throw new GuildSyncException("Cannot syncing a guild that is currently syncing");
}
Packet packet = new Packet(12, guildIDs);
socket.send(packet, true);
}
Aggregations