diff --git a/BUILDS/net6.0/MusicCommands.dll b/BUILDS/net6.0/MusicCommands.dll
index dac55eb..086a304 100644
Binary files a/BUILDS/net6.0/MusicCommands.dll and b/BUILDS/net6.0/MusicCommands.dll differ
diff --git a/BUILDS/net6.0/PluginManager.dll b/BUILDS/net6.0/PluginManager.dll
index 6be9c72..7680527 100644
Binary files a/BUILDS/net6.0/PluginManager.dll and b/BUILDS/net6.0/PluginManager.dll differ
diff --git a/DiscordBot/Discord/Core/CommandHandler.cs b/DiscordBot/Discord/Core/CommandHandler.cs
index b876858..3a87dbc 100644
--- a/DiscordBot/Discord/Core/CommandHandler.cs
+++ b/DiscordBot/Discord/Core/CommandHandler.cs
@@ -121,7 +121,6 @@ internal class CommandHandler
plugin.Execute(context, message, client, false);
Functions.WriteLogFile($"[{message.Author.Id}] Executed command : " + plugin.Command);
- return;
}
}
}
diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs
index 7a9f374..a2907b4 100644
--- a/DiscordBot/Program.cs
+++ b/DiscordBot/Program.cs
@@ -1,264 +1,231 @@
-using DiscordBot.Discord.Core;
-using PluginManager;
-using PluginManager.Items;
-using PluginManager.Others;
-using System;
+using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using DiscordBot.Discord.Core;
+using PluginManager;
+using PluginManager.Items;
using PluginManager.Online;
+using PluginManager.Others;
-namespace DiscordBot
+namespace DiscordBot;
+
+public class Program
{
- public class Program
+ private static bool loadPluginsOnStartup;
+ private static bool listPluginsAtStartup;
+
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ [Obsolete]
+ public static void Main(string[] args)
{
- private static bool loadPluginsOnStartup = false;
- private static bool listPluginsAtStartup = false;
+ Directory.CreateDirectory("./Data/Resources");
+ Directory.CreateDirectory("./Data/Plugins/Commands");
+ Directory.CreateDirectory("./Data/Plugins/Events");
+ PreLoadComponents().Wait();
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- [Obsolete]
- public static void Main(string[] args)
+ if (!Config.ContainsKey("token") || Config.GetValue("token") == null || Config.GetValue("token")?.Length != 70)
{
- Directory.CreateDirectory("./Data/Resources");
- Directory.CreateDirectory("./Data/Plugins/Commands");
- Directory.CreateDirectory("./Data/Plugins/Events");
- PreLoadComponents().Wait();
+ Console.WriteLine("Please insert your token");
+ Console.Write("Token = ");
+ var token = Console.ReadLine();
+ if (token?.Length == 59 || token?.Length == 70)
+ Config.AddValueToVariables("token", token, true);
+ else
+ Console.WriteLine("Invalid token");
- if (!Config.ContainsKey("token") || Config.GetValue("token") == null || Config.GetValue("token")?.Length != 70)
- {
- while (true)
- {
- Console.WriteLine("Please insert your token");
- Console.Write("Token = ");
- string token = Console.ReadLine();
- if (token?.Length == 59 || token?.Length == 70)
- Config.AddValueToVariables("token", token, true);
- else
- {
- Console.WriteLine("Invalid token");
- continue;
- }
+ Console.WriteLine("Please insert your prefix (max. 1 character long):");
+ Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed");
+ Console.Write("Prefix = ");
+ var prefix = Console.ReadLine()![0];
- Console.WriteLine("Please insert your prefix (max. 1 character long):");
- Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed");
- Console.Write("Prefix = ");
- char prefix = Console.ReadLine()![0];
-
- if (prefix == ' ' || char.IsDigit(prefix)) continue;
- Config.AddValueToVariables("prefix", prefix.ToString(), false);
- break;
- }
- }
-
- if (!Config.ContainsKey("prefix"))
- {
- Console.WriteLine("Please insert your prefix (max. 1 character long):");
- Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed");
- Console.Write("Prefix = ");
- char prefix = Console.ReadLine()![0];
-
- if (prefix == ' ' || char.IsDigit(prefix)) return;
- Config.AddValueToVariables("prefix", prefix.ToString(), false);
- }
-
- HandleInput(args).Wait();
+ if (prefix == ' ' || char.IsDigit(prefix)) return;
+ Config.AddValueToVariables("prefix", prefix.ToString(), false);
}
- ///
- /// The main loop for the discord bot
- ///
- /// The discord booter used to start the application
- private static Task NoGUI(Boot discordbooter)
+ if (!Config.ContainsKey("prefix") || Config.GetValue("prefix") == default)
{
- ConsoleCommandsHandler consoleCommandsHandler = new ConsoleCommandsHandler(discordbooter.client);
- if (loadPluginsOnStartup) consoleCommandsHandler.HandleCommand("lp");
- if (listPluginsAtStartup) consoleCommandsHandler.HandleCommand("listplugs");
- Config.SaveConfig();
- while (true)
- {
- Console.ForegroundColor = ConsoleColor.White;
- string cmd = Console.ReadLine();
- consoleCommandsHandler.HandleCommand(cmd);
- }
+ Console.WriteLine("Please insert your prefix (max. 1 character long):");
+ Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored.\n No spaces or numbers allowed");
+ Console.Write("Prefix = ");
+ var prefix = Console.ReadLine()![0];
+ if (prefix == ' ') return;
+ Config.AddValueToVariables("prefix", prefix.ToString(), false);
}
- ///
- /// Start the bot without user interface
- ///
- /// Returns the boot loader for the Discord Bot
- private static async Task StartNoGUI()
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.WriteLine("Discord BOT for Cross Platform");
- Console.WriteLine("Created by: Wizzy\nDiscord: Wizzy#9181");
+ HandleInput(args).Wait();
+ }
+
+ ///
+ /// The main loop for the discord bot
+ ///
+ /// The discord booter used to start the application
+ private static Task NoGUI(Boot discordbooter)
+ {
+ var consoleCommandsHandler = new ConsoleCommandsHandler(discordbooter.client);
+ if (loadPluginsOnStartup) consoleCommandsHandler.HandleCommand("lp");
+ if (listPluginsAtStartup) consoleCommandsHandler.HandleCommand("listplugs");
+ Config.SaveConfig();
+ while (true)
+ {
Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("============================ Discord BOT - Cross Platform ============================");
-
- try
- {
- string token = Config.GetValue("token");
- string prefix = Config.GetValue("prefix");
-
- var discordbooter = new Boot(token, prefix);
- await discordbooter.Awake();
- return discordbooter;
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex);
- return null;
- }
- }
-
- ///
- /// Clear folder
- ///
- /// Directory path
- private static Task ClearFolder(string d)
- {
- string[] files = Directory.GetFiles(d);
- int fileNumb = files.Length;
- for (var i = 0; i < fileNumb; i++)
- {
- File.Delete(files[i]);
- Console.WriteLine("Deleting : " + files[i]);
- }
-
- return Task.CompletedTask;
- }
-
- ///
- /// Handle user input arguments from the startup of the application
- ///
- /// The arguments
- private static async Task HandleInput(string[] args)
- {
- int len = args.Length;
- if (len == 1 && args[0] == "--help")
- {
- Console.WriteLine("Available commands:\n--exec -> start the bot with tools enabled");
- return;
- }
-
- if (len == 1 && args[0] == "--logout")
- {
- File.Delete(Functions.dataFolder + "config.json");
- await Task.Run(async () =>
- {
- await Task.Delay(1000);
- Environment.Exit(0x08);
- }
- );
- return;
- }
-
- if (len >= 2 && args[0] == "--encrypt")
- {
- string s2e = args.MergeStrings(1);
- Console.WriteLine("MD5: " + await Cryptography.CreateMD5(s2e));
- Console.WriteLine("SHA356: " + await Cryptography.CreateSHA256(s2e));
- return;
- }
-
- if (len == 3 && args[0] == "/download")
- {
- string url = args[1];
- string location = args[2];
-
- await ServerCom.DownloadFileAsync(url, location);
-
- return;
- }
-
- if (len > 0 && (args.Contains("--cmd") || args.Contains("--args") || args.Contains("--nomessage")))
- {
- if (args.Contains("lp") || args.Contains("loadplugins")) loadPluginsOnStartup = true;
- if (args.Contains("listplugs")) listPluginsAtStartup = true;
- len = 0;
- }
-
-
- if (len == 0 || args[0] != "--exec" && args[0] != "--execute")
- {
- Boot b = await StartNoGUI();
- await NoGUI(b);
- return;
- }
-
-
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.WriteLine("Execute command interface noGUI\n\n");
- Console.WriteLine(
- "\tCommand name\t\t\t\tDescription\n" +
- "-- help | -help\t\t ------ \tDisplay the help message\n" +
- "--reset-full\t\t ------ \tReset all files (clear files)\n" +
- "--reset-logs\t\t ------ \tClear up the output folder\n" +
- "--start\t\t ------ \tStart the bot\n" +
- "exit\t\t\t ------ \tClose the application"
- );
- while (true)
- {
- Console.ForegroundColor = ConsoleColor.White;
- Console.Write("> ");
- string[] message = Console.ReadLine().Split(' ');
-
- switch (message[0])
- {
- case "--help":
- case "-help":
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.WriteLine(
- "\tCommand name\t\t\t\tDescription\n" +
- "-- help | -help\t\t ------ \tDisplay the help message\n" +
- "--reset-full\t\t ------ \tReset all files (clear files)\n" +
- "--reset-settings\t ------ \tReset only bot settings\n" +
- "--reset-logs\t\t ------ \tClear up the output folder\n" +
- "--start\t\t ------ \tStart the bot\n" +
- "exit\t\t\t ------ \tClose the application"
- );
- break;
- case "--reset-full":
- await ClearFolder("./Data/Resources/");
- await ClearFolder("./Output/Logs/");
- await ClearFolder("./Output/Errors");
- await ClearFolder("./Data/Languages/");
- await ClearFolder("./Data/Plugins/Commands");
- await ClearFolder("./Data/Plugins/Events");
- Console.WriteLine("Successfully cleared all folders");
- break;
- case "--reset-logs":
- await ClearFolder("./Output/Logs");
- await ClearFolder("./Output/Errors");
- Console.WriteLine("Successfully cleard logs folder");
- break;
- case "--exit":
- case "exit":
- Environment.Exit(0);
- break;
- case "--start":
- Boot booter = await StartNoGUI();
- await NoGUI(booter);
- return;
-
- default:
- Console.WriteLine("Failed to execute command " + message[0]);
- break;
- }
- }
- }
-
- private static async Task PreLoadComponents()
- {
- await Config.LoadConfig();
- if (Config.ContainsKey("DeleteLogsAtStartup"))
- if (Config.GetValue("DeleteLogsAtStartup"))
- foreach (string file in Directory.GetFiles("./Output/Logs/"))
- File.Delete(file);
+ var cmd = Console.ReadLine();
+ consoleCommandsHandler.HandleCommand(cmd);
}
}
+
+ ///
+ /// Start the bot without user interface
+ ///
+ /// Returns the boot loader for the Discord Bot
+ private static async Task StartNoGUI()
+ {
+ Console.Clear();
+ Console.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine("Discord BOT for Cross Platform");
+ Console.WriteLine("Created by: Wizzy\nDiscord: Wizzy#9181");
+
+ Console.ForegroundColor = ConsoleColor.White;
+ Console.WriteLine("============================ Discord BOT - Cross Platform ============================");
+
+ try
+ {
+ var token = Config.GetValue("token");
+ var prefix = Config.GetValue("prefix");
+
+ var discordbooter = new Boot(token, prefix);
+ await discordbooter.Awake();
+ return discordbooter;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex);
+ return null;
+ }
+ }
+
+ ///
+ /// Clear folder
+ ///
+ /// Directory path
+ private static Task ClearFolder(string d)
+ {
+ var files = Directory.GetFiles(d);
+ var fileNumb = files.Length;
+ for (var i = 0; i < fileNumb; i++)
+ {
+ File.Delete(files[i]);
+ Console.WriteLine("Deleting : " + files[i]);
+ }
+
+ return Task.CompletedTask;
+ }
+
+ ///
+ /// Handle user input arguments from the startup of the application
+ ///
+ /// The arguments
+ private static async Task HandleInput(string[] args)
+ {
+ var len = args.Length;
+
+ if (len == 3 && args[0] == "/download")
+ {
+ var url = args[1];
+ var location = args[2];
+
+ await ServerCom.DownloadFileAsync(url, location);
+
+ return;
+ }
+
+ if (len > 0 && (args.Contains("--cmd") || args.Contains("--args") || args.Contains("--nomessage")))
+ {
+ if (args.Contains("lp") || args.Contains("loadplugins")) loadPluginsOnStartup = true;
+ if (args.Contains("listplugs")) listPluginsAtStartup = true;
+ len = 0;
+ }
+
+
+ if (len == 0 || (args[0] != "--exec" && args[0] != "--execute"))
+ {
+ var b = await StartNoGUI();
+ await NoGUI(b);
+ return;
+ }
+
+
+ Console.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine("Execute command interface noGUI\n\n");
+ Console.WriteLine(
+ "\tCommand name\t\t\t\tDescription\n" +
+ "-- help | -help\t\t ------ \tDisplay the help message\n" +
+ "--reset-full\t\t ------ \tReset all files (clear files)\n" +
+ "--reset-logs\t\t ------ \tClear up the output folder\n" +
+ "--start\t\t ------ \tStart the bot\n" +
+ "exit\t\t\t ------ \tClose the application"
+ );
+ while (true)
+ {
+ Console.ForegroundColor = ConsoleColor.White;
+ Console.Write("> ");
+ var message = Console.ReadLine().Split(' ');
+
+ switch (message[0])
+ {
+ case "--help":
+ case "-help":
+ Console.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine(
+ "\tCommand name\t\t\t\tDescription\n" +
+ "-- help | -help\t\t ------ \tDisplay the help message\n" +
+ "--reset-full\t\t ------ \tReset all files (clear files)\n" +
+ "--reset-settings\t ------ \tReset only bot settings\n" +
+ "--reset-logs\t\t ------ \tClear up the output folder\n" +
+ "--start\t\t ------ \tStart the bot\n" +
+ "exit\t\t\t ------ \tClose the application"
+ );
+ break;
+ case "--reset-full":
+ await ClearFolder("./Data/Resources/");
+ await ClearFolder("./Output/Logs/");
+ await ClearFolder("./Output/Errors");
+ await ClearFolder("./Data/Languages/");
+ await ClearFolder("./Data/Plugins/Commands");
+ await ClearFolder("./Data/Plugins/Events");
+ Console.WriteLine("Successfully cleared all folders");
+ break;
+ case "--reset-logs":
+ await ClearFolder("./Output/Logs");
+ await ClearFolder("./Output/Errors");
+ Console.WriteLine("Successfully cleard logs folder");
+ break;
+ case "--exit":
+ case "exit":
+ Environment.Exit(0);
+ break;
+ case "--start":
+ var booter = await StartNoGUI();
+ await NoGUI(booter);
+ return;
+
+ default:
+ Console.WriteLine("Failed to execute command " + message[0]);
+ break;
+ }
+ }
+ }
+
+ private static async Task PreLoadComponents()
+ {
+ await Config.LoadConfig();
+ if (Config.ContainsKey("DeleteLogsAtStartup"))
+ if (Config.GetValue("DeleteLogsAtStartup"))
+ foreach (var file in Directory.GetFiles("./Output/Logs/"))
+ File.Delete(file);
+ }
}
diff --git a/MusicCommands/Data.cs b/MusicCommands/Data.cs
index 30a79b4..066af23 100644
--- a/MusicCommands/Data.cs
+++ b/MusicCommands/Data.cs
@@ -1,8 +1,7 @@
using Discord;
using Discord.Audio;
-using MusicCommands;
-namespace CMD_Utils.Music;
+namespace MusicCommands;
internal static class Data
{
diff --git a/MusicCommands/Leave.cs b/MusicCommands/Leave.cs
index 11fb2dd..3171489 100644
--- a/MusicCommands/Leave.cs
+++ b/MusicCommands/Leave.cs
@@ -2,7 +2,7 @@
using Discord.WebSocket;
using PluginManager.Interfaces;
-namespace CMD_Utils.Music;
+namespace MusicCommands;
internal class Leave : DBCommand
{
diff --git a/MusicCommands/MusicCommands.csproj b/MusicCommands/MusicCommands.csproj
index f64e6f5..9bd106b 100644
--- a/MusicCommands/MusicCommands.csproj
+++ b/MusicCommands/MusicCommands.csproj
@@ -3,6 +3,7 @@
net6.0
warnings
+ ..\DiscordBot\bin\Debug\net6.0\Data\Plugins\Commands\MusicCommands
diff --git a/MusicCommands/MusicPlayer.cs b/MusicCommands/MusicPlayer.cs
index e50ab8f..6d8e8f6 100644
--- a/MusicCommands/MusicPlayer.cs
+++ b/MusicCommands/MusicPlayer.cs
@@ -3,7 +3,6 @@ using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
-using CMD_Utils.Music;
using PluginManager.Others;
namespace MusicCommands;
diff --git a/MusicCommands/Pause.cs b/MusicCommands/Pause.cs
index 035e8f7..8a86430 100644
--- a/MusicCommands/Pause.cs
+++ b/MusicCommands/Pause.cs
@@ -2,7 +2,7 @@
using Discord.WebSocket;
using PluginManager.Interfaces;
-namespace CMD_Utils.Music;
+namespace MusicCommands;
internal class Pause : DBCommand
{
diff --git a/MusicCommands/Play.cs b/MusicCommands/Play.cs
index 26d9a0f..0e9b181 100644
--- a/MusicCommands/Play.cs
+++ b/MusicCommands/Play.cs
@@ -5,11 +5,10 @@ using Discord;
using Discord.Audio;
using Discord.Commands;
using Discord.WebSocket;
-using MusicCommands;
using PluginManager.Interfaces;
using PluginManager.Others;
-namespace CMD_Utils.Music;
+namespace MusicCommands;
internal class Play : DBCommand
{
@@ -29,7 +28,7 @@ internal class Play : DBCommand
{
var path = "./Music";
var FileName = Functions.GetArguments(message).ToArray().MergeStrings(0);
- path += "/" + FileName + ".mp3";
+ path += "/" + FileName + ".ogg";
if (!File.Exists(path))
{
Console.WriteLine("Unknown path " + path);
diff --git a/MusicCommands/Unpause.cs b/MusicCommands/Unpause.cs
index cc004c7..cfe2040 100644
--- a/MusicCommands/Unpause.cs
+++ b/MusicCommands/Unpause.cs
@@ -1,5 +1,4 @@
-using CMD_Utils.Music;
-using Discord.Commands;
+using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
diff --git a/MusicCommands/lplay.cs b/MusicCommands/lplay.cs
index 14e51b3..6adb117 100644
--- a/MusicCommands/lplay.cs
+++ b/MusicCommands/lplay.cs
@@ -1,5 +1,4 @@
-using CMD_Utils.Music;
-using Discord;
+using Discord;
using Discord.Audio;
using Discord.Commands;
using Discord.WebSocket;