Fixed Internal Actions to refresh after external actions are loaded

This commit is contained in:
2023-08-15 16:17:32 +03:00
parent ee527bb36f
commit 6315d13d18
6 changed files with 59 additions and 16 deletions

View File

@@ -1,4 +1,7 @@
using Discord.Commands;
using System.Linq;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Bot;
namespace PluginManager.Others;
@@ -13,6 +16,30 @@ public class DBCommandExecutingArguments
this.arguments = arguments;
}
public DBCommandExecutingArguments(SocketUserMessage? message, DiscordSocketClient client)
{
this.context = new SocketCommandContext(client, message);
int pos = 0;
if (message.HasMentionPrefix(client.CurrentUser, ref pos))
{
var mentionPrefix = "<@" + client.CurrentUser.Id + ">";
this.cleanContent = message.Content.Substring(mentionPrefix.Length + 1);
}
else
{
this.cleanContent = message.Content.Substring(Config.DiscordBot.botPrefix.Length);
}
var split = this.cleanContent.Split(' ');
string[]? argsClean = null;
if (split.Length > 1)
argsClean = string.Join(' ', split, 1, split.Length - 1).Split(' ');
this.commandUsed = split[0];
this.arguments = argsClean;
}
public SocketCommandContext context { get; init; }
public string cleanContent { get; init; }
public string commandUsed { get; init; }