Skip to content

Commit

Permalink
release: 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukari316 committed Sep 22, 2023
1 parent 0592e7f commit 9b0458a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions Sora/Command/CommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,24 @@ public void MappingCommands(Assembly assembly)
return;

//查找所有的指令集
Dictionary<Type, MethodInfo[]> cmdSeries = assembly.GetExportedTypes()
//获取指令组
.Where(type => type.IsDefined(typeof(CommandSeries), false)
&& type.IsClass)
.Select(type => (type,
type.GetMethods() //指令参数方法合法性检查
.Where(method => method
.CheckCommandMethodLegality())
.ToArray()))
.ToDictionary(methods => methods.type,
methods => methods.Item2);
Dictionary<Type, MethodInfo[]> cmdSeries =
assembly.GetExportedTypes()
//获取指令组
.Where(type => type.IsDefined(typeof(CommandSeries), false)
&& type.IsClass)
//指令参数方法合法性检查
.Select(type => (type, type.GetMethods()
.Where(method => method.CheckCommandMethodLegality()).ToArray()))
//将每个类的方法整合
.ToDictionary(methods => methods.type,
methods => methods.Item2);

foreach ((Type classType, MethodInfo[] methodInfos) in cmdSeries)
{
//获取指令属性
CommandSeries seriesAttr = classType.GetCustomAttribute(typeof(CommandSeries)) as CommandSeries
?? throw new
NullReferenceException("CommandSeries attribute is null with unknown reason");
CommandSeries seriesAttr =
classType.GetCustomAttribute(typeof(CommandSeries)) as CommandSeries
?? throw new NullReferenceException("CommandSeries attribute is null with unknown reason");

string prefix = string.IsNullOrEmpty(seriesAttr.GroupPrefix) ? string.Empty : seriesAttr.GroupPrefix;
string seriesName = string.IsNullOrEmpty(seriesAttr.SeriesName) ? classType.Name : seriesAttr.SeriesName;
Expand Down Expand Up @@ -407,7 +407,7 @@ internal async ValueTask CommandAdapter(BaseMessageEventArgs eventArgs)
if (commandInfo.InstanceType != null)
if (!GetInstance(commandInfo.InstanceType, out instance))
{
Log.Error("Command",$"获取指令实例失败 [t:{commandInfo.InstanceType}]");
Log.Error("Command", $"获取指令实例失败 [t:{commandInfo.InstanceType}]");
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion Sora/Sora.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Version>1.4.0</Version>
<Version>1.4.1</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Description>.Net 6异步Onebot机器人框架</Description>
Expand Down
2 changes: 1 addition & 1 deletion Sora/VersionCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class VersionCode
/// <summary>
/// 版本号
/// </summary>
public const string VERSION = "1.4.0";
public const string VERSION = "1.4.1";

/// <summary>
/// Onebot版本
Expand Down

0 comments on commit 9b0458a

Please sign in to comment.