Beispiel #1
0
        public async Task Execute(IJobExecutionContext context)
        {
            JobDataMap           dataMap        = context.JobDetail.JobDataMap;
            IServiceManager      serviceManager = (IServiceManager)dataMap["ServiceManager"];
            DiscordShardedClient discordClient  = (DiscordShardedClient)dataMap["DiscordClient"];

            IMusicPlayerService music   = serviceManager.GetService <IMusicPlayerService>("Music");
            IRestartService     restart = serviceManager.GetService <IRestartService>("Restart");

            await music.DisconnectAllPlayersAsync("Weekly update on-going, disconnecting", true);

            SocketChannel updateChan = discordClient.GetChannel(Config.Instance.Discord.UpdateChannelID);

            if (updateChan != null)
            {
                await restart.WarnChannelAsync(updateChan, "Updating to the latest changes...");
            }

            await restart.RestartAsync();
        }
Beispiel #2
0
        private async void OnReconnectRequested(RemoteProcess proc, string publicIp)
        {
            if (string.IsNullOrWhiteSpace(publicIp) || proc.Name != "Watchdog")
            {
                return;
            }
            this.Log($"Remote nodes reconnected with IP: {publicIp}");

            IMusicPlayerService music = this.ServiceManager.GetService <IMusicPlayerService>("Music");
            await music.DisconnectAllPlayersAsync("Network issues detected, disconnecting to prevent further bugs");

            await music.StartAsync(publicIp);

            SocketChannel bugChan = this.DiscordClient.GetChannel(Config.Instance.Discord.BugReportChannelID);

            if (bugChan != null)
            {
                await this.MessageSender.SendWarningAsync(bugChan, "network errors", "Reconnected to lavalink remote server");
            }
        }