diff --git a/Lagrange.Core/Event/EventArg/BotOfflineEvent.cs b/Lagrange.Core/Event/EventArg/BotOfflineEvent.cs index 9c2f2b3e4..46673b036 100644 --- a/Lagrange.Core/Event/EventArg/BotOfflineEvent.cs +++ b/Lagrange.Core/Event/EventArg/BotOfflineEvent.cs @@ -2,5 +2,13 @@ namespace Lagrange.Core.Event.EventArg; public class BotOfflineEvent : EventBase { + public string Tag { get; } + public string Message { get; } + + public BotOfflineEvent(string tag, string message) + { + Tag = tag; + Message = message; + } } \ No newline at end of file diff --git a/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs b/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs index 3e3855fcd..5bcb38ddc 100644 --- a/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs +++ b/Lagrange.Core/Internal/Context/Logic/Implementation/WtExchangeLogic.cs @@ -44,7 +44,7 @@ public override async Task Incoming(ProtocolEvent e) Collection.Log.LogFatal(Tag, "Bot will be offline in 5 seconds..."); await Task.Delay(5000); - Collection.Invoker.PostEvent(new BotOfflineEvent()); // TODO: Fill in the reason of offline + Collection.Invoker.PostEvent(new BotOfflineEvent(kick.Tag, kick.Message)); // TODO: Fill in the reason of offline Collection.Scheduler.Dispose(); break; } diff --git a/Lagrange.Core/Internal/Context/Uploader/FileUploader.cs b/Lagrange.Core/Internal/Context/Uploader/FileUploader.cs index 42689493e..2b5f1f56a 100644 --- a/Lagrange.Core/Internal/Context/Uploader/FileUploader.cs +++ b/Lagrange.Core/Internal/Context/Uploader/FileUploader.cs @@ -1,7 +1,10 @@ +using Lagrange.Core.Internal.Event.Message; using Lagrange.Core.Message; +using Lagrange.Core.Message.Entity; namespace Lagrange.Core.Internal.Context.Uploader; +[HighwayUploader(typeof(FileEntity))] internal class FileUploader : IHighwayUploader { public Task UploadPrivate(ContextCollection context, MessageChain chain, IMessageEntity entity) @@ -9,8 +12,12 @@ public Task UploadPrivate(ContextCollection context, MessageChain chain, IMessag throw new NotImplementedException(); } - public Task UploadGroup(ContextCollection context, MessageChain chain, IMessageEntity entity) + public async Task UploadGroup(ContextCollection context, MessageChain chain, IMessageEntity entity) { - throw new NotImplementedException(); + if (entity is FileEntity { FileStream: not null } file) + { + var uploadEvent = GroupFSUploadEvent.Create(chain.GroupUin ?? 0, file); + var result = await context.Business.SendEvent(uploadEvent); + } } } \ No newline at end of file diff --git a/Lagrange.Core/Internal/Context/Uploader/PttUploader.cs b/Lagrange.Core/Internal/Context/Uploader/PttUploader.cs index 208f9b507..3bb3a0d06 100644 --- a/Lagrange.Core/Internal/Context/Uploader/PttUploader.cs +++ b/Lagrange.Core/Internal/Context/Uploader/PttUploader.cs @@ -1,9 +1,13 @@ using Lagrange.Core.Message; +using Lagrange.Core.Message.Entity; namespace Lagrange.Core.Internal.Context.Uploader; +[HighwayUploader(typeof(RecordEntity))] internal class PttUploader : IHighwayUploader { + private const string Tag = nameof(PttUploader); + public Task UploadPrivate(ContextCollection context, MessageChain chain, IMessageEntity entity) { throw new NotImplementedException();