Exemplo n.º 1
0
 private Task Lavalink_Disconnected(LavalinkNodeConnection ll, NodeDisconnectedEventArgs e)
 {
     if (e.IsCleanClose)
     {
         this.Lavalink      = null;
         this.LavalinkVoice = null;
     }
     return(Task.CompletedTask);
 }
Exemplo n.º 2
0
        private Task LavalinkDisconnected(LavalinkNodeConnection lvn, NodeDisconnectedEventArgs e)
        {
            ShimakazeBot.SendToDebugRoom("Lavalink died.");

            // ShimakazeBot.lvn.LavalinkSocketErrored -= LavalinkErrored;
            //ShimakazeBot.lvn.Disconnected -= LavalinkDisconnected;
            //ShimakazeBot.lvn = null;
            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Triggers the <see cref="NodeDisconnected"/> event asynchronously.
        /// </summary>
        /// <param name="eventArgs">the event arguments</param>
        /// <returns>a task that represents the asynchronous operation</returns>
        protected virtual async Task OnNodeDisconnectedAsync(NodeDisconnectedEventArgs eventArgs)
        {
            // stay-online feature
            if (StayOnline && eventArgs.ByRemote)
            {
                _logger?.Log(this, "(Stay-Online) Node died! Moving players to a new node...", LogLevel.Warning);

                var players = eventArgs.Node.GetPlayers <LavalinkPlayer>();

                // move all players
                var tasks = players.Select(player => MovePlayerToNewNodeAsync(eventArgs.Node, player)).ToArray();

                // await until all players were moved to a new node
                await Task.WhenAll(tasks);
            }

            // invoke event
            await NodeDisconnected.InvokeAsync(this, eventArgs);
        }
Exemplo n.º 4
0
 private Task Con_Disconnected(NodeDisconnectedEventArgs e)
 => this._nodeDisconnected.InvokeAsync(e);
Exemplo n.º 5
0
 private Task Lavalink_Disconnected(NodeDisconnectedEventArgs e)
 {
     this.Lavalink      = null;
     this.LavalinkVoice = null;
     return(Task.CompletedTask);
 }
Exemplo n.º 6
0
 private Task Con_Disconnected(LavalinkNodeConnection node, NodeDisconnectedEventArgs e)
 => this._nodeDisconnected.InvokeAsync(node, e);
Exemplo n.º 7
0
        async Task NodeDisconnected(NodeDisconnectedEventArgs e)
        {
            await Task.Delay(0);

            this.MusicPlayers.Clear();
        }
 async Task OnNodeDisconnected(NodeDisconnectedEventArgs e)
 {
     this._players.Clear();
 }