Skip to content

Commit 1c2d4f5

Browse files
LinwenxuanLinwenxuan
authored andcommitted
[OneBot] Supported PokeSegment.cs
1 parent eb5f682 commit 1c2d4f5

File tree

2 files changed

+70
-37
lines changed

2 files changed

+70
-37
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Text.Json.Serialization;
2+
using Lagrange.Core.Message;
3+
using Lagrange.Core.Message.Entity;
4+
5+
namespace Lagrange.OneBot.Core.Message.Entity;
6+
7+
[Serializable]
8+
public partial class PokeSegment(uint type)
9+
{
10+
public PokeSegment() : this(0) { }
11+
12+
[JsonPropertyName("type")] [CQProperty] public uint Type { get; set; } = type;
13+
14+
[JsonPropertyName("id")] [CQProperty] public uint Id { get; set; }
15+
}
16+
17+
[SegmentSubscriber(typeof(PokeEntity), "poke")]
18+
public partial class PokeSegment : ISegment
19+
{
20+
public IMessageEntity ToEntity() => new PokeEntity(Type);
21+
22+
public void Build(MessageBuilder builder, ISegment segment)
23+
{
24+
if (segment is PokeSegment pokeSegment) builder.Poke(pokeSegment.Type);
25+
}
26+
27+
public ISegment FromEntity(IMessageEntity entity)
28+
{
29+
if (entity is not PokeEntity pokeEntity) throw new ArgumentException("Invalid entity type.");
30+
31+
return new PokeSegment(pokeEntity.Type);
32+
}
33+
}

README.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ Please use Lagrange.Core responsibly and in accordance with the law.
3232

3333
## Features List
3434

35-
| Protocol | Support | Login | Support | Messages | Support | Operations | Support | Events | Support |
36-
| -------- | :-----: | ------------------------- | :-----: |:----------|:---------:| :---------------- | :-----: | :------------------ | :-----: |
37-
| Windows | 🟢 | QrCode | 🟢 | Images | 🟢 | ~~Poke~~ | 🔴 | Captcha | 🟢 |
38-
| macOS | 🟢 | Password | 🟢 | Text / At | 🟢 | Recall | 🟡 | BotOnline | 🟢 |
39-
| Linux | 🟢 | EasyLogin | 🟢 | Records | 🟡 | Leave Group | 🟢 | BotOffline | 🟢 |
40-
| | | UnusalDevice<br/>Password | 🔴 | QFace | 🟢 | ~~Special Title~~ | 🔴 | Message | 🟢 |
41-
| | | UnusalDevice<br/>Easy | 🟢 | Json | 🟡 | Kick Member | 🟢 | ~~Poke~~ | 🔴 |
42-
| | | NewDeviceVerify | 🔴 | Xml | 🟢 | Mute Member | 🟢 | MessageRecall | 🔴 |
43-
| | | | | Forward | 🟢 | Set Admin | 🟢 | GroupMemberDecrease | 🟢 |
44-
| | | | | Video | 🟡 | Friend Request | 🔴 | GroupMemberIncrease | 🟢 |
45-
| | | | | Reply. | 🟢 | Group Request | 🟢 | GroupPromoteAdmin | 🟢 |
46-
| | | | | File | 🟡 | ~~Voice Call~~ | 🔴 | GroupInvite | 🟢 |
47-
| | | | | Poke | 🟢 | Client Key | 🟢 | GroupRequestJoin | 🔴 |
48-
| | | | | | | Cookies | 🟢 | FriendRequest | 🟢 |
49-
| | | | | | | Send Message | 🟢 | ~~FriendTyping~~ | 🔴 |
50-
| | | | | | | | | ~~FriendVoiceCall~~ | 🔴 |
35+
| Protocol | Support | Login | Support | Messages | Support | Operations | Support | Events | Support |
36+
|----------|:-------:|---------------------------|:-------:|:----------|:-------:|:------------------|:-------:|:--------------------|:-------:|
37+
| Windows | 🟢 | QrCode | 🟢 | Images | 🟢 | ~~Poke~~ | 🔴 | Captcha | 🟢 |
38+
| macOS | 🟢 | Password | 🟢 | Text / At | 🟢 | Recall | 🟡 | BotOnline | 🟢 |
39+
| Linux | 🟢 | EasyLogin | 🟢 | Records | 🟡 | Leave Group | 🟢 | BotOffline | 🟢 |
40+
| | | UnusalDevice<br/>Password | 🔴 | QFace | 🟢 | ~~Special Title~~ | 🔴 | Message | 🟢 |
41+
| | | UnusalDevice<br/>Easy | 🟢 | Json | 🟡 | Kick Member | 🟢 | ~~Poke~~ | 🔴 |
42+
| | | NewDeviceVerify | 🔴 | Xml | 🟢 | Mute Member | 🟢 | MessageRecall | 🔴 |
43+
| | | | | Forward | 🟢 | Set Admin | 🟢 | GroupMemberDecrease | 🟢 |
44+
| | | | | Video | 🟡 | Friend Request | 🔴 | GroupMemberIncrease | 🟢 |
45+
| | | | | Reply. | 🟢 | Group Request | 🟢 | GroupPromoteAdmin | 🟢 |
46+
| | | | | File | 🟡 | ~~Voice Call~~ | 🔴 | GroupInvite | 🟢 |
47+
| | | | | Poke | 🟢 | Client Key | 🟢 | GroupRequestJoin | 🔴 |
48+
| | | | | | | Cookies | 🟢 | FriendRequest | 🟢 |
49+
| | | | | | | Send Message | 🟢 | ~~FriendTyping~~ | 🔴 |
50+
| | | | | | | | | ~~FriendVoiceCall~~ | 🔴 |
5151

5252
## Lagrange.OneBot
5353

@@ -57,27 +57,27 @@ Please use Lagrange.Core responsibly and in accordance with the law.
5757
<Summary>Message Segement</Summary>
5858

5959
| Message Segement | Support |
60-
| ---------------- | :-----: |
61-
| [Text] | 🟢 |
62-
| [Face] | 🟢 |
63-
| [Image] | 🟢 |
64-
| [Record] | 🟡 |
65-
| [Video] | 🟡 |
66-
| [At] | 🟢 |
67-
| [Rps] | 🔴 |
68-
| [Dice] | 🔴 |
69-
| [Shake] | 🔴 |
70-
| [Poke] | 🔴 |
71-
| [Anonymous] | 🔴 |
72-
| [Share] | 🔴 |
73-
| [Contact] | 🔴 |
74-
| [Location] | 🔴 |
75-
| [Music] | 🔴 |
76-
| [Reply] | 🔴 |
77-
| [Forward] | 🟢 |
78-
| [Node] | 🟢 |
79-
| [Xml] | 🔴 |
80-
| [Json] | 🔴 |
60+
|------------------|:-------:|
61+
| [Text] | 🟢 |
62+
| [Face] | 🟢 |
63+
| [Image] | 🟢 |
64+
| [Record] | 🟡 |
65+
| [Video] | 🟡 |
66+
| [At] | 🟢 |
67+
| [Rps] | 🔴 |
68+
| [Dice] | 🔴 |
69+
| [Shake] | 🔴 |
70+
| [Poke] | 🟢 |
71+
| [Anonymous] | 🔴 |
72+
| [Share] | 🔴 |
73+
| [Contact] | 🔴 |
74+
| [Location] | 🔴 |
75+
| [Music] | 🔴 |
76+
| [Reply] | 🔴 |
77+
| [Forward] | 🟢 |
78+
| [Node] | 🟢 |
79+
| [Xml] | 🔴 |
80+
| [Json] | 🔴 |
8181

8282
[Text]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#qq-%E8%A1%A8%E6%83%85
8383
[Record]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E8%AF%AD%E9%9F%B3

0 commit comments

Comments
 (0)