public async Task RunBotAsync() { AppDomain.CurrentDomain.ProcessExit += OnProcessExit; _client = new DiscordShardedClient(new DiscordSocketConfig { ExclusiveBulkDelete = false, TotalShards = 2, AlwaysDownloadUsers = true, }); _commands = new CommandService(new CommandServiceConfig { LogLevel = LogSeverity.Info, CaseSensitiveCommands = false, ThrowOnError = false }); _services = new ServiceCollection() .AddSingleton(_client) .AddSingleton(_commands) .AddSingleton <InteractiveService>() .AddLavaNode(x => { x.ReconnectAttempts = 3; x.ReconnectDelay = TimeSpan.FromSeconds(3); }) .BuildServiceProvider(); _client.Log += Client_Log; _commands.Log += Client_Log; await RegisterCommandsAsync().ConfigureAwait(false); _client.UserJoined += AnnounceJoinedUser; compiler = new Process(); compiler.StartInfo.FileName = config.Location_to_java; compiler.StartInfo.Arguments = "-jar Lavalink.jar"; compiler.StartInfo.UseShellExecute = false; compiler.StartInfo.CreateNoWindow = false; compiler.StartInfo.RedirectStandardOutput = false; compiler.Start(); await _client.LoginAsync(TokenType.Bot, config.Token); await _client.StartAsync(); await Task.Delay(5000).ConfigureAwait(false); string streamUrlj = null; ActivityType type = ActivityType.Playing; await _client.SetGameAsync("Booting up", streamUrlj, type); await Task.Delay(_client.Shards.Count * 2500).ConfigureAwait(false); SocketTextChannel channel = _client.GetChannel(config.Log_channel) as SocketTextChannel; EmbedBuilder b = new EmbedBuilder(); b.WithTitle("Bot loading."); b.WithFooter("Requested by CONSOLE", "https://cdn.discordapp.com/attachments/728360861483401240/728362412373180566/console.png"); b.WithThumbnailUrl("https://cdn.discordapp.com/attachments/728360861483401240/728360959139381339/Spin-0.7s-255px.gif"); await channel.SendMessageAsync("", false, b.Build()); LavaNode _instanceOfLavaNode = _services.GetRequiredService <LavaNode>(); if (!_instanceOfLavaNode.IsConnected) { _ = _instanceOfLavaNode.ConnectAsync(); } AudioModule.Musicmodule(_instanceOfLavaNode); await SetSplashes().ConfigureAwait(false); await Task.Delay(-1).ConfigureAwait(false); }