Updated code formatting
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using DiscordBotCore.Logging;
|
||||
using DiscordBotCore.PluginCore.Helpers;
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbCommand;
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbCommand;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Interfaces;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using DiscordBotCore.PluginCore.Helpers;
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbEvent;
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbEvent;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Interfaces;
|
||||
|
||||
|
||||
@@ -122,7 +122,6 @@ internal class CommandHandler : ICommandHandler
|
||||
|
||||
cleanMessage = message.Content.Substring(mentionPrefix.Length + 1);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
plugin = _pluginLoader.Commands!
|
||||
@@ -137,16 +136,22 @@ internal class CommandHandler : ICommandHandler
|
||||
}
|
||||
|
||||
if (plugin is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.RequireAdmin && !context.Message.Author.IsAdmin())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var split = cleanMessage.Split(' ');
|
||||
|
||||
string[]? argsClean = null;
|
||||
if (split.Length > 1)
|
||||
{
|
||||
argsClean = string.Join(' ', split, 1, split.Length - 1).Split(' ');
|
||||
}
|
||||
|
||||
DbCommandExecutingArgument cmd = new(_logger,
|
||||
context,
|
||||
@@ -162,8 +167,13 @@ internal class CommandHandler : ICommandHandler
|
||||
);
|
||||
|
||||
if (context.Channel is SocketDMChannel)
|
||||
{
|
||||
await plugin.ExecuteDm(cmd);
|
||||
else await plugin.ExecuteServer(cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
await plugin.ExecuteServer(cmd);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DiscordBotApplication : IDiscordBotApplication
|
||||
private CommandService _Service;
|
||||
private readonly ILogger _Logger;
|
||||
private readonly IConfiguration _Configuration;
|
||||
private readonly IPluginLoader _pluginLoader;
|
||||
private readonly IPluginLoader _PluginLoader;
|
||||
|
||||
public bool IsReady { get; private set; }
|
||||
|
||||
@@ -29,9 +29,9 @@ public class DiscordBotApplication : IDiscordBotApplication
|
||||
/// </summary>
|
||||
public DiscordBotApplication(ILogger logger, IConfiguration configuration, IPluginLoader pluginLoader)
|
||||
{
|
||||
this._Logger = logger;
|
||||
this._Logger = logger;
|
||||
this._Configuration = configuration;
|
||||
this._pluginLoader = pluginLoader;
|
||||
this._PluginLoader = pluginLoader;
|
||||
|
||||
_InternalPluginLoader = pluginLoader;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class DiscordBotApplication : IDiscordBotApplication
|
||||
|
||||
await client.StartAsync();
|
||||
|
||||
_CommandServiceHandler = new CommandHandler(_Logger, _pluginLoader, _Configuration, _Service);
|
||||
_CommandServiceHandler = new CommandHandler(_Logger, _PluginLoader, _Configuration, _Service);
|
||||
|
||||
await _CommandServiceHandler.InstallCommandsAsync(client);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class DiscordBotApplication : IDiscordBotApplication
|
||||
private Task LoggedIn()
|
||||
{
|
||||
_Logger.Log("Successfully Logged In", this);
|
||||
_pluginLoader.SetDiscordClient(Client);
|
||||
_PluginLoader.SetDiscordClient(Client);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<base href="/"/>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="bootstrap/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" href="app.css"/>
|
||||
<link rel="stylesheet" href="WebUI.styles.css"/>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="plugins/online">
|
||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Online Plugins
|
||||
<span class="bi bi-list" aria-hidden="true" style="align-self: center"></span> Online Plugins
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="Components/Pages/Home.css" />
|
||||
<div class="container-fluid d-flex flex-column p-3" style="height: 95vh;">
|
||||
<div class="d-flex flex-wrap gap-2 mb-3">
|
||||
|
||||
@@ -13,18 +13,21 @@
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<h3>Installed Plugins</h3>
|
||||
<table class="table table-responsive text-center align-middle">
|
||||
<button class="btn btn-outline-success" @onclick="NavigateToAddPlugin">
|
||||
<span class="bi me-1"></span> Add Local
|
||||
</button>
|
||||
<table class="table table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
<th>Offline Added</th>
|
||||
<th>Actions</th>
|
||||
<th>
|
||||
<button class="btn btn-outline-success" @onclick="NavigateToAddPlugin">
|
||||
<span class="bi me-1"></span> Add Local
|
||||
</button>
|
||||
</th>
|
||||
@* <th> *@
|
||||
@* <button class="btn btn-outline-success" @onclick="NavigateToAddPlugin"> *@
|
||||
@* <span class="bi me-1"></span> Add Local *@
|
||||
@* </button> *@
|
||||
@* </th> *@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -34,14 +37,14 @@
|
||||
<td>@plugin.Name</td>
|
||||
<td>@plugin.Version</td>
|
||||
<td>@(plugin.IsOfflineAdded ? "Yes" : "No")</td>
|
||||
<td>
|
||||
<td >
|
||||
<button class="btn btn-danger btn-sm m-1" @onclick="async () => await DeletePluginButtonClick(plugin)">Delete</button>
|
||||
@if (!plugin.IsOfflineAdded)
|
||||
{
|
||||
<button class="btn btn-info btn-sm m-1" @onclick="async () => await PluginDetailsButtonClick(plugin)">Details</button>
|
||||
}
|
||||
</td>
|
||||
<td></td>
|
||||
@* <td></td> *@
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using WebUI;
|
||||
using WebUI.Components;
|
||||
using WebUI.Services;
|
||||
using WebUI.Components;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
builder.AddDiscordBotComponents();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -13,6 +12,7 @@
|
||||
<ProjectReference Include="..\DiscordBotCore.Logging\DiscordBotCore.Logging.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.PluginManagement\DiscordBotCore.PluginManagement.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore\DiscordBotCore.csproj" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user