Skip to content

Commit

Permalink
Merge pull request #77 from Mliybs/2.4
Browse files Browse the repository at this point in the history
修BUG
  • Loading branch information
SinoAHpx authored Jun 8, 2023
2 parents a4efbf0 + eaeaabd commit 913d89b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Mirai.Net/Data/Messages/MessageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public string SerializeToMiraiCode()

case PokeMessage msg:

return $"""
[mirai:poke:{msg.Name switch
var poke = msg.Name switch
{
"Poke" => "戳一戳,1,-1",

Expand All @@ -84,8 +83,9 @@ public string SerializeToMiraiCode()
"FangDaZhao" => "放大招,6,-1",

_ => throw new("该Poke消息还未支持!")
}}]
""";
};

return $"[mirai:poke:{poke}]";

case DiceMessage msg:

Expand Down
3 changes: 2 additions & 1 deletion Mirai.Net/Mirai.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<PropertyGroup>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.4.8</PackageVersion>
<PackageVersion>2.4.9</PackageVersion>
<Title>Mirai.Net</Title>
<LangVersion>latest</LangVersion>
<Description>基于mirai-api-http的轻量级mirai社区sdk</Description>
<Copyright>Copyright 2022 AHpx reserve all rights.</Copyright>
<PackageProjectUrl>https://github.com/SinoAHpx/Mirai.Net</PackageProjectUrl>
Expand Down
21 changes: 20 additions & 1 deletion Mirai.Net/Utils/Scaffolds/MessageChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public string SerializeToMiraiCode()
{
System.Text.StringBuilder builder = new();

this.ForEach(x => x.SerializeToMiraiCode());
this.ForEach(x => builder.Append(x.SerializeToMiraiCode()));

return builder.ToString();
}
Expand Down Expand Up @@ -204,4 +204,23 @@ public static implicit operator MessageChain(string message)
/// <param name="right"></param>
/// <returns></returns>
public static bool operator !=(MessageChain left, MessageChain right) => left == right ? false : true;

/// <summary>
///
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public override bool Equals(object msg)
{
return (object)this == msg;
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return base.GetHashCode();
}
}

0 comments on commit 913d89b

Please sign in to comment.