Skip to content

Commit

Permalink
fix(UpdateStatus): path being incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
LumiFae committed Dec 10, 2024
1 parent 5f5da5b commit da2cb86
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions DiscordLab.Bot/API/Modules/UpdateStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static class UpdateStatus
/// <param name="name">The name of the plugin, without .dll</param>
private static void WritePlugin(byte[] bytes, string name)
{
string pluginPath = Path + name + ".dll";
string pluginPath = System.IO.Path.Combine(Path, name + ".dll");
File.WriteAllBytes(pluginPath, bytes);
}

Expand Down Expand Up @@ -84,7 +84,7 @@ public static async Task GetStatus()

List<IPlugin<IConfig>> plugins = Loader.Plugins.Where(x => x.Name.StartsWith("DiscordLab.")).ToList();
plugins.Add(Loader.Plugins.First(x => x.Name == Plugin.Instance.Name));
bool restartServer = false;
List<string> pluginsToUpdate = new();
foreach (IPlugin<IConfig> plugin in plugins)
{
API.Features.UpdateStatus status = statuses.FirstOrDefault(x => x.ModuleName == plugin.Name);
Expand All @@ -97,7 +97,7 @@ public static async Task GetStatus()
if (status.Version <= plugin.Version) continue;
if (Plugin.Instance.Config.AutoUpdate)
{
restartServer = true;
pluginsToUpdate.Add(status.ModuleName);
byte[] pluginData = await Client.GetByteArrayAsync(status.Url);
WritePlugin(pluginData, status.ModuleName);
}
Expand All @@ -107,10 +107,10 @@ public static async Task GetStatus()
}
}

if (restartServer)
if (pluginsToUpdate.Any())
{
ServerStatic.StopNextRound = ServerStatic.NextRoundAction.Restart;
Log.Info("Server will restart next round for updates.");
Log.Info("Server will restart next round for updates. Updating plugins: " + string.Join(", ", pluginsToUpdate));
}
}
}
Expand Down

0 comments on commit da2cb86

Please sign in to comment.