This commit is contained in:
Binary file not shown.
@@ -53,7 +53,7 @@ namespace DiscordBot.Discord.Commands
|
||||
{
|
||||
if (!DiscordPermissions.hasPermission(message.Author as SocketGuildUser, DiscordLib.GuildPermission.Administrator)) return;
|
||||
var args = Functions.GetArguments(message);
|
||||
var OS = Functions.GetOperatinSystem();
|
||||
var OS = Functions.GetOperatingSystem();
|
||||
if (args.Count == 0)
|
||||
{
|
||||
switch (OS)
|
||||
@@ -94,7 +94,7 @@ namespace DiscordBot.Discord.Commands
|
||||
Process.Start("./DiscordBot.exe", cmd);
|
||||
break;
|
||||
case PluginManager.Others.OperatingSystem.LINUX:
|
||||
case PluginManager.Others.OperatingSystem.MAC_OS:
|
||||
//case PluginManager.Others.OperatingSystem.MAC_OS: ?? - not tested
|
||||
Process.Start("./DiscordBot", cmd);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace DiscordBot
|
||||
if (listLanguagAtStartup)
|
||||
await languageManager.ListAllLanguages();
|
||||
|
||||
|
||||
Console_Utilities.ProgressBar pbar;
|
||||
IProgress<float> progress = null;
|
||||
Task t;
|
||||
@@ -94,7 +95,7 @@ namespace DiscordBot
|
||||
while (true)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console_Utilities.WriteColorText("&mConsole > &c", false);
|
||||
Console_Utilities.WriteColorText("&mConsole ", false);
|
||||
string[] data = Console.ReadLine().Split(' ');
|
||||
|
||||
if (data[0].Length < 2)
|
||||
@@ -150,7 +151,7 @@ namespace DiscordBot
|
||||
if (info.Length == 3 && info[2] != string.Empty && info[2] != null)
|
||||
{
|
||||
Console.WriteLine($"Downloading requirements for plugin : {name}");
|
||||
//
|
||||
|
||||
List<string> lines = await ServerCom.ReadTextFromFile(info[2]);
|
||||
int i = 1;
|
||||
|
||||
@@ -172,6 +173,7 @@ namespace DiscordBot
|
||||
case "setlang":
|
||||
if (data.Length == 2)
|
||||
SetLanguage(data[1]);
|
||||
else Console.WriteLine("Invalid arguments");
|
||||
break;
|
||||
case "set-setting":
|
||||
if (data.Length >= 3)
|
||||
@@ -230,7 +232,8 @@ namespace DiscordBot
|
||||
break;
|
||||
case "help":
|
||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine(
|
||||
Console.WriteLine
|
||||
(
|
||||
"lp | loadplugins -> load all plugins\n" +
|
||||
"sd | shutdown->close connection to the server(stop bot)\n" +
|
||||
"token -> display the current token\n" +
|
||||
@@ -308,7 +311,7 @@ namespace DiscordBot
|
||||
//Load language from the specified file ...
|
||||
Language.ActiveLanguage = null;
|
||||
|
||||
string langname = File.ReadAllText(langSettings).Split('=')[1];
|
||||
string langname = Functions.readCodeFromFile(langSettings, "Language", '=');
|
||||
if (langname == "English")
|
||||
{
|
||||
Language.ActiveLanguage = null;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace PluginManager.Online
|
||||
string[] lines = list.ToArray();
|
||||
|
||||
List<string[]> data = new List<string[]>();
|
||||
var op = Functions.GetOperatinSystem();
|
||||
var op = Functions.GetOperatingSystem();
|
||||
|
||||
int len = lines.Length;
|
||||
string[] titles = { "Name", "Description", "Plugin Type", "Libraries" };
|
||||
|
||||
@@ -62,15 +62,6 @@ namespace PluginManager.Others
|
||||
else
|
||||
Console.Write(progress.ToString() + $"{speed} {unit}/s ");
|
||||
|
||||
//if (r == false)
|
||||
//Update(progress, true);
|
||||
|
||||
}
|
||||
|
||||
public void Finish()
|
||||
{
|
||||
Console.Write("\r{0} {1}%", Message, 100);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,13 +123,9 @@ namespace PluginManager.Others
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write text using colors: &g - green, &r - red, &b - blue, &m - magenta, &c - Clear
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="appendNewLine"></param>
|
||||
public static void WriteColorText(string text, bool appendNewLine = true)
|
||||
{
|
||||
|
||||
string[] words = text.Split(' ');
|
||||
ConsoleColor fg = Console.ForegroundColor;
|
||||
Dictionary<string, ConsoleColor> colors = new Dictionary<string, ConsoleColor>()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/// A list with all errors
|
||||
/// </summary>
|
||||
public enum Error
|
||||
{ UNKNOWN_ERROR, GUILD_NOT_FOUND, STREAM_NOT_FOUND }
|
||||
{ UNKNOWN_ERROR, GUILD_NOT_FOUND, STREAM_NOT_FOUND, INVALID_USER, INVALID_CHANNEL, INVALID_PERMISSIONS }
|
||||
|
||||
/// <summary>
|
||||
/// The output log type
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace PluginManager.Others
|
||||
/// Get the Operating system you are runnin on
|
||||
/// </summary>
|
||||
/// <returns>An Operating system</returns>
|
||||
public static OperatingSystem GetOperatinSystem()
|
||||
public static OperatingSystem GetOperatingSystem()
|
||||
{
|
||||
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows)) return OperatingSystem.WINDOWS;
|
||||
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux)) return OperatingSystem.LINUX;
|
||||
|
||||
@@ -14,8 +14,6 @@ public class OnUserJoin : DBEvent
|
||||
public async void Start(Discord.WebSocket.DiscordSocketClient client)
|
||||
{
|
||||
|
||||
|
||||
|
||||
System.IO.Directory.CreateDirectory(UtilsPath);
|
||||
|
||||
if (!System.IO.File.Exists(ConfigFile))
|
||||
@@ -36,7 +34,7 @@ public class OnUserJoin : DBEvent
|
||||
}
|
||||
|
||||
if (Functions.readCodeFromFile(ConfigFile, "Enabled", '=') != "True") return;
|
||||
System.Console.WriteLine("Awaiting user join event ...");
|
||||
//System.Console.WriteLine("Awaiting user join event ...");
|
||||
|
||||
client.UserJoined += Client_UserJoined;
|
||||
|
||||
|
||||
27
TODO
Normal file
27
TODO
Normal file
@@ -0,0 +1,27 @@
|
||||
Discord Bot:
|
||||
✔ Create bootloader
|
||||
✔ Create commands handler
|
||||
|
||||
Plugin Manager:
|
||||
Define plugin interface:
|
||||
✔ DBCommand
|
||||
✔ DBPlugin
|
||||
|
||||
Functions.cs:
|
||||
✔ Read from file
|
||||
✔ Read from archive (PAK)
|
||||
✔ Write Logs & Errors
|
||||
✔ Manipulate settings (files) and strings
|
||||
✔ Stream copy async
|
||||
|
||||
Console Utilities:
|
||||
✔ Progress bar
|
||||
✔ Create table
|
||||
✔ Write to console with colors
|
||||
|
||||
Discord Permissions:
|
||||
✔ Check if user has permission
|
||||
✔ Check if user is owner
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user