use of io.discloader.discloader.common.exceptions.GuildSyncException in project DiscLoader by R3alCl0ud.
the class DiscLoader method syncGuilds.
/**
* Syncs guilds to client if the logged in user is not a bot
*
* @param guilds the guilds to sync
* @throws GuildSyncException
* @throws AccountTypeException
*/
public void syncGuilds(IGuild... guilds) throws GuildSyncException, AccountTypeException {
if (user.isBot())
throw new AccountTypeException("Only user accounts are allowed to sync guilds");
String[] ids = new String[guilds.length];
for (int i = 0; i < guilds.length; i++) {
if (isGuildSyncing(guilds[i]))
throw new GuildSyncException("Cannot syncing a guild that is currently syncing");
ids[i] = Long.toUnsignedString(guilds[i].getID());
}
Packet packet = new Packet(12, ids);
gateway.send(packet, true);
}
use of io.discloader.discloader.common.exceptions.GuildSyncException 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);
gateway.send(packet, true);
}
Aggregations