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