From 5f5da5b29c3ebcb685b96e8b3271f1d21bcff26f Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 10 Dec 2024 14:24:29 +0000 Subject: [PATCH] feat: remove nesting --- DiscordLab.Bot/API/Modules/UpdateStatus.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/DiscordLab.Bot/API/Modules/UpdateStatus.cs b/DiscordLab.Bot/API/Modules/UpdateStatus.cs index ea3e0e0..aed31c4 100644 --- a/DiscordLab.Bot/API/Modules/UpdateStatus.cs +++ b/DiscordLab.Bot/API/Modules/UpdateStatus.cs @@ -93,18 +93,17 @@ public static async Task GetStatus() if(plugin.Name == Plugin.Instance.Name) status = statuses.First(x => x.ModuleName == "DiscordLab.Bot"); else continue; } - if (status.Version > plugin.Version) + + if (status.Version <= plugin.Version) continue; + if (Plugin.Instance.Config.AutoUpdate) { - if (Plugin.Instance.Config.AutoUpdate) - { - restartServer = true; - byte[] pluginData = await Client.GetByteArrayAsync(status.Url); - WritePlugin(pluginData, status.ModuleName); - } - else - { - Log.Warn($"There is a new version of {status.ModuleName} available, version {status.Version}, you are currently on {plugin.Version}! Download it from {status.Url}"); - } + restartServer = true; + byte[] pluginData = await Client.GetByteArrayAsync(status.Url); + WritePlugin(pluginData, status.ModuleName); + } + else + { + Log.Warn($"There is a new version of {status.ModuleName} available, version {status.Version}, you are currently on {plugin.Version}! Download it from {status.Url}"); } }