Fixed some text and added some missing texts to commands. Added new command to clear screen and formated code.
This commit is contained in:
20
DiscordBot/Bot/Actions/Clear.cs
Normal file
20
DiscordBot/Bot/Actions/Clear.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Others;
|
||||
|
||||
namespace DiscordBot.Bot.Actions;
|
||||
|
||||
public class Clear : ICommandAction
|
||||
{
|
||||
public string ActionName => "clear";
|
||||
public string Description => "Clears the console";
|
||||
public string Usage => "clear";
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
|
||||
public Task Execute(string[] args)
|
||||
{
|
||||
Console.Clear();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -8,15 +8,16 @@ namespace DiscordBot.Bot.Actions;
|
||||
|
||||
public class Exit : ICommandAction
|
||||
{
|
||||
public string ActionName => "exit";
|
||||
public string Description => "Exits the bot and saves the config. Use exit help for more info.";
|
||||
public string Usage => "exit [help|force]";
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
public string ActionName => "exit";
|
||||
public string Description => "Exits the bot and saves the config. Use exit help for more info.";
|
||||
public string Usage => "exit [help|force]";
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
|
||||
public async Task Execute(string[] args)
|
||||
{
|
||||
if (args is null || args.Length == 0)
|
||||
{
|
||||
Config.Logger.Log("Exiting...", "Exit", LogLevel.INFO);
|
||||
Config.Logger.Log("Exiting...", "Exit");
|
||||
Config.Data.Save();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
@@ -29,12 +30,12 @@ public class Exit : ICommandAction
|
||||
Console.WriteLine("help : Displays this message");
|
||||
Console.WriteLine("force : Exits the bot without saving the config");
|
||||
break;
|
||||
|
||||
|
||||
case "force":
|
||||
Config.Logger.Log("Exiting...", "Exit", LogLevel.INFO);
|
||||
Config.Logger.Log("Exiting...", "Exit");
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Console.WriteLine("Invalid argument !");
|
||||
break;
|
||||
|
||||
@@ -1,62 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PluginManager.Others;
|
||||
using DiscordBot.Utilities;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Others;
|
||||
|
||||
namespace DiscordBot.Bot.Actions
|
||||
namespace DiscordBot.Bot.Actions;
|
||||
|
||||
public class Help : ICommandAction
|
||||
{
|
||||
public class Help : ICommandAction
|
||||
public string ActionName => "help";
|
||||
|
||||
public string Description => "Shows the list of commands and their usage";
|
||||
|
||||
public string Usage => "help [command]";
|
||||
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
|
||||
public async Task Execute(string[] args)
|
||||
{
|
||||
public string ActionName => "help";
|
||||
|
||||
public string Description => "Shows the list of commands and their usage";
|
||||
|
||||
public string Usage => "help [command]";
|
||||
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
|
||||
public async Task Execute(string[] args)
|
||||
if (args == null || args.Length == 0)
|
||||
{
|
||||
if (args == null || args.Length == 0)
|
||||
var items = new List<string[]>
|
||||
{
|
||||
var items = new List<string[]>
|
||||
{
|
||||
new[] { "-", "-", "-" },
|
||||
new[] { "Command", "Usage", "Description" },
|
||||
new[] { "-", "-", "-" }
|
||||
};
|
||||
new[] { "-", "-", "-" },
|
||||
new[] { "Command", "Usage", "Description" },
|
||||
new[] { "-", "-", "-" }
|
||||
};
|
||||
|
||||
foreach (var a in Program.internalActionManager.Actions)
|
||||
{
|
||||
items.Add(new[] { a.Key, a.Value.Usage, a.Value.Description });
|
||||
}
|
||||
foreach (var a in Program.internalActionManager.Actions)
|
||||
items.Add(new[] { a.Key, a.Value.Usage, a.Value.Description });
|
||||
|
||||
items.Add(new[] { "-", "-", "-" });
|
||||
items.Add(new[] { "-", "-", "-" });
|
||||
|
||||
DiscordBot.Utilities.Utilities.FormatAndAlignTable(items, Utilities.TableFormat.CENTER_EACH_COLUMN_BASED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Program.internalActionManager.Actions.ContainsKey(args[0]))
|
||||
{
|
||||
Console.WriteLine("Command not found");
|
||||
return;
|
||||
}
|
||||
|
||||
var action = Program.internalActionManager.Actions[args[0]];
|
||||
var actionData = new List<string[]>
|
||||
{
|
||||
new[] { "-", "-", "-" },
|
||||
new[] { "Command", "Usage", "Description" },
|
||||
new[] { "-", "-", "-"},
|
||||
new[] { action.ActionName, action.Usage, action.Description },
|
||||
new[] { "-", "-", "-" }
|
||||
};
|
||||
|
||||
DiscordBot.Utilities.Utilities.FormatAndAlignTable(actionData, Utilities.TableFormat.CENTER_EACH_COLUMN_BASED);
|
||||
Utilities.Utilities.FormatAndAlignTable(items,
|
||||
TableFormat.CENTER_EACH_COLUMN_BASED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Program.internalActionManager.Actions.ContainsKey(args[0]))
|
||||
{
|
||||
Console.WriteLine("Command not found");
|
||||
return;
|
||||
}
|
||||
|
||||
var action = Program.internalActionManager.Actions[args[0]];
|
||||
var actionData = new List<string[]>
|
||||
{
|
||||
new[] { "-", "-", "-" },
|
||||
new[] { "Command", "Usage", "Description" },
|
||||
new[] { "-", "-", "-" },
|
||||
new[] { action.ActionName, action.Usage, action.Description },
|
||||
new[] { "-", "-", "-" }
|
||||
};
|
||||
|
||||
Utilities.Utilities.FormatAndAlignTable(actionData,
|
||||
TableFormat.CENTER_EACH_COLUMN_BASED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using DiscordBot.Utilities;
|
||||
using PluginManager;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Loaders;
|
||||
using PluginManager.Online;
|
||||
@@ -10,12 +12,11 @@ namespace DiscordBot.Bot.Actions;
|
||||
|
||||
public class Plugin : ICommandAction
|
||||
{
|
||||
public string ActionName => "plugin";
|
||||
public string Description => "Manages plugins. Use plugin help for more info.";
|
||||
public string Usage => "plugin [help|list|load|install]";
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
|
||||
private bool pluginsLoaded = false;
|
||||
private bool pluginsLoaded;
|
||||
public string ActionName => "plugin";
|
||||
public string Description => "Manages plugins. Use plugin help for more info.";
|
||||
public string Usage => "plugin [help|list|load|install]";
|
||||
public InternalActionRunType RunType => InternalActionRunType.ON_CALL;
|
||||
|
||||
public async Task Execute(string[] args)
|
||||
{
|
||||
@@ -33,32 +34,30 @@ public class Plugin : ICommandAction
|
||||
switch (args[0])
|
||||
{
|
||||
case "list":
|
||||
var manager = new PluginManager.Online.PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
||||
var manager =
|
||||
new PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
||||
|
||||
var data = await manager.GetAvailablePlugins();
|
||||
var items = new List<string[]>
|
||||
{
|
||||
new[] { "-", "-", "-", "-" },
|
||||
new[] { "Name", "Type", "Description", "Required" },
|
||||
new[] { "Name", "Description", "Type", "Version" },
|
||||
new[] { "-", "-", "-", "-" }
|
||||
};
|
||||
|
||||
foreach (var plugin in data)
|
||||
{
|
||||
items.Add(new[] { plugin[0], plugin[1], plugin[2], plugin[3] });
|
||||
}
|
||||
foreach (var plugin in data) items.Add(new[] { plugin[0], plugin[1], plugin[2], plugin[3] });
|
||||
|
||||
items.Add(new[] { "-", "-", "-", "-" });
|
||||
|
||||
Utilities.Utilities.FormatAndAlignTable(items, Utilities.TableFormat.DEFAULT);
|
||||
Utilities.Utilities.FormatAndAlignTable(items, TableFormat.DEFAULT);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case "load":
|
||||
if (pluginsLoaded)
|
||||
break;
|
||||
var loader = new PluginLoader(PluginManager.Config.DiscordBot.client);
|
||||
var cc = Console.ForegroundColor;
|
||||
var loader = new PluginLoader(Config.DiscordBot.client);
|
||||
var cc = Console.ForegroundColor;
|
||||
loader.onCMDLoad += (name, typeName, success, exception) =>
|
||||
{
|
||||
if (name == null || name.Length < 2)
|
||||
@@ -122,33 +121,34 @@ public class Plugin : ICommandAction
|
||||
|
||||
loader.LoadPlugins();
|
||||
Console.ForegroundColor = cc;
|
||||
pluginsLoaded = true;
|
||||
pluginsLoaded = true;
|
||||
break;
|
||||
|
||||
|
||||
case "install":
|
||||
string pluginName = string.Join(' ', args, 1, args.Length-1);
|
||||
if (string.IsNullOrEmpty(pluginName)|| pluginName.Length < 2)
|
||||
var pluginName = string.Join(' ', args, 1, args.Length - 1);
|
||||
if (string.IsNullOrEmpty(pluginName) || pluginName.Length < 2)
|
||||
{
|
||||
Console.WriteLine("Please specify a plugin name");
|
||||
break;
|
||||
}
|
||||
|
||||
var pluginManager = new PluginManager.Online.PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
||||
string[] pluginData = await pluginManager.GetPluginLinkByName(pluginName);
|
||||
|
||||
var pluginManager =
|
||||
new PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
||||
var pluginData = await pluginManager.GetPluginLinkByName(pluginName);
|
||||
if (pluginData == null || pluginData.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Plugin not found");
|
||||
break;
|
||||
}
|
||||
|
||||
string pluginType = pluginData[0];
|
||||
string pluginLink = pluginData[1];
|
||||
string pluginRequirements = pluginData[2];
|
||||
|
||||
|
||||
var pluginType = pluginData[0];
|
||||
var pluginLink = pluginData[1];
|
||||
var pluginRequirements = pluginData[2];
|
||||
|
||||
|
||||
Console.WriteLine("Downloading plugin...");
|
||||
//download plugin progress bar for linux and windows terminals
|
||||
Utilities.Utilities.Spinner spinner = new Utilities.Utilities.Spinner();
|
||||
var spinner = new Utilities.Utilities.Spinner();
|
||||
spinner.Start();
|
||||
await ServerCom.DownloadFileAsync(pluginLink, $"./Data/{pluginType}s/{pluginName}.dll", null);
|
||||
spinner.Stop();
|
||||
@@ -159,18 +159,18 @@ public class Plugin : ICommandAction
|
||||
Console.WriteLine("Plugin installed successfully");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("Downloading plugin requirements...");
|
||||
List<string> requirementsURLs = await ServerCom.ReadTextFromURL(pluginRequirements);
|
||||
var requirementsURLs = await ServerCom.ReadTextFromURL(pluginRequirements);
|
||||
|
||||
foreach (var requirement in requirementsURLs)
|
||||
{
|
||||
if(requirement.Length < 2)
|
||||
if (requirement.Length < 2)
|
||||
continue;
|
||||
string[] reqdata = requirement.Split(',');
|
||||
string url = reqdata[0];
|
||||
string filename = reqdata[1];
|
||||
|
||||
var reqdata = requirement.Split(',');
|
||||
var url = reqdata[0];
|
||||
var filename = reqdata[1];
|
||||
|
||||
Console.WriteLine($"Downloading {filename}... ");
|
||||
spinner.Start();
|
||||
|
||||
@@ -179,7 +179,7 @@ public class Plugin : ICommandAction
|
||||
await Task.Delay(1000);
|
||||
Console.WriteLine("Downloaded " + filename + " successfully");
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("Finished installing " + pluginName + " successfully");
|
||||
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Discord;
|
||||
|
||||
using PluginManager;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Loaders;
|
||||
@@ -56,7 +54,7 @@ internal class Help : DBCommand
|
||||
|
||||
var embedBuilder = new EmbedBuilder();
|
||||
|
||||
var adminCommands = "";
|
||||
var adminCommands = "";
|
||||
var normalCommands = "";
|
||||
|
||||
foreach (var cmd in PluginLoader.Commands)
|
||||
@@ -77,7 +75,7 @@ internal class Help : DBCommand
|
||||
{
|
||||
var embedBuilder = new EmbedBuilder();
|
||||
var cmd = PluginLoader.Commands.Find(p => p.Command == command ||
|
||||
(p.Aliases is not null && p.Aliases.Contains(command)));
|
||||
(p.Aliases is not null && p.Aliases.Contains(command)));
|
||||
if (cmd == null) return null;
|
||||
|
||||
embedBuilder.AddField("Usage", Config.Data["prefix"] + cmd.Usage);
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Loaders;
|
||||
using PluginManager.Others;
|
||||
|
||||
|
||||
|
||||
namespace DiscordBot.Bot.Commands.SlashCommands;
|
||||
|
||||
public class Help : DBSlashCommand
|
||||
{
|
||||
public string Name => "help";
|
||||
public string Name => "help";
|
||||
public string Description => "This command allows you to check all loaded commands";
|
||||
public bool canUseDM => true;
|
||||
public bool canUseDM => true;
|
||||
|
||||
public List<SlashCommandOptionBuilder> Options => new()
|
||||
{
|
||||
new SlashCommandOptionBuilder()
|
||||
.WithName("command")
|
||||
.WithDescription("The command you want to get help for")
|
||||
.WithRequired(false)
|
||||
.WithType(ApplicationCommandOptionType.String)
|
||||
};
|
||||
public List<SlashCommandOptionBuilder> Options =>
|
||||
new()
|
||||
{
|
||||
new SlashCommandOptionBuilder()
|
||||
.WithName("command")
|
||||
.WithDescription("The command you want to get help for")
|
||||
.WithRequired(false)
|
||||
.WithType(ApplicationCommandOptionType.String)
|
||||
};
|
||||
|
||||
public async void ExecuteServer(SocketSlashCommand context)
|
||||
{
|
||||
@@ -32,31 +30,28 @@ public class Help : DBSlashCommand
|
||||
|
||||
embedBuilder.WithTitle("Help Command");
|
||||
embedBuilder.WithColor(Functions.RandomColor);
|
||||
var slashCommands = PluginManager.Loaders.PluginLoader.SlashCommands;
|
||||
var options = context.Data.Options;
|
||||
|
||||
var slashCommands = PluginLoader.SlashCommands;
|
||||
var options = context.Data.Options;
|
||||
|
||||
//Console.WriteLine("Options: " + options.Count);
|
||||
if (options is null || options.Count == 0)
|
||||
{
|
||||
foreach (var slashCommand in slashCommands)
|
||||
{
|
||||
embedBuilder.AddField(slashCommand.Name, slashCommand.Description, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.Count > 0)
|
||||
{
|
||||
string commandName = options.First().Name;
|
||||
var commandName = options.First().Name;
|
||||
var slashCommand = slashCommands.FirstOrDefault(x => x.Name == commandName);
|
||||
if (slashCommand is null)
|
||||
{
|
||||
await context.RespondAsync("Unknown Command " + commandName);
|
||||
return;
|
||||
}
|
||||
|
||||
embedBuilder.AddField(slashCommand.Name, slashCommand.canUseDM,true).WithDescription(slashCommand.Description);
|
||||
|
||||
embedBuilder.AddField(slashCommand.Name, slashCommand.canUseDM, true)
|
||||
.WithDescription(slashCommand.Description);
|
||||
}
|
||||
|
||||
await context.RespondAsync(embed: embedBuilder.Build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
<SignAssembly>False</SignAssembly>
|
||||
<IsPublishable>True</IsPublishable>
|
||||
<AssemblyVersion>1.0.2.2</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Data\**" />
|
||||
<Compile Remove="obj\**" />
|
||||
<Compile Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Data\**" />
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
<EmbeddedResource Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Data\**" />
|
||||
<None Remove="obj\**" />
|
||||
<None Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="3.10.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
<SignAssembly>False</SignAssembly>
|
||||
<IsPublishable>True</IsPublishable>
|
||||
<AssemblyVersion>1.0.2.2</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Data\**" />
|
||||
<Compile Remove="obj\**" />
|
||||
<Compile Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Data\**" />
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
<EmbeddedResource Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Data\**" />
|
||||
<None Remove="obj\**" />
|
||||
<None Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="3.10.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,32 +1,27 @@
|
||||
using PluginManager.Others;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DiscordBot
|
||||
namespace DiscordBot;
|
||||
|
||||
public class Entry
|
||||
{
|
||||
|
||||
public class Entry
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
var currentDomain = AppDomain.CurrentDomain;
|
||||
currentDomain.AssemblyResolve += LoadFromSameFolder;
|
||||
|
||||
static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
|
||||
{
|
||||
AppDomain currentDomain = AppDomain.CurrentDomain;
|
||||
currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder);
|
||||
|
||||
static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
|
||||
{
|
||||
string folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "./Libraries");
|
||||
string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
|
||||
if (!File.Exists(assemblyPath)) return null;
|
||||
Assembly assembly = Assembly.LoadFrom(assemblyPath);
|
||||
|
||||
return assembly;
|
||||
}
|
||||
|
||||
Program.Startup(args);
|
||||
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
|
||||
"./Libraries");
|
||||
var assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
|
||||
if (!File.Exists(assemblyPath)) return null;
|
||||
var assembly = Assembly.LoadFrom(assemblyPath);
|
||||
|
||||
return assembly;
|
||||
}
|
||||
|
||||
Program.Startup(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,89 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using PluginManager;
|
||||
using PluginManager.Others;
|
||||
using PluginManager.Online;
|
||||
|
||||
namespace DiscordBot
|
||||
namespace DiscordBot;
|
||||
|
||||
public static class Installer
|
||||
{
|
||||
public static class Installer
|
||||
public static void GenerateStartupConfig()
|
||||
{
|
||||
Console.WriteLine("Welcome to the SethBot installer !");
|
||||
Console.WriteLine("First, we need to configure the bot. Don't worry, it will be quick !");
|
||||
Console.WriteLine("The following information will be stored in the config.json file in the ./Data/Resources folder. You can change it later from there.");
|
||||
Console.WriteLine("The bot token is required to run the bot. You can get it from the Discord Developer Portal. (https://discord.com/developers/applications)");
|
||||
|
||||
public static void GenerateStartupConfig()
|
||||
if (!Config.Data.ContainsKey("token"))
|
||||
{
|
||||
Console.WriteLine("Welcome to the SethBot installer !");
|
||||
Console.WriteLine("First, we need to configure the bot. Don't worry, it will be quick !");
|
||||
Console.WriteLine("The following information will be stored in the config.json file in the ./Data/Resources folder. You can change it later from there.");
|
||||
Console.WriteLine("The bot token is required to run the bot. You can get it from the Discord Developer Portal. (https://discord.com/developers/applications)");
|
||||
|
||||
if (!Config.Data.ContainsKey("token"))
|
||||
{
|
||||
Console.WriteLine("Please enter the bot token :");
|
||||
var token = Console.ReadLine();
|
||||
Config.Data.Add("token", token);
|
||||
}
|
||||
|
||||
if (!Config.Data.ContainsKey("prefix"))
|
||||
{
|
||||
Console.WriteLine("Please enter the bot prefix :");
|
||||
var prefix = Console.ReadLine();
|
||||
Config.Data.Add("prefix", prefix);
|
||||
}
|
||||
|
||||
if (!Config.Data.ContainsKey("ServerID"))
|
||||
{
|
||||
Console.WriteLine("Please enter the Server ID :");
|
||||
var serverId = Console.ReadLine();
|
||||
Config.Data.Add("ServerID", serverId);
|
||||
}
|
||||
|
||||
Config.Logger.Log("Config Saved", "Installer", LogLevel.INFO);
|
||||
|
||||
Config.Data.Save();
|
||||
|
||||
Console.WriteLine("Config saved !");
|
||||
|
||||
|
||||
Console.WriteLine("Please enter the bot token :");
|
||||
var token = Console.ReadLine();
|
||||
Config.Data.Add("token", token);
|
||||
}
|
||||
|
||||
public static async Task SetupPluginDatabase()
|
||||
if (!Config.Data.ContainsKey("prefix"))
|
||||
{
|
||||
Console.WriteLine("The plugin database is required to run the bot but there is nothing configured yet.");
|
||||
Console.WriteLine("Please select one option : ");
|
||||
Console.WriteLine("1. Download the official database file");
|
||||
Console.WriteLine("2. Create a new (CUSTOM) database file");
|
||||
int choice = 0;
|
||||
Console.Write("Choice : ");
|
||||
choice = int.Parse(Console.ReadLine());
|
||||
if (choice != 1 && choice != 2)
|
||||
Console.WriteLine("Please enter the bot prefix :");
|
||||
var prefix = Console.ReadLine();
|
||||
Config.Data.Add("prefix", prefix);
|
||||
}
|
||||
|
||||
if (!Config.Data.ContainsKey("ServerID"))
|
||||
{
|
||||
Console.WriteLine("Please enter the Server ID :");
|
||||
var serverId = Console.ReadLine();
|
||||
Config.Data.Add("ServerID", serverId);
|
||||
}
|
||||
|
||||
Config.Logger.Log("Config Saved", "Installer");
|
||||
|
||||
Config.Data.Save();
|
||||
|
||||
Console.WriteLine("Config saved !");
|
||||
}
|
||||
|
||||
public static async Task SetupPluginDatabase()
|
||||
{
|
||||
Console.WriteLine("The plugin database is required to run the bot but there is nothing configured yet.");
|
||||
Console.WriteLine("Please select one option : ");
|
||||
Console.WriteLine("1. Download the official database file");
|
||||
Console.WriteLine("2. Create a new (CUSTOM) database file");
|
||||
var choice = 0;
|
||||
Console.Write("Choice : ");
|
||||
choice = int.Parse(Console.ReadLine());
|
||||
if (choice != 1 && choice != 2)
|
||||
{
|
||||
Console.WriteLine("Invalid choice !");
|
||||
Console.WriteLine("Please restart the installer !");
|
||||
Console.ReadKey();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
if (choice == 1)
|
||||
await DownloadPluginDatabase();
|
||||
|
||||
if (choice == 2)
|
||||
{
|
||||
Console.WriteLine("Do you have a url to a valid database file ? (y/n)");
|
||||
var answer = Console.ReadLine();
|
||||
if (answer == "y")
|
||||
{
|
||||
Console.WriteLine("Invalid choice !");
|
||||
Console.WriteLine("Please restart the installer !");
|
||||
Console.ReadKey();
|
||||
Environment.Exit(0);
|
||||
Console.WriteLine("Please enter the url :");
|
||||
var url = Console.ReadLine();
|
||||
await DownloadPluginDatabase(url);
|
||||
return;
|
||||
}
|
||||
|
||||
if (choice == 1)
|
||||
await DownloadPluginDatabase();
|
||||
|
||||
if (choice == 2)
|
||||
Console.WriteLine("Do you want to create a new database file ? (y/n)");
|
||||
answer = Console.ReadLine();
|
||||
if (answer == "y")
|
||||
{
|
||||
Console.WriteLine("Do you have a url to a valid database file ? (y/n)");
|
||||
var answer = Console.ReadLine();
|
||||
if (answer == "y")
|
||||
{
|
||||
Console.WriteLine("Please enter the url :");
|
||||
var url = Console.ReadLine();
|
||||
await DownloadPluginDatabase(url);
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Do you want to create a new database file ? (y/n)");
|
||||
answer = Console.ReadLine();
|
||||
if (answer == "y")
|
||||
{
|
||||
Console.WriteLine("A new file will be generated at ./Data/Resources/URLs.json");
|
||||
System.Console.WriteLine("Please edit the file and restart the bot !");
|
||||
Directory.CreateDirectory("./Data/Resources");
|
||||
await File.WriteAllTextAsync("./Data/Resources/URLs.json",
|
||||
@"
|
||||
Console.WriteLine("A new file will be generated at ./Data/Resources/URLs.json");
|
||||
Console.WriteLine("Please edit the file and restart the bot !");
|
||||
Directory.CreateDirectory("./Data/Resources");
|
||||
await File.WriteAllTextAsync("./Data/Resources/URLs.json",
|
||||
@"
|
||||
{
|
||||
""PluginList"": """",
|
||||
""PluginVersions"": """",
|
||||
@@ -102,21 +95,20 @@ namespace DiscordBot
|
||||
""WindowsLauncher"": """",
|
||||
}
|
||||
".Replace(" ", ""));
|
||||
Environment.Exit(0);
|
||||
return;
|
||||
}
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task DownloadPluginDatabase(string url = "https://raw.githubusercontent.com/Wizzy69/SethDiscordBot/gh-pages/defaultURLs.json")
|
||||
{
|
||||
string path = "./Data/Resources/URLs.json";
|
||||
private static async Task DownloadPluginDatabase(
|
||||
string url = "https://raw.githubusercontent.com/andreitdr/SethDiscordBot/gh-pages/defaultURLs.json")
|
||||
{
|
||||
var path = "./Data/Resources/URLs.json";
|
||||
|
||||
Directory.CreateDirectory("./Data/Resources");
|
||||
Utilities.Utilities.Spinner spinner = new Utilities.Utilities.Spinner();
|
||||
spinner.Start();
|
||||
await ServerCom.DownloadFileAsync(url, path, null);
|
||||
spinner.Stop();
|
||||
}
|
||||
Directory.CreateDirectory("./Data/Resources");
|
||||
var spinner = new Utilities.Utilities.Spinner();
|
||||
spinner.Start();
|
||||
await ServerCom.DownloadFileAsync(url, path, null);
|
||||
spinner.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
using PluginManager;
|
||||
using PluginManager.Bot;
|
||||
using PluginManager.Online;
|
||||
using PluginManager.Online.Helpers;
|
||||
using PluginManager.Others;
|
||||
|
||||
using DiscordBot.Utilities;
|
||||
using PluginManager.Others.Actions;
|
||||
using static PluginManager.Config;
|
||||
using PluginManager.Interfaces;
|
||||
|
||||
namespace DiscordBot;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static Json<string, string> URLs;
|
||||
public static PluginManager.Others.Actions.InternalActionManager internalActionManager;
|
||||
public static Json<string, string> URLs;
|
||||
public static InternalActionManager internalActionManager;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
@@ -30,17 +26,15 @@ public class Program
|
||||
{
|
||||
PreLoadComponents(args).Wait();
|
||||
|
||||
if (!Config.Data.ContainsKey("ServerID") || !Config.Data.ContainsKey("token") ||
|
||||
Config.Data["token"] == null ||
|
||||
(Config.Data["token"]?.Length != 70 && Config.Data["token"]?.Length != 59) ||
|
||||
!Config.Data.ContainsKey("prefix") || Config.Data["prefix"] == null ||
|
||||
Config.Data["prefix"]?.Length != 1 ||
|
||||
if (!Data.ContainsKey("ServerID") || !Data.ContainsKey("token") ||
|
||||
Data["token"] == null ||
|
||||
(Data["token"]?.Length != 70 && Data["token"]?.Length != 59) ||
|
||||
!Data.ContainsKey("prefix") || Data["prefix"] == null ||
|
||||
Data["prefix"]?.Length != 1 ||
|
||||
(args.Length == 1 && args[0] == "/reset"))
|
||||
{
|
||||
Installer.GenerateStartupConfig();
|
||||
}
|
||||
|
||||
HandleInput(args.ToList()).Wait();
|
||||
|
||||
HandleInput(args.ToList()).Wait();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,11 +49,11 @@ public class Program
|
||||
|
||||
while (true)
|
||||
{
|
||||
var cmd = Console.ReadLine();
|
||||
string[] args = cmd.Split(' ');
|
||||
string command = args[0];
|
||||
string cmd = Console.ReadLine();
|
||||
string[] args = cmd.Split(' ');
|
||||
string command = args[0];
|
||||
args = args.Skip(1).ToArray();
|
||||
if(args.Length == 0)
|
||||
if (args.Length == 0)
|
||||
args = null;
|
||||
|
||||
internalActionManager.Execute(command, args).Wait(); // Execute the command
|
||||
@@ -82,40 +76,40 @@ public class Program
|
||||
Console.WriteLine(message);
|
||||
|
||||
Console.WriteLine(
|
||||
$"Running on version: {Assembly.GetExecutingAssembly().GetName().Version}");
|
||||
Console.WriteLine($"Git URL: {Config.Data["GitURL"]}");
|
||||
$"Running on version: {Assembly.GetExecutingAssembly().GetName().Version}");
|
||||
Console.WriteLine($"Git URL: {Data["GitURL"]}");
|
||||
|
||||
Utilities.Utilities.WriteColorText(
|
||||
"&rRemember to close the bot using the ShutDown command (&ysd&r) or some settings won't be saved\n");
|
||||
"&rRemember to close the bot using the ShutDown command (&ysd&r) or some settings won't be saved\n");
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
|
||||
if (Config.Data.ContainsKey("LaunchMessage"))
|
||||
Utilities.Utilities.WriteColorText(Config.Data["LaunchMessage"]);
|
||||
if (Data.ContainsKey("LaunchMessage"))
|
||||
Utilities.Utilities.WriteColorText(Data["LaunchMessage"]);
|
||||
|
||||
|
||||
Utilities.Utilities.WriteColorText(
|
||||
"Please note that the bot saves a backup save file every time you are using the shudown command (&ysd&c)");
|
||||
"Please note that the bot saves a backup save file every time you are using the shudown command (&ysd&c)");
|
||||
|
||||
Console.WriteLine("Running on " + Functions.GetOperatingSystem().ToString());
|
||||
Console.WriteLine("Running on " + Functions.GetOperatingSystem());
|
||||
Console.WriteLine("============================ LOG ============================");
|
||||
|
||||
try
|
||||
{
|
||||
string token = "";
|
||||
var token = "";
|
||||
#if DEBUG
|
||||
if (File.Exists("./Data/Resources/token.txt")) token = File.ReadAllText("./Data/Resources/token.txt");
|
||||
else token = Config.Data["token"];
|
||||
else token = Data["token"];
|
||||
#else
|
||||
token = Config.Data["token"];
|
||||
#endif
|
||||
var prefix = Config.Data["prefix"];
|
||||
var prefix = Data["prefix"];
|
||||
var discordbooter = new Boot(token, prefix);
|
||||
await discordbooter.Awake();
|
||||
return discordbooter;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Config.Logger.Log(ex.ToString(), "Bot", LogLevel.ERROR);
|
||||
Logger.Log(ex.ToString(), "Bot", LogLevel.ERROR);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -126,24 +120,23 @@ public class Program
|
||||
/// <param name="args">The arguments</param>
|
||||
private static async Task HandleInput(List<string> args)
|
||||
{
|
||||
|
||||
Console.WriteLine("Loading Core ...");
|
||||
|
||||
|
||||
//Handle arguments here:
|
||||
|
||||
if(args.Contains("--gui"))
|
||||
|
||||
if (args.Contains("--gui"))
|
||||
{
|
||||
// GUI not implemented yet
|
||||
Console.WriteLine("GUI not implemented yet");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Starting bot after all arguments are handled
|
||||
|
||||
|
||||
var b = await StartNoGui();
|
||||
try
|
||||
{
|
||||
internalActionManager = new PluginManager.Others.Actions.InternalActionManager("./Data/Actions", "*.dll");
|
||||
internalActionManager = new InternalActionManager("./Data/Actions", "*.dll");
|
||||
await internalActionManager.Initialize();
|
||||
|
||||
NoGUI();
|
||||
@@ -152,42 +145,40 @@ public class Program
|
||||
{
|
||||
if (ex.Message == "No process is on the other end of the pipe." || (uint)ex.HResult == 0x800700E9)
|
||||
{
|
||||
if (Config.Data.ContainsKey("LaunchMessage"))
|
||||
Config.Data.Add("LaunchMessage",
|
||||
"An error occured while closing the bot last time. Please consider closing the bot using the &rsd&c method !\nThere is a risk of losing all data or corruption of the save file, which in some cases requires to reinstall the bot !");
|
||||
Config.Logger.Log("An error occured while closing the bot last time. Please consider closing the bot using the &rsd&c method !\nThere is a risk of losing all data or corruption of the save file, which in some cases requires to reinstall the bot !", "Bot", LogLevel.ERROR);
|
||||
if (Data.ContainsKey("LaunchMessage"))
|
||||
Data.Add("LaunchMessage",
|
||||
"An error occured while closing the bot last time. Please consider closing the bot using the &rsd&c method !\nThere is a risk of losing all data or corruption of the save file, which in some cases requires to reinstall the bot !");
|
||||
Logger
|
||||
.Log("An error occured while closing the bot last time. Please consider closing the bot using the &rsd&c method !\nThere is a risk of losing all data or corruption of the save file, which in some cases requires to reinstall the bot !",
|
||||
"Bot", LogLevel.ERROR);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private static async Task PreLoadComponents(string[] args)
|
||||
{
|
||||
|
||||
await Config.Initialize();
|
||||
await Initialize();
|
||||
|
||||
if (!Directory.Exists("./Data/Resources") || !File.Exists("./Data/Resources/URLs.json"))
|
||||
{
|
||||
await Installer.SetupPluginDatabase();
|
||||
}
|
||||
|
||||
|
||||
URLs = new Json<string, string>("./Data/Resources/URLs.json");
|
||||
|
||||
Config.Logger.LogEvent += (message, type) => { Console.WriteLine(message); };
|
||||
Logger.LogEvent += (message, type) => { Console.WriteLine(message); };
|
||||
|
||||
|
||||
Console.WriteLine("Loading resources ...");
|
||||
|
||||
if (Config.Data.ContainsKey("DeleteLogsAtStartup"))
|
||||
if (Config.Data["DeleteLogsAtStartup"] == "true")
|
||||
if (Data.ContainsKey("DeleteLogsAtStartup"))
|
||||
if (Data["DeleteLogsAtStartup"] == "true")
|
||||
foreach (var file in Directory.GetFiles("./Output/Logs/"))
|
||||
File.Delete(file);
|
||||
var OnlineDefaultKeys =
|
||||
await ServerCom.ReadTextFromURL(URLs["SetupKeys"]);
|
||||
|
||||
|
||||
Config.Data["Version"] = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
Data["Version"] = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
|
||||
foreach (var key in OnlineDefaultKeys)
|
||||
{
|
||||
@@ -195,11 +186,11 @@ public class Program
|
||||
var s = key.Split(' ');
|
||||
try
|
||||
{
|
||||
Config.Data[s[0]] = s[1];
|
||||
Data[s[0]] = s[1];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Config.Logger.Log(ex.ToString(), "Bot", LogLevel.ERROR);
|
||||
Logger.Log(ex.ToString(), "Bot", LogLevel.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,27 +204,27 @@ public class Program
|
||||
switch (s[0])
|
||||
{
|
||||
case "CurrentVersion":
|
||||
var currentVersion = Config.Data["Version"];
|
||||
var newVersion = s[1];
|
||||
if(new VersionString(newVersion) != new VersionString(newVersion))
|
||||
var currentVersion = Data["Version"];
|
||||
var newVersion = s[1];
|
||||
if (new VersionString(newVersion) != new VersionString(newVersion))
|
||||
{
|
||||
Console.WriteLine("A new updated was found. Check the changelog for more information.");
|
||||
List<string> changeLog = await ServerCom.ReadTextFromURL(URLs["Changelog"]);
|
||||
var changeLog = await ServerCom.ReadTextFromURL(URLs["Changelog"]);
|
||||
foreach (var item in changeLog)
|
||||
Utilities.Utilities.WriteColorText(item);
|
||||
Console.WriteLine("Current version: " + currentVersion);
|
||||
Console.WriteLine("Latest version: " + newVersion);
|
||||
|
||||
Console.WriteLine($"Download from here: https://github.com/andreitdr/SethDiscordBot/releases");
|
||||
Console.WriteLine("Download from here: https://github.com/andreitdr/SethDiscordBot/releases");
|
||||
|
||||
Console.WriteLine("Press any key to continue ...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Console.Clear();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PluginManager;
|
||||
|
||||
namespace DiscordBot.Utilities;
|
||||
|
||||
public static class Utilities
|
||||
{
|
||||
private static Dictionary<char, ConsoleColor> Colors = new()
|
||||
private static readonly Dictionary<char, ConsoleColor> Colors = new()
|
||||
{
|
||||
{ 'g', ConsoleColor.Green },
|
||||
{ 'b', ConsoleColor.Blue },
|
||||
{ 'r', ConsoleColor.Red },
|
||||
{ 'm', ConsoleColor.Magenta },
|
||||
{ 'y', ConsoleColor.Yellow }
|
||||
{ 'g', ConsoleColor.Green },
|
||||
{ 'b', ConsoleColor.Blue },
|
||||
{ 'r', ConsoleColor.Red },
|
||||
{ 'm', ConsoleColor.Magenta },
|
||||
{ 'y', ConsoleColor.Yellow }
|
||||
};
|
||||
|
||||
private static char ColorPrefix = '&';
|
||||
private static readonly char ColorPrefix = '&';
|
||||
|
||||
|
||||
private static bool CanAproximateTo(this float f, float y)
|
||||
@@ -36,9 +32,9 @@ public static class Utilities
|
||||
{
|
||||
if (format == TableFormat.CENTER_EACH_COLUMN_BASED)
|
||||
{
|
||||
var tableLine = '-';
|
||||
var tableLine = '-';
|
||||
var tableCross = '+';
|
||||
var tableWall = '|';
|
||||
var tableWall = '|';
|
||||
|
||||
var len = new int[data[0].Length];
|
||||
foreach (var line in data)
|
||||
@@ -144,7 +140,7 @@ public static class Utilities
|
||||
|
||||
if (format == TableFormat.DEFAULT)
|
||||
{
|
||||
var widths = new int[data[0].Length];
|
||||
var widths = new int[data[0].Length];
|
||||
var space_between_columns = 3;
|
||||
for (var i = 0; i < data.Count; i++)
|
||||
for (var j = 0; j < data[i].Length; j++)
|
||||
@@ -174,7 +170,7 @@ public static class Utilities
|
||||
public static void WriteColorText(string text, bool appendNewLineAtEnd = true)
|
||||
{
|
||||
var initialForeGround = Console.ForegroundColor;
|
||||
var input = text.ToCharArray();
|
||||
var input = text.ToCharArray();
|
||||
for (var i = 0; i < input.Length; i++)
|
||||
if (input[i] == ColorPrefix)
|
||||
{
|
||||
@@ -201,27 +197,27 @@ public static class Utilities
|
||||
if (appendNewLineAtEnd)
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class Spinner
|
||||
{
|
||||
private Thread thread;
|
||||
private bool isRunning;
|
||||
private readonly string[] Sequence;
|
||||
private int position;
|
||||
private bool isRunning;
|
||||
private int position;
|
||||
private Thread thread;
|
||||
|
||||
public Spinner()
|
||||
{
|
||||
Sequence = new[] {"|", "/", "-", "\\"};
|
||||
Sequence = new[] { "|", "/", "-", "\\" };
|
||||
position = 0;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Console.CursorVisible = false;
|
||||
isRunning=true;
|
||||
thread = new Thread(() => {
|
||||
isRunning = true;
|
||||
thread = new Thread(() =>
|
||||
{
|
||||
while (isRunning)
|
||||
{
|
||||
Console.Write("\r" + Sequence[position]);
|
||||
@@ -233,14 +229,12 @@ public static class Utilities
|
||||
});
|
||||
|
||||
thread.Start();
|
||||
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
isRunning=false;
|
||||
isRunning = false;
|
||||
Console.CursorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace DiscordBot.Utilities;
|
||||
|
||||
namespace DiscordBot.Utilities
|
||||
public enum TableFormat
|
||||
{
|
||||
public enum TableFormat
|
||||
{
|
||||
CENTER_EACH_COLUMN_BASED,
|
||||
CENTER_OVERALL_LENGTH,
|
||||
DEFAULT
|
||||
}
|
||||
CENTER_EACH_COLUMN_BASED,
|
||||
CENTER_OVERALL_LENGTH,
|
||||
DEFAULT
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user