Added autoinstall for modules

This commit is contained in:
2024-07-14 21:24:49 +03:00
parent 3f8590b8f3
commit 13900bb3f3
10 changed files with 153 additions and 40 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DiscordBotCore.Online;
namespace DiscordBotCore.Modules
{
public class ModuleDownloader
{
private string _moduleName;
private readonly string _baseUrl = "https://raw.githubusercontent.com/andreitdr/SethPlugins/tests/Modules/";
private readonly string _moduleFolder = "./Data/Modules";
public ModuleDownloader(string moduleName)
{
_moduleName = moduleName;
}
public async Task DownloadModule(IProgress<float> progressToWrite)
{
Directory.CreateDirectory(_moduleFolder);
string url = _baseUrl + _moduleName + ".dll";
await ServerCom.DownloadFileAsync(url, _moduleFolder + "/" + _moduleName + ".dll", progressToWrite);
}
}
}