Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
6b79544
Bumped version
ahpxex Jan 16, 2022
8c4a481
Updated README.md
ahpxex Jan 16, 2022
ff30f6e
Entirely migrate to Manganese, removed all command-related stuff
ahpxex Feb 4, 2022
1e70fd5
Update README.md
ahpxex Feb 17, 2022
e549a25
Added userProfile support
LightQuanta Feb 22, 2022
e143990
Fixed typo
LightQuanta Feb 22, 2022
1d1015e
Merge pull request #29 from LightQuanta/2.4
ahpxex Feb 22, 2022
355ac5a
Added documentation generate
ahpxex Feb 25, 2022
e9dd0a3
Merge remote-tracking branch 'origin/2.4' into 2.4
ahpxex Feb 25, 2022
748d2b4
Adapted AppMessage.cs
ahpxex Feb 25, 2022
ca7d557
Adapted MarketFaceMessage.cs
ahpxex Feb 25, 2022
320b0f1
Added MessageChainBuilder.cs
ahpxex Feb 25, 2022
bef7a48
Added constructor
ahpxex Feb 25, 2022
439eecf
Added MarketFace type
ahpxex Feb 25, 2022
16461c0
Added MessageChain.cs derived from List<MessageBase>
ahpxex Feb 25, 2022
c078935
Use MessageChain.cs instead native .net IEnumerable
ahpxex Feb 25, 2022
008eecc
Fixed multiple enumerable bug
ahpxex Feb 25, 2022
65f9bd3
Override ToString as actually ToJsonString
ahpxex Feb 25, 2022
5b3efde
Removed redundant obsolete attribute, we choose to believe mirai
ahpxex Feb 25, 2022
ec769c0
Added plain message fetcher in MessageChain.cs
ahpxex Feb 25, 2022
9b909f6
Added manually append
ahpxex Feb 25, 2022
deefdf1
Added MiraiCodeMessage.cs definition
ahpxex Feb 25, 2022
b118725
Pending miraicode support
ahpxex Feb 25, 2022
d60011e
Directly escape from value of mirai code
Feb 26, 2022
ab235ee
Added back legacy message chain builder extensions
Feb 26, 2022
56afc8d
Removed redundant methods
Feb 26, 2022
5dbc7f7
Removed mutual converter for MiraiCode and MessageChain
ahpxex Feb 26, 2022
6de6bea
Added another ToMessageChain method
ahpxex Feb 26, 2022
9f4986d
Added implicitly convert for MessageChain and single MessageBase element
ahpxex Feb 26, 2022
45909ca
Bumped version to 2.3.9
ahpxex Feb 26, 2022
6667798
Added brand-new requests handlers
ahpxex Mar 1, 2022
b47bebe
Added some more convenient methods
ahpxex Mar 1, 2022
f50b216
Fixed workflow
ahpxex Mar 1, 2022
ae651ed
Added constraint for GetModule
ahpxex Mar 1, 2022
238dc83
Hidden unused property
ahpxex Mar 1, 2022
12ef786
Added operator overload methods
ahpxex Mar 1, 2022
3290875
Merge remote-tracking branch 'origin/2.4' into 2.4
ahpxex Mar 1, 2022
c2aee8c
Bumped version
ahpxex Mar 1, 2022
e29d590
Added xml summary for inherited Type property
ahpxex Mar 1, 2022
c509511
Accomplished xml summary for bot-self events
ahpxex Mar 1, 2022
c24aae2
Added xml summary for group events
ahpxex Mar 1, 2022
3c0e40e
Added xml summary for message events
ahpxex Mar 1, 2022
0da5ad0
Added xml summary for other client
ahpxex Mar 1, 2022
2681b81
Added xml summary for requests
ahpxex Mar 1, 2022
66930f1
Added xml summary for top-level objects and removed redundant type
ahpxex Mar 1, 2022
6b28e50
Added xml summary for exceptions and removed redundant types
ahpxex Mar 1, 2022
1c340b1
Added summary and renamed non0\-standard named properties
Mar 2, 2022
1f099c8
Added xml summary
Mar 2, 2022
10bab4b
Removed obsoleted types
Mar 2, 2022
e4b82d3
Added summary
Mar 2, 2022
af48095
Added summary
Mar 2, 2022
b1243e0
Added xml summary and renamed non-standard member/type names
Mar 2, 2022
4dba975
Updated readme
Mar 2, 2022
272b592
Merge remote-tracking branch 'origin/2.4' into 2.4
ahpxex Mar 2, 2022
0f7b9ce
Updated
ahpxex Mar 2, 2022
96c0ab9
Updated issue templates
ahpxex Mar 4, 2022
c428eac
Added EnsureSuccess for Upload methods
ahpxex Mar 29, 2022
1d29097
Migrated to Record
ahpxex Apr 21, 2022
64e9fd0
Added constructors for supporting shared components in AtMessage.cs
ahpxex Apr 22, 2022
a2720b2
Refactored MiraiBot.cs
ahpxex Apr 25, 2022
c15e30d
Removed redundant type
ahpxex Apr 25, 2022
da92ea0
Fixed warning
ahpxex Apr 25, 2022
2800f84
Added delayed message manipulations
ahpxex Apr 25, 2022
69464c4
Bumped to 2.4.0
ahpxex Apr 25, 2022
c16a56b
Added ConnectConfig.cs
ahpxex Apr 30, 2022
d62fdf1
Bumped version
ahpxex Apr 30, 2022
2283f81
Fixed improper logic of checking websocket message type
ahpxex May 21, 2022
6fb8ee6
Bumped version and updated dependencies
ahpxex May 21, 2022
3e5bc75
Added UnknownXX response handlers
ahpxex Jun 19, 2022
75e7ed7
Bumped version
ahpxex Jun 19, 2022
e200d1d
Fixed
ahpxex Jun 19, 2022
174062f
Bumped version
ahpxex Jun 19, 2022
2f19d48
update deps
ksharperd Aug 12, 2022
d2fc305
bump version
ksharperd Aug 12, 2022
88886f0
改群号
Aug 16, 2022
dc8a67d
Merge pull request #50 from Yoroion/2.4
ahpxex Aug 16, 2022
6982589
优化排版
Aug 16, 2022
d1ad5ee
删一个逗号
Aug 16, 2022
a107e03
扩展图片属性支持.
ksharperd Aug 16, 2022
3ed4894
修复漫游消息转换逻辑.
ksharperd Aug 16, 2022
36061e4
Merge pull request #51 from Yoroion/2.4
ahpxex Aug 16, 2022
ce2074f
Merge pull request #52 from GodLeaveMe/2.4
ahpxex Aug 20, 2022
92c8cd3
Remvoed redundant files
ahpxex Aug 21, 2022
0425478
remove dynamic.
ksharperd Aug 21, 2022
21d3dbe
Merge pull request #53 from GodLeaveMe/2.4
ksharperd Aug 21, 2022
69d51f4
Added nuget flow
ahpxex Aug 28, 2022
29d2efe
Fixed flow syntax
ahpxex Aug 28, 2022
449918f
修复一处笔误
Cyl18 Sep 8, 2022
9747f79
Merge pull request #55 from Cyl18/patch-1
ahpxex Sep 8, 2022
cbcf84a
Fixed duplicate error
ahpxex Sep 11, 2022
bdac432
Added subscription scaffold
ahpxex Oct 3, 2022
8d16021
Fixed GetMessageReceiverByIdAsync
ahpxex Oct 3, 2022
d5a370e
Fixed SetEssenceMessageAsync
ahpxex Oct 3, 2022
163d244
Fixed message recalling
ahpxex Oct 3, 2022
04a6656
Removed redundant properties
ahpxex Oct 3, 2022
48d5c8d
Added implicit convert for string and message chain
ahpxex Oct 3, 2022
45d8278
Simplified construction of ForwardMessage.cs
ahpxex Oct 3, 2022
9c67d5a
Fixed ambiguous parameters' name
ahpxex Oct 3, 2022
4e68531
Fixed modularization
ahpxex Oct 3, 2022
c1e300b
Bumped version
ahpxex Oct 3, 2022
7ddebca
Fix typo: `MmeberProfile` -> `MemberProfile`.
kyoyama-kazusa Oct 27, 2022
23f022c
Merge pull request #59 from SunnieShine/2.4
ahpxex Oct 30, 2022
c050777
added support for SyncMessage.
ksharperd Nov 15, 2022
4adb93f
Merge pull request #61 from GodLeaveMe/2.4
ksharperd Nov 15, 2022
6a84a1c
support more SyncMessage.
ksharperd Nov 16, 2022
840ee03
Merge pull request #62 from GodLeaveMe/2.4
ksharperd Nov 16, 2022
023d59e
add support for announcement.
ksharperd Nov 16, 2022
0c46502
small fixes.
ksharperd Nov 17, 2022
83da008
Merge pull request #63 from GodLeaveMe/2.4
ksharperd Nov 17, 2022
5e9f44f
update some docs.
ksharperd Nov 17, 2022
08df900
Merge branch '2.4' of https://github.com/GodLeaveMe/Mirai.Net into 2.4
ksharperd Nov 17, 2022
a6cc721
update readme.
ksharperd Nov 17, 2022
2557d20
bump nuget version.
ksharperd Nov 24, 2022
520b2c1
Merge pull request #64 from GodLeaveMe/2.4
ksharperd Nov 24, 2022
3bf6cc3
Updated readme
ahpxex Jan 24, 2023
f984af4
add 'Invitor' in MemberJoinedEvent
ksharperd Feb 4, 2023
00c3633
fix typo.
ksharperd Feb 4, 2023
8d11637
优化反序列化事件、消息, 消息链时获取实例类型的方法, 将指定的类型集合转换为字典, 不需要在每次获取类型时调用类型的GetType方法,…
Feb 7, 2023
fe2ac41
Merge pull request #1 from SukeBann/2.4
ksharperd Feb 7, 2023
91a98ca
Merge pull request #68 from GodLeaveMe/2.4
ksharperd Feb 7, 2023
42b4ea9
add DisbandedEvent
ksharperd Feb 7, 2023
252c32b
add missing file
ksharperd Feb 7, 2023
453b12e
Merge pull request #69 from GodLeaveMe/2.4
ksharperd Feb 7, 2023
9382753
update
Mliybs Jun 4, 2023
5f9ba09
update
Mliybs Jun 8, 2023
a4efbf0
Merge pull request #76 from Mliybs/2.4
ahpxex Jun 8, 2023
24de9dd
修BUG
Mliybs Jun 8, 2023
eaeaabd
还是修BUG
Mliybs Jun 8, 2023
913d89b
Merge pull request #77 from Mliybs/2.4
ahpxex Jun 8, 2023
4e14392
update
Mliybs Jun 9, 2023
0ccf357
统一更新
Mliybs Jul 14, 2023
71f1611
修BUG
Mliybs Jul 14, 2023
e565145
补充注释
Mliybs Jul 14, 2023
7b3ba19
补充
Mliybs Jul 14, 2023
fd8d7ec
修复
Mliybs Jul 14, 2023
82e17ca
修复
Mliybs Jul 14, 2023
68b29dc
修复
Mliybs Jul 14, 2023
b2bb0f3
Merge pull request #78 from Mliybs/2.4
ahpxex Jul 15, 2023
b391ed2
紧急BUG修复
Mliybs Jul 17, 2023
35814dc
Merge pull request #79 from Mliybs/2.4
ksharperd Jul 17, 2023
2f8e469
修正OfErrorMessage的错误提示文字,匹配
Natsukage Oct 12, 2023
8fe2c52
EnsureSuccess时,将MAH返回的msg信息存入exception的Data["msg"]中供后续使用。closes #73.
Natsukage Oct 12, 2023
30ee7f4
将MiraiHttpUtils与其中的PostJsonAsync与GetAsync改为public,closes #74
Natsukage Oct 12, 2023
70be604
修复无法上传中文文件名群文件问题,closes #72
Natsukage Oct 12, 2023
3a52f56
Merge pull request #85 from Natsukage/2.4
ahpxex Oct 14, 2023
fef9e6b
dump dependencies version.
ksharperd Jan 3, 2024
b9112f2
[Breaking Change] Genericize send message.
ksharperd Dec 8, 2023
a816154
fix doc.
ksharperd Dec 8, 2023
b5f5500
del duplicate text.
ksharperd Dec 8, 2023
435a9ff
bump dependencies version.
ksharperd Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
labels: bug
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]"
labels: ''
labels: enhancement
assignees: ''

---
Expand Down
35 changes: 33 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: .NET

on:
push:
branches: [ "2.2" ]
branches: [ "2.4" ]
pull_request:
branches: [ "2.2" ]
branches: [ "2.4" ]

jobs:
build:
Expand All @@ -21,3 +21,34 @@ jobs:
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Push package
run: |
# Grab some versioning information
commithash=$(git rev-parse --short HEAD)
currtime=$(date +%s)
echo "commit hash is $commithash"
echo "time is $currtime"

# Enter project directory
cd Mirai.Net

# Build package
dotnet restore
dotnet build

# Pack a nuget package with all the default config
dotnet pack

# Enter package output directory
cd bin/Debug

# Getting file named with .nupkg extension
file=""
cdir=`ls ./*.nupkg`
for eachfile in $cdir
do
file=$eachfile
done

# Push it to source "nuget"
dotnet nuget push $file --api-key ${{ secrets.NUGET_KEY }} --source "nuget" --skip-duplicate
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
/_ReSharper.Caches/
/.vs/
/MSBuild_Logs
4 changes: 0 additions & 4 deletions .idea/.idea.Mirai.Net/.idea/encodings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/.idea.Mirai.Net/.idea/indexLayout.xml

This file was deleted.

36 changes: 0 additions & 36 deletions .idea/.idea.Mirai.Net/.idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/.idea.Mirai.Net/.idea/projectSettingsUpdater.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/.idea.Mirai.Net/.idea/statistic.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/.idea.Mirai.Net/.idea/vcs.xml

This file was deleted.

4 changes: 2 additions & 2 deletions Mirai.Net.Test/Mirai.Net.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand All @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.0-preview1" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

</Project>
22 changes: 9 additions & 13 deletions Mirai.Net.Test/Module1.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Linq;
using Mirai.Net.Data.Commands;
using Mirai.Net.Data.Messages;
using Mirai.Net.Data.Messages.Concretes;
using Mirai.Net.Data.Messages.Receivers;
using Mirai.Net.Data.Modules;
using Mirai.Net.Modules;
using Mirai.Net.Utils.Scaffolds;

Expand All @@ -15,23 +13,21 @@ public class Module1 : IModule
public async void Execute(MessageReceiverBase @base)
{
var receiver = @base.Concretize<GroupMessageReceiver>();
if (receiver.Sender.Id != "2933170747")
{
return;
}
var plain = receiver.MessageChain.GetPlainMessage();

if (plain.CanExecute<SayCommand>())
if (plain == "/off")
{
var command = receiver.MessageChain.GetPlainMessage().ParseCommand<SayCommand>();
await receiver.SendMessageAsync(command.Value);
IsEnable = false;
await receiver.SendMessageAsync("Current module will be turned off");
return;
}

await receiver.SendMessageAsync(plain);
}

public bool? IsEnable { get; set; }

[CommandEntity(Name = "say", Identifier = "/")]
class SayCommand
{
[CommandArgument(Name = "v", IsRequired = true)]
public string Value { get; set; }
}
}
}
53 changes: 15 additions & 38 deletions Mirai.Net.Test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using AHpx.Extensions.JsonExtensions;
using AHpx.Extensions.StringExtensions;
using Flurl;
using Mirai.Net.Data.Commands;
using Mirai.Net.Data.Events.Concretes.Message;
using Manganese.Array;
using Manganese.Text;
using Mirai.Net.Data.Events.Concretes.Request;
using Mirai.Net.Data.Messages;
using Mirai.Net.Data.Messages.Concretes;
using Mirai.Net.Data.Messages.Receivers;
using Mirai.Net.Data.Modules;
using Mirai.Net.Data.Sessions;
using Mirai.Net.Data.Shared;
using Mirai.Net.Sessions;
using Mirai.Net.Sessions.Http.Managers;
using Mirai.Net.Utils;
using Mirai.Net.Utils.Internal;
using Mirai.Net.Utils.Scaffolds;
using Newtonsoft.Json;

namespace Mirai.Net.Test
{
Expand All @@ -29,43 +25,24 @@ private static async Task Main()
{
var exit = new ManualResetEvent(false);

using var bot = new MiraiBot
var bot = new MiraiBot
{
Address = "localhost:8080",
Address = new ConnectConfig
{
HttpAddress = new ConnectConfig.AdapterConfig("localhost", "8080"),
WebsocketAddress = new ConnectConfig.AdapterConfig("localhost", "8080")
},
VerifyKey = "1145141919810",
QQ = "2672886221"
QQ = "1590454991"
};

await bot.LaunchAsync();

var modules = new Module1().GetModules();

bot.MessageReceived
.OfType<GroupMessageReceiver>()
.Subscribe(async r =>
{
modules.SubscribeModule(r);
bot.MessageReceived.WithModules(modules);

// await r.SendMessageAsync(r.MessageChain.Append());
});

Console.WriteLine("launched");
exit.WaitOne();
}
}

[CommandEntity(Name = "test")]
class TestCommand
{
[CommandArgument(Name = "arg1")]
public string Arg1 { get; set; }

[CommandArgument(Name = "arg2", Default = 114514)]
public int Arg2 { get; set; }

[CommandArgument(Name = "arg3")]
public string[] Arg3 { get; set; }

[CommandArgument(Name = "arg4")]
public bool Arg4 { get; set; }
}
}
35 changes: 4 additions & 31 deletions Mirai.Net.UnitTest/CommandShould.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Mirai.Net.Data.Commands;
using Mirai.Net.Utils.Scaffolds;

using Xunit;

namespace Mirai.Net.UnitTest;
Expand All @@ -18,7 +17,7 @@ public class CommandShould
[InlineData("/test-arg4 awd awd -arg5 114.514")]
public void CanExecute(string command)
{
Assert.True(command.CanExecute<TestClass>());

}

[Theory]
Expand All @@ -30,39 +29,13 @@ public void CanExecute(string command)
[InlineData("/test -arg2 a -arg4 -arg5 awd")]
public void CantExecute(string command)
{
Assert.False(command.CanExecute<TestClass>());
}

[CommandEntity(Name = "test")]
class TestClass
{
[CommandArgument(Name = "arg1")]
public string Arg1 { get; set; }

[CommandArgument(Name = "arg2")]
public int Arg2 { get; set; }

[CommandArgument(Name = "arg3")]
public string[] Arg3 { get; set; }

[CommandArgument(Name = "arg4")]
public bool Arg4 { get; set; }

[CommandArgument(Name = "arg5")]
public double Arg5 { get; set; }
}

[CommandEntity(Name = "test")]
class DefaultClass
{
[CommandArgument(Name = "arg4", IsRequired = true)]
public bool Arg4 { get; set; }
}


[Fact]
public void CantExecuteDefault()
{
Assert.False("/test -arg4".CanExecute<DefaultClass>());

}

}
10 changes: 5 additions & 5 deletions Mirai.Net.UnitTest/Mirai.Net.UnitTest.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand All @@ -10,13 +10,13 @@

<ItemGroup>
<PackageReference Include="AHpx.Extensions" Version="1.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.0.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading