Skip to content

Commit

Permalink
[Core] Add Push Handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Mar 26, 2024
1 parent e7a3c82 commit c11fd84
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
3 changes: 3 additions & 0 deletions KonataNT/Core/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class BaseClient

internal CacheHandler CacheHandler { get; }

internal PushHandler PushHandler { get; }

internal ILogger Logger { get; init; }

internal BaseClient(BotKeystore keystore, BotConfig config)
Expand All @@ -46,6 +48,7 @@ internal BaseClient(BotKeystore keystore, BotConfig config)
EventEmitter = new EventEmitter(this);
PacketHandler = new PacketHandler(this);
CacheHandler = new CacheHandler(this);
PushHandler = new PushHandler(this);
Logger = config.Logger ?? new DefaultLogger(EventEmitter);
}

Expand Down
30 changes: 30 additions & 0 deletions KonataNT/Core/PushHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using KonataNT.Events;

namespace KonataNT.Core;

internal class PushHandler
{
private readonly BaseClient _client;

private Dictionary<string, Action<byte[]>> _handlerFunction;

public PushHandler(BaseClient client)
{
_client = client;
_handlerFunction = new Dictionary<string, Action<byte[]>>
{
{ "trpc.msg.olpush.OlPushService.MsgPush", ParseMsfPush },
{ "trpc.qq_new_tech.status_svc.StatusService.KickNT", ParseMsfKick }
};
}

private void ParseMsfPush(byte[] packet)
{
throw new NotImplementedException();
}

private void ParseMsfKick(byte[] packet)
{
throw new NotImplementedException();
}
}
3 changes: 1 addition & 2 deletions KonataNT/Message/MessageStruct.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using KonataNT.Utility;

namespace KonataNT.Message;

public class MessageStruct
Expand Down Expand Up @@ -33,5 +31,6 @@ public MessageStruct(uint uin, string name, DateTime messageTime)
{
Sender = (uin, name);
Time = messageTime.ToUniversalTime();
Chain = new MessageChain();
}
}

0 comments on commit c11fd84

Please sign in to comment.