Updated ICommandAction.cs and DBEvent.cs. Removed thread request from DBEvent and added special thread request to ICommandAction.cs

This commit is contained in:
2024-07-22 19:20:17 +03:00
parent 08c5febd66
commit 8c338820c5
42 changed files with 691 additions and 26 deletions

View File

@@ -24,6 +24,8 @@ namespace DiscordBot.Bot.Actions
];
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public async Task Execute(string[] args)
{

View File

@@ -16,6 +16,8 @@ public class Clear: ICommandAction
public IEnumerable<InternalActionOption> ListOfOptions => [];
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public Task Execute(string[] args)
{

View File

@@ -19,6 +19,8 @@ public class Exit: ICommandAction
new InternalActionOption("force | -f", "Exits the bot without saving the config")
};
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public async Task Execute(string[] args)
{

View File

@@ -26,6 +26,8 @@ public class Help: ICommandAction
];
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public async Task Execute(string[] args)
{

View File

@@ -19,6 +19,8 @@ namespace DiscordBot.Bot.Actions
public IEnumerable<InternalActionOption> ListOfOptions => [];
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public Task Execute(string[] args)
{

View File

@@ -39,6 +39,8 @@ public class Plugin: ICommandAction
};
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public async Task Execute(string[] args)
{

View File

@@ -22,6 +22,9 @@ public class SettingsConfig: ICommandAction
new InternalActionOption("add", "Add a setting")
};
public InternalActionRunType RunType => InternalActionRunType.OnCall;
public bool RequireOtherThread => false;
public Task Execute(string[] args)
{
if (args is null)

View File

@@ -10,6 +10,7 @@
<AssemblyVersion>1.0.4.0</AssemblyVersion>
<PublishAot>False</PublishAot>
<FileVersion>1.0.4.0</FileVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
@@ -35,6 +36,7 @@
<None Remove="builder.sh" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
</ItemGroup>
<ItemGroup>

View File

@@ -5,8 +5,9 @@ using System.Linq;
using System.Reflection;
using DiscordBot.Utilities;
using DiscordBotCore;
using DiscordBotCore.Modules;
using DiscordBotCore.Others;
namespace DiscordBot;
@@ -80,13 +81,17 @@ public static class Entry
static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
{
string requestingAssembly = args.RequestingAssembly?.GetName().Name;
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, $"Libraries/{requestingAssembly}");
var assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
if (!File.Exists(assemblyPath))
return null;
var assembly = Assembly.LoadFrom(assemblyPath);
return assembly;
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, $"Libraries/{requestingAssembly}");
var assemblyName = new AssemblyName(args.Name).Name + ".dll";
var assemblyPath = Path.Combine(folderPath, assemblyName);
if (File.Exists(assemblyPath))
{
var fileAssembly = Assembly.LoadFrom(assemblyPath);
return fileAssembly;
}
return null;
}
Program.Startup(args).Wait();