mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Medusa System Added
Read about the medusa system [here](https://nadekobot.readthedocs.io/en/latest/medusa/creating-a-medusa/)
This commit is contained in:
9
src/NadekoBot/Common/Medusa/Models/ParamData.cs
Normal file
9
src/NadekoBot/Common/Medusa/Models/ParamData.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Nadeko.Medusa;
|
||||
|
||||
public sealed record ParamData(
|
||||
Type Type,
|
||||
string Name,
|
||||
bool IsOptional,
|
||||
bool IsLeftover,
|
||||
bool IsParams
|
||||
);
|
14
src/NadekoBot/Common/Medusa/Models/ResolvedMedusa.cs
Normal file
14
src/NadekoBot/Common/Medusa/Models/ResolvedMedusa.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
|
||||
public sealed record ResolvedMedusa(
|
||||
WeakReference<MedusaAssemblyLoadContext> LoadContext,
|
||||
IImmutableList<ModuleInfo> ModuleInfos,
|
||||
IImmutableList<SnekInfo> SnekInfos,
|
||||
IMedusaStrings Strings,
|
||||
Dictionary<Type, TypeReader> TypeReaders,
|
||||
IReadOnlyCollection<ICustomBehavior> Execs)
|
||||
{
|
||||
public IServiceProvider Services { get; set; } = null!;
|
||||
}
|
41
src/NadekoBot/Common/Medusa/Models/SnekCommandData.cs
Normal file
41
src/NadekoBot/Common/Medusa/Models/SnekCommandData.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Reflection;
|
||||
using CommandStrings = Nadeko.Snake.CommandStrings;
|
||||
|
||||
namespace Nadeko.Medusa;
|
||||
|
||||
public sealed class SnekCommandData
|
||||
{
|
||||
public SnekCommandData(
|
||||
IReadOnlyCollection<string> aliases,
|
||||
MethodInfo methodInfo,
|
||||
Snek module,
|
||||
FilterAttribute[] filters,
|
||||
CommandContextType contextType,
|
||||
IReadOnlyList<Type> injectedParams,
|
||||
IReadOnlyList<ParamData> parameters,
|
||||
CommandStrings strings,
|
||||
int priority)
|
||||
{
|
||||
Aliases = aliases;
|
||||
MethodInfo = methodInfo;
|
||||
Module = module;
|
||||
Filters = filters;
|
||||
ContextType = contextType;
|
||||
InjectedParams = injectedParams;
|
||||
Parameters = parameters;
|
||||
Priority = priority;
|
||||
OptionalStrings = strings;
|
||||
}
|
||||
|
||||
public CommandStrings OptionalStrings { get; set; }
|
||||
|
||||
public IReadOnlyCollection<string> Aliases { get; }
|
||||
public MethodInfo MethodInfo { get; set; }
|
||||
public Snek Module { get; set; }
|
||||
public FilterAttribute[] Filters { get; set; }
|
||||
public CommandContextType ContextType { get; }
|
||||
public IReadOnlyList<Type> InjectedParams { get; }
|
||||
public IReadOnlyList<ParamData> Parameters { get; }
|
||||
public int Priority { get; }
|
||||
}
|
11
src/NadekoBot/Common/Medusa/Models/SnekData.cs
Normal file
11
src/NadekoBot/Common/Medusa/Models/SnekData.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Nadeko.Medusa;
|
||||
|
||||
public sealed record SnekInfo(
|
||||
string Name,
|
||||
SnekInfo? Parent,
|
||||
Snek Instance,
|
||||
IReadOnlyCollection<SnekCommandData> Commands,
|
||||
IReadOnlyCollection<FilterAttribute> Filters)
|
||||
{
|
||||
public List<SnekInfo> Subsneks { get; set; } = new();
|
||||
}
|
Reference in New Issue
Block a user