diff --git a/BUILDS/net6.0/PluginManager.dll b/BUILDS/net6.0/PluginManager.dll index 8c7315b..bb6f20f 100644 Binary files a/BUILDS/net6.0/PluginManager.dll and b/BUILDS/net6.0/PluginManager.dll differ diff --git a/BUILDS/net6.0/Plugins/Commands/CMD_LevelingSystem.dll b/BUILDS/net6.0/Plugins/Commands/CMD_LevelingSystem.dll new file mode 100644 index 0000000..c1c7ecf Binary files /dev/null and b/BUILDS/net6.0/Plugins/Commands/CMD_LevelingSystem.dll differ diff --git a/BUILDS/net6.0/Plugins/Commands/CMD_Utils.dll b/BUILDS/net6.0/Plugins/Commands/CMD_Utils.dll new file mode 100644 index 0000000..d30bcd7 Binary files /dev/null and b/BUILDS/net6.0/Plugins/Commands/CMD_Utils.dll differ diff --git a/BUILDS/net6.0/Plugins/Commands/MusicCommands.dll b/BUILDS/net6.0/Plugins/Commands/MusicCommands.dll new file mode 100644 index 0000000..b690a8c Binary files /dev/null and b/BUILDS/net6.0/Plugins/Commands/MusicCommands.dll differ diff --git a/BUILDS/net6.0/Plugins/Events/EVE_LevelingSystem.dll b/BUILDS/net6.0/Plugins/Events/EVE_LevelingSystem.dll new file mode 100644 index 0000000..efc3f15 Binary files /dev/null and b/BUILDS/net6.0/Plugins/Events/EVE_LevelingSystem.dll differ diff --git a/CMD_Utils/CMD_Utils.csproj b/CMD_Utils/CMD_Utils.csproj index 9d3154b..40c79f6 100644 --- a/CMD_Utils/CMD_Utils.csproj +++ b/CMD_Utils/CMD_Utils.csproj @@ -2,6 +2,7 @@ net6.0 + diff --git a/PluginManager/Items/ConsoleCommandsHandler.cs b/PluginManager/Items/ConsoleCommandsHandler.cs index 072161a..957e66a 100644 --- a/PluginManager/Items/ConsoleCommandsHandler.cs +++ b/PluginManager/Items/ConsoleCommandsHandler.cs @@ -14,8 +14,8 @@ namespace PluginManager.Items; public class ConsoleCommandsHandler { - private static readonly PluginsManager manager = new PluginsManager("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Plugins"); - public static List commandList = new List(); + private static readonly PluginsManager manager = new("https://raw.githubusercontent.com/Wizzy69/installer/discord-bot-files/Plugins.txt"); + public static List commandList = new(); private readonly DiscordSocketClient? client; public ConsoleCommandsHandler(DiscordSocketClient client) @@ -141,6 +141,7 @@ public class ConsoleCommandsHandler foreach (var line in lines) { + if (!(line.Length > 0 && line.Contains(","))) continue; var split = line.Split(','); Console.WriteLine($"\nDownloading item: {split[1]}"); await ServerCom.DownloadFileAsync(split[0], "./" + split[1]); diff --git a/PluginManager/Online/LanguageManager.cs b/PluginManager/Online/LanguageManager.cs deleted file mode 100644 index fc24bad..0000000 --- a/PluginManager/Online/LanguageManager.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using PluginManager.Others; - -namespace PluginManager.Online; - -public class LanguageManager -{ - private readonly string link; - - /// - /// The Language Manager constructor - /// - /// The link to where all the languages for the bot are stored - public LanguageManager(string link) - { - this.link = link; - } - - /// - /// The method to list all languages - /// - /// - public async Task ListAllLanguages() - { - try - { - var list = await ServerCom.ReadTextFromFile(link); - var lines = list.ToArray(); - - var info = new List(); - info.Add(new[] { "-", "-" }); - info.Add(new[] { "Language Name", "File Size" }); - info.Add(new[] { "-", "-" }); - foreach (var line in lines) - { - if (line.Length <= 2) continue; - var d = line.Split(','); - if (d[3].Contains("cp") || d[3].Contains("CrossPlatform")) info.Add(new[] { d[0], d[1] }); - } - - info.Add(new[] { "-", "-" }); - Console_Utilities.FormatAndAlignTable(info); - } - - catch (Exception exception) - { - Console.WriteLine("Failed to execute command: listlang\nReason: " + exception.Message); - Functions.WriteErrFile(exception.ToString()); - } - } - - /// - /// A function that gets the download link for specified language - /// - /// The name of the language - /// - public async Task GetDownloadLink(string langName) - { - try - { - var list = await ServerCom.ReadTextFromFile(link); - var lines = list.ToArray(); - - foreach (var line in lines) - { - if (line.Length <= 2) continue; - var d = line.Split(','); - if (d[0].Equals(langName) && (d[3].Contains("cp") || d[3].Contains("CrossPlatform"))) return new[] { d[2], d[3] }; - } - } - catch (Exception exception) - { - Console.WriteLine("Failed to execute command: listlang\nReason: " + exception.Message); - Functions.WriteErrFile(exception.ToString()); - } - - - return null; - } -} diff --git a/PluginManager/Others/Cryptography.cs b/PluginManager/Others/Cryptography.cs deleted file mode 100644 index 04864ae..0000000 --- a/PluginManager/Others/Cryptography.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.IO; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; - -namespace PluginManager.Others; - -public class Cryptography -{ - /// - /// Translate hex to string - /// - /// The encrypted string - /// - public static string FromHexToString(string hexString) - { - var bytes = new byte[hexString.Length / 2]; - for (var i = 0; i < bytes.Length; i++) bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); - - return Encoding.Unicode.GetString(bytes); - } - - /// - /// Translate string to hex - /// - /// The string to encrypt - /// - public static string ToHexString(string str) - { - var sb = new StringBuilder(); - - var bytes = Encoding.Unicode.GetBytes(str); - foreach (var t in bytes) sb.Append(t.ToString("X2")); - - return sb.ToString(); - } - - /// - /// Create MD5 hash - /// - /// The text to encrypt - /// - public static async Task CreateMD5(string text) - { - var output = ""; - using (var md5 = MD5.Create()) - { - using (var s = GenerateStreamFromString(text)) - { - var t = await md5.ComputeHashAsync(s); - output = Convert.ToBase64String(t); - } - } - - return output; - } - - /// - /// Create SHA256 hash - /// - /// The text to encrypt - /// - public static async Task CreateSHA256(string text) - { - var output = ""; - using (var sha = SHA256.Create()) - { - using (var s = GenerateStreamFromString(text)) - { - var t = await sha.ComputeHashAsync(s); - output = Convert.ToBase64String(t); - } - } - - return output; - } - - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } -}