Updated functions in Discord Bot

This commit is contained in:
2023-07-30 22:26:43 +03:00
parent 5254be44be
commit b3d6930142
4 changed files with 17 additions and 8 deletions

View File

@@ -32,6 +32,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Net" Version="3.11.0" /> <PackageReference Include="Discord.Net" Version="3.11.0" />
<PackageReference Include="Sodium.Core" Version="1.3.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PluginManager\PluginManager.csproj" /> <ProjectReference Include="..\PluginManager\PluginManager.csproj" />

View File

@@ -51,16 +51,11 @@ public class Config
private readonly string _file = ""; private readonly string _file = "";
private readonly IDictionary<TKey, TValue>? _dictionary; private readonly IDictionary<TKey, TValue>? _dictionary;
/// <summary>
/// Empty constructor
/// </summary>
public Json()
{
_dictionary = new Dictionary<TKey, TValue>();
}
public Json(string file) public Json(string file)
{ {
if (file is null) throw new FileLoadException("The file can not be null");
if(!File.Exists(file))
File.Create(file).Close();
_dictionary = PrivateReadConfig(file).GetAwaiter().GetResult(); _dictionary = PrivateReadConfig(file).GetAwaiter().GetResult();
_file = file; _file = file;
} }

View File

@@ -16,6 +16,7 @@ public static class Functions
{ {
/// <summary> /// <summary>
/// The location for the Resources folder /// The location for the Resources folder
/// String: ./Data/Resources/
/// </summary> /// </summary>
public static readonly string dataFolder = @"./Data/Resources/"; public static readonly string dataFolder = @"./Data/Resources/";
@@ -125,4 +126,9 @@ public static class Functions
Random random = new(); Random random = new();
return values[random.Next(values.Length)]; return values[random.Next(values.Length)];
} }
public static string ToResourcesPath(this string path)
{
return Path.Combine(dataFolder, path);
}
} }

View File

@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SethPlugins", "SethPlugins"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LevelingSystem", "SethPlugins\LevelingSystem\LevelingSystem.csproj", "{4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LevelingSystem", "SethPlugins\LevelingSystem\LevelingSystem.csproj", "{4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MusicPlayer", "SethPlugins\MusicPlayer\MusicPlayer.csproj", "{AF267C51-AF51-44A7-ACF8-D83A2A90CD53}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -29,12 +31,17 @@ Global
{4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}.Debug|Any CPU.Build.0 = Debug|Any CPU {4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}.Release|Any CPU.ActiveCfg = Release|Any CPU {4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}.Release|Any CPU.Build.0 = Release|Any CPU {4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C}.Release|Any CPU.Build.0 = Release|Any CPU
{AF267C51-AF51-44A7-ACF8-D83A2A90CD53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF267C51-AF51-44A7-ACF8-D83A2A90CD53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF267C51-AF51-44A7-ACF8-D83A2A90CD53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF267C51-AF51-44A7-ACF8-D83A2A90CD53}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C} = {78B6D390-F61A-453F-B38D-E4C054321615} {4D2648BB-B56E-4BE9-B3D5-4D6FA4A1472C} = {78B6D390-F61A-453F-B38D-E4C054321615}
{AF267C51-AF51-44A7-ACF8-D83A2A90CD53} = {78B6D390-F61A-453F-B38D-E4C054321615}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF} SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF}