Beispiel #1
0
        public async Task <LavaNode> AddNodeAsync(DiscordSocketClient socketClient,
                                                  LavaNodeSettings settings)
        {
            var hash = socketClient.GetHashCode();

            if (_nodes.TryGetValue(hash, out LavaNode node))
            {
                return(node);
            }

            settings.Shards = settings.Shards is null ?
                              await socketClient.GetRecommendedShardCountAsync().ConfigureAwait(false)
                : 1;

            node = new LavaNode(settings);
            await node.InitializeAsync().ConfigureAwait(false);

            return(node);
        }