mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat(commands): show command suggestions if a command was not found
This commit is contained in:
parent
ee45fca6ab
commit
f0d287b873
7 changed files with 58 additions and 23 deletions
|
|
@ -26,10 +26,10 @@ public class Parameters
|
|||
// just used for errors, temporarily
|
||||
public string FullCommand { get; init; }
|
||||
|
||||
public Parameters(string cmd)
|
||||
public Parameters(string prefix, string cmd)
|
||||
{
|
||||
FullCommand = cmd;
|
||||
var result = CommandsMethods.ParseCommand(cmd);
|
||||
var result = CommandsMethods.ParseCommand(prefix, cmd);
|
||||
if (result is CommandResult.Ok)
|
||||
{
|
||||
var command = ((CommandResult.Ok)result).@command;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
|
|||
Parameters parameters;
|
||||
try
|
||||
{
|
||||
parameters = new Parameters(evt.Content?.Substring(cmdStart));
|
||||
parameters = new Parameters(evt.Content?.Substring(0, cmdStart), evt.Content?.Substring(cmdStart));
|
||||
}
|
||||
catch (PKError e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue