use of fredboat.config.property.Credentials in project FredBoat by Frederikam.
the class ShardReviveHandler method onShutdown.
@Override
public void onShutdown(ShutdownEvent event) {
try {
List<Long> channels = new ArrayList<>();
int shardId = event.getJDA().getShardInfo().getShardId();
playerRegistry.getPlayingPlayers().stream().filter(guildPlayer -> DiscordUtil.getShardId(guildPlayer.getGuildId(), credentials) == shardId).forEach(guildPlayer -> {
VoiceChannel channel = guildPlayer.getCurrentVoiceChannel();
if (channel != null)
channels.add(channel.getIdLong());
});
channelsToRejoin.put(shardId, channels);
} catch (Exception ex) {
log.error("Caught exception while saving channels to revive shard {}", event.getJDA().getShardInfo(), ex);
}
}
Aggregations