File tree Expand file tree Collapse file tree
DiscordLab.Bot/API/Updates Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11namespace DiscordLab . Bot . API . Updates ;
22
3+ using LabApi . Features . Console ;
34using LabApi . Loader ;
45using LabApi . Loader . Features . Paths ;
56
@@ -60,7 +61,8 @@ public Module(GitHubRelease release, GitHubReleaseAsset asset)
6061 /// <param name="modules">The modules to generate for.</param>
6162 /// <returns>The generated string.</returns>
6263 public static string GenerateUpdateString ( IEnumerable < Module > modules ) => string . Join (
63- "\n - " , modules . Select ( module =>
64+ "\n - " ,
65+ modules . Select ( module =>
6466 $ "{ module . Name } | Current Version: { module . ExistingPlugin ! . Version } | Latest Version: { module . Version } ") ) ;
6567
6668 /// <summary>
@@ -77,8 +79,15 @@ internal async Task Download()
7779 File . Delete ( ExistingPlugin . FilePath ) ;
7880 }
7981
80- byte [ ] data = await Updater . DownloadClient . GetByteArrayAsync ( $ "/{ Release . TagName } /{ Asset . Name } ") ;
82+ try
83+ {
84+ byte [ ] data = await Updater . DownloadClient . GetByteArrayAsync ( $ "{ Release . TagName } /{ Asset . Name } ") ;
8185
82- File . WriteAllBytes ( filePath , data ) ;
86+ await File . WriteAllBytesAsync ( filePath , data ) ;
87+ }
88+ catch ( Exception ex )
89+ {
90+ Logger . Error ( $ "Had an error whilst updating { Name } at version { Version } :\n { ex } ") ;
91+ }
8392 }
8493}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public static async Task<IReadOnlyCollection<Module>> CheckForUpdates()
5656
5757 foreach ( GitHubReleaseAsset asset in release . Assets )
5858 {
59- if ( asset . Name is "dependencies.zip" or "DiscordLab.Bot.dll" )
59+ if ( asset . Name is "dependencies.zip" )
6060 continue ;
6161 string projectName = asset . Name . Replace ( ".dll" , string . Empty ) ;
6262 if ( modules . Any ( module => module . Name == projectName && module . Version >= version ) )
@@ -116,7 +116,7 @@ private static void Setup()
116116
117117 if ( Plugin . Instance . Config . AutoUpdate )
118118 {
119- DownloadClient . BaseAddress = new ( "https://github.com/DiscordLabSCP/DiscordLab/releases/download" ) ;
119+ DownloadClient . BaseAddress = new ( "https://github.com/DiscordLabSCP/DiscordLab/releases/download/ " ) ;
120120 DownloadClient . DefaultRequestHeaders . Add ( "User-Agent" , $ "DiscordLab/{ Plugin . Instance . Version } ") ;
121121 }
122122
You can’t perform that action at this time.
0 commit comments