Skip to content

Commit

Permalink
[OneBot] Supported PokeSegment.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Feb 2, 2024
1 parent eb5f682 commit 1c2d4f5
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 37 deletions.
33 changes: 33 additions & 0 deletions Lagrange.OneBot/Core/Message/Entity/PokeSegment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Text.Json.Serialization;
using Lagrange.Core.Message;
using Lagrange.Core.Message.Entity;

namespace Lagrange.OneBot.Core.Message.Entity;

[Serializable]
public partial class PokeSegment(uint type)
{
public PokeSegment() : this(0) { }

[JsonPropertyName("type")] [CQProperty] public uint Type { get; set; } = type;

[JsonPropertyName("id")] [CQProperty] public uint Id { get; set; }
}

[SegmentSubscriber(typeof(PokeEntity), "poke")]
public partial class PokeSegment : ISegment
{
public IMessageEntity ToEntity() => new PokeEntity(Type);

public void Build(MessageBuilder builder, ISegment segment)
{
if (segment is PokeSegment pokeSegment) builder.Poke(pokeSegment.Type);
}

public ISegment FromEntity(IMessageEntity entity)
{
if (entity is not PokeEntity pokeEntity) throw new ArgumentException("Invalid entity type.");

return new PokeSegment(pokeEntity.Type);
}
}
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ Please use Lagrange.Core responsibly and in accordance with the law.

## Features List

| Protocol | Support | Login | Support | Messages | Support | Operations | Support | Events | Support |
| -------- | :-----: | ------------------------- | :-----: |:----------|:---------:| :---------------- | :-----: | :------------------ | :-----: |
| Windows | 🟢 | QrCode | 🟢 | Images | 🟢 | ~~Poke~~ | 🔴 | Captcha | 🟢 |
| macOS | 🟢 | Password | 🟢 | Text / At | 🟢 | Recall | 🟡 | BotOnline | 🟢 |
| Linux | 🟢 | EasyLogin | 🟢 | Records | 🟡 | Leave Group | 🟢 | BotOffline | 🟢 |
| | | UnusalDevice<br/>Password | 🔴 | QFace | 🟢 | ~~Special Title~~ | 🔴 | Message | 🟢 |
| | | UnusalDevice<br/>Easy | 🟢 | Json | 🟡 | Kick Member | 🟢 | ~~Poke~~ | 🔴 |
| | | NewDeviceVerify | 🔴 | Xml | 🟢 | Mute Member | 🟢 | MessageRecall | 🔴 |
| | | | | Forward | 🟢 | Set Admin | 🟢 | GroupMemberDecrease | 🟢 |
| | | | | Video | 🟡 | Friend Request | 🔴 | GroupMemberIncrease | 🟢 |
| | | | | Reply. | 🟢 | Group Request | 🟢 | GroupPromoteAdmin | 🟢 |
| | | | | File | 🟡 | ~~Voice Call~~ | 🔴 | GroupInvite | 🟢 |
| | | | | Poke | 🟢 | Client Key | 🟢 | GroupRequestJoin | 🔴 |
| | | | | | | Cookies | 🟢 | FriendRequest | 🟢 |
| | | | | | | Send Message | 🟢 | ~~FriendTyping~~ | 🔴 |
| | | | | | | | | ~~FriendVoiceCall~~ | 🔴 |
| Protocol | Support | Login | Support | Messages | Support | Operations | Support | Events | Support |
|----------|:-------:|---------------------------|:-------:|:----------|:-------:|:------------------|:-------:|:--------------------|:-------:|
| Windows | 🟢 | QrCode | 🟢 | Images | 🟢 | ~~Poke~~ | 🔴 | Captcha | 🟢 |
| macOS | 🟢 | Password | 🟢 | Text / At | 🟢 | Recall | 🟡 | BotOnline | 🟢 |
| Linux | 🟢 | EasyLogin | 🟢 | Records | 🟡 | Leave Group | 🟢 | BotOffline | 🟢 |
| | | UnusalDevice<br/>Password | 🔴 | QFace | 🟢 | ~~Special Title~~ | 🔴 | Message | 🟢 |
| | | UnusalDevice<br/>Easy | 🟢 | Json | 🟡 | Kick Member | 🟢 | ~~Poke~~ | 🔴 |
| | | NewDeviceVerify | 🔴 | Xml | 🟢 | Mute Member | 🟢 | MessageRecall | 🔴 |
| | | | | Forward | 🟢 | Set Admin | 🟢 | GroupMemberDecrease | 🟢 |
| | | | | Video | 🟡 | Friend Request | 🔴 | GroupMemberIncrease | 🟢 |
| | | | | Reply. | 🟢 | Group Request | 🟢 | GroupPromoteAdmin | 🟢 |
| | | | | File | 🟡 | ~~Voice Call~~ | 🔴 | GroupInvite | 🟢 |
| | | | | Poke | 🟢 | Client Key | 🟢 | GroupRequestJoin | 🔴 |
| | | | | | | Cookies | 🟢 | FriendRequest | 🟢 |
| | | | | | | Send Message | 🟢 | ~~FriendTyping~~ | 🔴 |
| | | | | | | | | ~~FriendVoiceCall~~ | 🔴 |

## Lagrange.OneBot

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

| Message Segement | Support |
| ---------------- | :-----: |
| [Text] | 🟢 |
| [Face] | 🟢 |
| [Image] | 🟢 |
| [Record] | 🟡 |
| [Video] | 🟡 |
| [At] | 🟢 |
| [Rps] | 🔴 |
| [Dice] | 🔴 |
| [Shake] | 🔴 |
| [Poke] | 🔴 |
| [Anonymous] | 🔴 |
| [Share] | 🔴 |
| [Contact] | 🔴 |
| [Location] | 🔴 |
| [Music] | 🔴 |
| [Reply] | 🔴 |
| [Forward] | 🟢 |
| [Node] | 🟢 |
| [Xml] | 🔴 |
| [Json] | 🔴 |
|------------------|:-------:|
| [Text] | 🟢 |
| [Face] | 🟢 |
| [Image] | 🟢 |
| [Record] | 🟡 |
| [Video] | 🟡 |
| [At] | 🟢 |
| [Rps] | 🔴 |
| [Dice] | 🔴 |
| [Shake] | 🔴 |
| [Poke] | 🟢 |
| [Anonymous] | 🔴 |
| [Share] | 🔴 |
| [Contact] | 🔴 |
| [Location] | 🔴 |
| [Music] | 🔴 |
| [Reply] | 🔴 |
| [Forward] | 🟢 |
| [Node] | 🟢 |
| [Xml] | 🔴 |
| [Json] | 🔴 |

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

0 comments on commit 1c2d4f5

Please sign in to comment.