This commit is contained in:
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using PluginManager;
|
||||
using PluginManager.Others;
|
||||
using static PluginManager.Others.Functions;
|
||||
|
||||
namespace DiscordBot.Discord.Core
|
||||
@@ -77,17 +76,6 @@ namespace DiscordBot.Discord.Core
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method that stops the bot from running
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task ShutDown()
|
||||
{
|
||||
if (client == null) return;
|
||||
await client.LogoutAsync();
|
||||
await client.StopAsync();
|
||||
}
|
||||
|
||||
private void CommonTasks()
|
||||
{
|
||||
if (client == null) return;
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
<Nullable>disable</Nullable>
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
<SignAssembly>False</SignAssembly>
|
||||
<IsPublishable>True</IsPublishable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -50,9 +50,7 @@ namespace DiscordBot
|
||||
char prefix = Console.ReadLine()[0];
|
||||
|
||||
if (prefix == ' ' || char.IsDigit(prefix)) continue;
|
||||
|
||||
Config.AddValueToVariables("prefix", prefix.ToString(), false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace DiscordBotGUI
|
||||
string current_version = Config.GetValue("Version");
|
||||
if (current_version == null)
|
||||
if (!Config.SetValue("Version", "0"))
|
||||
Config.AddValueToVariables("Version", "0");
|
||||
Config.AddValueToVariables("Version", "0", false);
|
||||
string latest_version = (await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/Version"))[0];
|
||||
_version = latest_version;
|
||||
if (current_version != latest_version) { return true; }
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace DiscordBotGUI
|
||||
return;
|
||||
}
|
||||
|
||||
Functions.WriteToSettings(Functions.dataFolder + "DiscordBotCore.data", "BOT_TOKEN", token, '=');
|
||||
Functions.WriteToSettings(Functions.dataFolder + "DiscordBotCore.data", "BOT_PREFIX", prefix, '=');
|
||||
Config.SetValue("token", token);
|
||||
Config.SetValue("prefix", prefix);
|
||||
RunDiscordBot(args);
|
||||
|
||||
};
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace PluginManager
|
||||
{
|
||||
private static AppConfig appConfig = null;
|
||||
|
||||
public static bool AddValueToVariables(string key, string value, bool isReadOnly)
|
||||
public static bool AddValueToVariables(string key, string value, bool isProtected)
|
||||
{
|
||||
if (appConfig.ApplicationVariables.ContainsKey(key)) return false;
|
||||
appConfig.ApplicationVariables.Add(key, value);
|
||||
if (isReadOnly) appConfig.ProtectedKeyWords.Add(key);
|
||||
if (isProtected) appConfig.ProtectedKeyWords.Add(key);
|
||||
SaveConfig();
|
||||
return true;
|
||||
}
|
||||
@@ -61,7 +61,6 @@ namespace PluginManager
|
||||
{
|
||||
appConfig = await Functions.ConvertFromJson<AppConfig>(path);
|
||||
Functions.WriteLogFile($"Loaded {appConfig.ApplicationVariables.Keys.Count} application variables.\nLoaded {appConfig.ProtectedKeyWords.Count} readonly variables.");
|
||||
//Console.WriteLine($"Loaded {appConfig.ApplicationVariables.Count} application variables !");
|
||||
}
|
||||
else
|
||||
appConfig = new() { ApplicationVariables = new Dictionary<string, string>(), ProtectedKeyWords = new List<string>() };
|
||||
|
||||
Reference in New Issue
Block a user