Restart functions updated
This commit is contained in:
@@ -37,8 +37,23 @@ namespace DiscordBot.Discord.Commands
|
|||||||
{
|
{
|
||||||
if (!DiscordPermissions.hasPermission(message.Author as SocketGuildUser, ds.GuildPermission.Administrator)) return;
|
if (!DiscordPermissions.hasPermission(message.Author as SocketGuildUser, ds.GuildPermission.Administrator)) return;
|
||||||
var args = Functions.GetArguments(message);
|
var args = Functions.GetArguments(message);
|
||||||
if (args.Count != 0)
|
var OS = Functions.GetOperatinSystem();
|
||||||
|
if (args.Count == 0)
|
||||||
{
|
{
|
||||||
|
switch (OS)
|
||||||
|
{
|
||||||
|
case PluginManager.Others.OperatingSystem.WINDOWS:
|
||||||
|
Process.Start("./DiscordBot.exe");
|
||||||
|
break;
|
||||||
|
case PluginManager.Others.OperatingSystem.LINUX:
|
||||||
|
case PluginManager.Others.OperatingSystem.MAC_OS:
|
||||||
|
Process.Start("./DiscordBot");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (args[0])
|
switch (args[0])
|
||||||
{
|
{
|
||||||
case "-p":
|
case "-p":
|
||||||
@@ -49,17 +64,25 @@ namespace DiscordBot.Discord.Commands
|
|||||||
break;
|
break;
|
||||||
case "-cmd":
|
case "-cmd":
|
||||||
case "-args":
|
case "-args":
|
||||||
|
|
||||||
|
switch (OS)
|
||||||
|
{
|
||||||
|
case PluginManager.Others.OperatingSystem.WINDOWS:
|
||||||
Process.Start("./DiscordBot.exe", Functions.MergeStrings(args.ToArray(), 1));
|
Process.Start("./DiscordBot.exe", Functions.MergeStrings(args.ToArray(), 1));
|
||||||
Environment.Exit(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
case PluginManager.Others.OperatingSystem.LINUX:
|
||||||
|
case PluginManager.Others.OperatingSystem.MAC_OS:
|
||||||
|
Process.Start("./DiscordBot", Functions.MergeStrings(args.ToArray(), 1));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Process.Start("./DiscordBot.exe", "--execute:lp");
|
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using PluginManager.LanguageSystem;
|
|||||||
using PluginManager.Online;
|
using PluginManager.Online;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace DiscordBot
|
namespace DiscordBot
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,8 @@ namespace DiscordBot
|
|||||||
private static LanguageManager languageManager = new LanguageManager("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Languages");
|
private static LanguageManager languageManager = new LanguageManager("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Languages");
|
||||||
|
|
||||||
private static bool loadPluginsOnStartup = false;
|
private static bool loadPluginsOnStartup = false;
|
||||||
|
private static bool listPluginsAtStartup = false;
|
||||||
|
private static bool listLanguagAtStartup = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
@@ -76,6 +79,10 @@ namespace DiscordBot
|
|||||||
LoadLanguage();
|
LoadLanguage();
|
||||||
if (loadPluginsOnStartup)
|
if (loadPluginsOnStartup)
|
||||||
LoadPlugins(discordbooter);
|
LoadPlugins(discordbooter);
|
||||||
|
if (listPluginsAtStartup)
|
||||||
|
await manager.ListAvailablePlugins();
|
||||||
|
if (listLanguagAtStartup)
|
||||||
|
await languageManager.ListAllLanguages();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
@@ -97,9 +104,10 @@ namespace DiscordBot
|
|||||||
Console.WriteLine("This command is for windows users ONLY");
|
Console.WriteLine("This command is for windows users ONLY");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Process.Start("./DiscordBot.exe", "--cmd lp");
|
||||||
if (discordbooter.client.ConnectionState == ConnectionState.Connected)
|
if (discordbooter.client.ConnectionState == ConnectionState.Connected)
|
||||||
await discordbooter.ShutDown();
|
await discordbooter.ShutDown();
|
||||||
Process.Start("./DiscordBot", "--execute:lp");
|
else Environment.Exit(0);
|
||||||
break;
|
break;
|
||||||
case "listplugs":
|
case "listplugs":
|
||||||
await manager.ListAvailablePlugins();
|
await manager.ListAvailablePlugins();
|
||||||
@@ -404,15 +412,20 @@ namespace DiscordBot
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 1 && args[0] == "--execute:lp")
|
if (len > 0 && args.Contains("--cmd"))
|
||||||
{
|
{
|
||||||
|
if (args.Contains("lp") || args.Contains("loadplugins"))
|
||||||
loadPluginsOnStartup = true;
|
loadPluginsOnStartup = true;
|
||||||
|
if (args.Contains("listplugs"))
|
||||||
|
listPluginsAtStartup = true;
|
||||||
|
if (args.Contains("listlang"))
|
||||||
|
listLanguagAtStartup = true;
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (len == 0 || args[0] != "--exec" && args[0] != "--execute")
|
if (len == 0 || args[0] != "--exec" && args[0] != "--execute")
|
||||||
{
|
{
|
||||||
Boot b = await StartNoGUI();
|
Boot b = await StartNoGUI();
|
||||||
|
|||||||
@@ -39,5 +39,6 @@ namespace PluginManager.Items
|
|||||||
this.PrefixUsed = data[0][0];
|
this.PrefixUsed = data[0][0];
|
||||||
else this.PrefixUsed = '\0'; //null
|
else this.PrefixUsed = '\0'; //null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user