├── Mirai-CSharp.NativeAssets.Linux
├── _._
├── runtimes
│ └── linux-x64
│ │ └── native
│ │ └── libsilklame.so
└── Mirai-CSharp.NativeAssets.Linux.props
├── Mirai-CSharp.NativeAssets.LinuxArm
├── _._
├── runtimes
│ ├── linux-arm
│ │ └── native
│ │ │ └── libsilklame.so
│ └── linux-arm64
│ │ └── native
│ │ └── libsilklame.so
└── Mirai-CSharp.NativeAssets.LinuxArm.props
├── Mirai-CSharp.NativeAssets.Win32
├── _._
├── runtimes
│ ├── win-x64
│ │ └── native
│ │ │ └── libsilklame.dll
│ └── win-x86
│ │ └── native
│ │ └── libsilklame.dll
└── Mirai-CSharp.NativeAssets.Win32.props
├── Mirai-CSharp.Example
├── ExamplePlugin.cs
├── Mirai-CSharp.Example.csproj
├── ExamplePlugin.GroupApply.cs
├── ExamplePlugin.NewFriendApply.cs
├── DynamicPlugin.cs
├── ExamplePlugin.Disconnected.cs
└── ExamplePlugin.BotInvitedJoinGroup.cs
├── Mirai-CSharp
├── Models
│ ├── GroupHonorState.cs
│ ├── ChatMessages
│ │ ├── IForwardMessage.cs
│ │ ├── IImageMessage.cs
│ │ ├── IAtAllMessage.cs
│ │ ├── IFlashImageMessage.cs
│ │ ├── IChatMessage.cs
│ │ ├── IDiceMessage.cs
│ │ ├── IAppMessage.cs
│ │ ├── IPokeMessage.cs
│ │ ├── IXmlMessage.cs
│ │ ├── IJsonMessage.cs
│ │ ├── IPlainMessage.cs
│ │ ├── IForwardMessageNode.cs
│ │ ├── IMarketFaceMessage.cs
│ │ ├── IAtMessage.cs
│ │ ├── ISourceMessage.cs
│ │ ├── IFaceMessage.cs
│ │ ├── IVoiceMessage.cs
│ │ ├── IQuoteMessage.cs
│ │ ├── ICommonImageMessage.cs
│ │ └── ISharedMusicMessage.cs
│ ├── IBotProfile.cs
│ ├── IUserProfile.cs
│ ├── IFriendProfile.cs
│ ├── IGroupMemberProfile.cs
│ ├── ImageFormat.cs
│ ├── EventArgs
│ │ ├── IUnknownMessageEventArgs.cs
│ │ ├── Group
│ │ │ ├── IMutedEventArgs.cs
│ │ │ ├── IGroupMemberHonorChangedEventArgs.cs
│ │ │ ├── IGroupMessageEventArgs.cs
│ │ │ ├── Specialized
│ │ │ │ ├── IGroupMemberKickedEventArgs.cs
│ │ │ │ ├── IGroupMemberPositiveLeaveEventArgs.cs
│ │ │ │ ├── IGroupMemberJoinedEventArgs.cs
│ │ │ │ ├── IGroupNameChangedEventArgs.cs
│ │ │ │ ├── IGroupMuteAllChangedEventArgs.cs
│ │ │ │ ├── IGroupConfessTalkChangedEventArgs.cs
│ │ │ │ ├── IGroupAnonymousChatChangedEventArgs.cs
│ │ │ │ ├── IGroupMemberCardChangedEventArgs.cs
│ │ │ │ ├── IGroupMemberInviteChangedEventArgs.cs
│ │ │ │ ├── IGroupEntranceAnnouncementChangedEventArgs.cs
│ │ │ │ ├── IGroupMemberSpecialTitleChangedEventArgs.cs
│ │ │ │ └── IGroupMemberPermissionChangedEventArgs.cs
│ │ │ ├── IGroupMemberUnmutedEventArgs.cs
│ │ │ ├── IGroupMemberMutedEventArgs.cs
│ │ │ ├── IGroupApplyEventArgs.cs
│ │ │ ├── ICommonGroupApplyEventArgs.cs
│ │ │ ├── IGroupDisbandEventArgs.cs
│ │ │ ├── IGroupMessageRevokedEventArgs.cs
│ │ │ ├── IGroupSyncMessageEventArgs.cs
│ │ │ ├── IGroupPropertyChangedEventArgs.cs
│ │ │ └── IGroupMemberPropertyChangedEventArgs.cs
│ │ ├── Friend
│ │ │ ├── IFriendEventArgs.cs
│ │ │ ├── INewFriendApplyEventArgs.cs
│ │ │ ├── IFriendInputStatusChangedEventArgs.cs
│ │ │ ├── IFriendMessageEventArgs.cs
│ │ │ ├── IFriendNickChangedEventArgs.cs
│ │ │ ├── IFriendMessageRevokedEventArgs.cs
│ │ │ └── IFriendSyncMessageEventArgs.cs
│ │ ├── OtherClient
│ │ │ └── IOtherClientMessageEventArgs.cs
│ │ ├── Bot
│ │ │ ├── IBotEventArgs.cs
│ │ │ ├── IBotOnlineEventArgs.cs
│ │ │ ├── IBotDroppedEventArgs.cs
│ │ │ ├── IBotReloginEventArgs.cs
│ │ │ ├── IBotKickedOfflineEventArgs.cs
│ │ │ ├── IBotUnmutedEventArgs.cs
│ │ │ ├── IBotPositiveOfflineEventArgs.cs
│ │ │ ├── IBotKickedOutEventArgs.cs
│ │ │ ├── IBotMutedEventArgs.cs
│ │ │ ├── IBotInvitedJoinGroupEventArgs.cs
│ │ │ ├── IBotPositiveLeaveGroupEventArgs.cs
│ │ │ ├── IBotJoinedGroupEventArgs.cs
│ │ │ └── IBotGroupPermissionChangedEventArgs.cs
│ │ ├── Temp
│ │ │ ├── ITempMessageEventArgs.cs
│ │ │ └── ITempSyncMessageEventArgs.cs
│ │ ├── ICommonMessageEventArgs.cs
│ │ ├── Stranger
│ │ │ ├── IStrangerMessageEventArgs.cs
│ │ │ └── IStrangerSyncMessageEventArgs.cs
│ │ ├── IGroupMessageBaseEventArgs.cs
│ │ ├── INewApplyEventArgs.cs
│ │ ├── IMessageRevokedEventArgs.cs
│ │ ├── IApplyResponseArgs.cs
│ │ ├── IPropertyChangedEventArgs.cs
│ │ └── IBotGroupPropertyChangedEventArgs.cs
│ ├── IStrangerInfo.cs
│ ├── IOtherClientInfo.cs
│ ├── IFriendInfo.cs
│ ├── IGroupInfo.cs
│ ├── IBaseInfo.cs
│ ├── ICommonProfile.cs
│ ├── IGroupMemberCardInfo.cs
│ ├── UploadTarget.cs
│ ├── General
│ │ └── MiraiMessage.cs
│ ├── NudgeTarget.cs
│ ├── ProfileGender.cs
│ ├── GroupPermission.cs
│ ├── FriendApplyActions.cs
│ ├── PictureTarget.cs
│ ├── GroupApplyActions.cs
│ ├── IGroupConfig.cs
│ ├── IGroupFileDownloadInfo.cs
│ ├── IGroupAnnouncement.cs
│ ├── PokeType.cs
│ ├── IGroupFileInfo.cs
│ └── IPublishGroupAnnouncementRequest.cs
├── Framework
│ ├── Clients
│ │ └── IMessageClient.cs
│ ├── Parsers
│ │ ├── Attributes
│ │ │ └── SuppressAutoMappingAttribute.cs
│ │ ├── IMessageParserResolver.cs
│ │ └── IMappableMessageParser.cs
│ ├── Handlers
│ │ ├── IInvarianceMessageHandler.cs
│ │ └── IContravarianceMessageHandler.cs
│ ├── Invoking
│ │ ├── MessageSubscription.RegistrationNode.cs
│ │ ├── IMessageSubscription.cs
│ │ └── Attributes
│ │ │ ├── RegisterMessageSubscriptionAttribute.cs
│ │ │ └── RegisterMessageSubscriptionResolverAttribute.cs
│ ├── Models
│ │ └── General
│ │ │ └── Message.cs
│ └── Attributes
│ │ └── RegisterBaseAttribute.cs
├── Session
│ ├── MiraiSession.Nudge.cs
│ ├── IMiraiSession.cs
│ ├── MiraiSession.SendVoice.cs
│ ├── MiraiSession.cs
│ ├── MiraiSession.FetchProfile.cs
│ ├── IMiraiSession.Nudge.cs
│ ├── MiraiSession.Application.cs
│ ├── MiraiSession.SendImage.cs
│ ├── MiraiSession.GroupAnnouncement.cs
│ ├── MiraiSession.Command.cs
│ └── IMiraiSession.SendVoice.cs
├── Services
│ ├── IVoiceConverter.cs
│ └── IImageConverter.cs
├── Parsers
│ ├── IMiraiMessageParserResolver.cs
│ ├── IMappableMiraiMessageParser.cs
│ └── IMiraiMessageParser.cs
├── Handlers
│ ├── IInvarianceMessageHandler.cs
│ ├── IContravarianceMessageHandler.cs
│ ├── IMiraiMessageHandler.cs
│ ├── MiraiMessageHandler.cs
│ └── DedicateMiraiMessageHandler.cs
├── Builders
│ └── MiraiBaseFrameworkBuilder.cs
├── Extensions
│ └── MessageChainExtensions.cs
├── Exceptions
│ ├── BotMutedException.cs
│ ├── BotNotFoundException.cs
│ ├── PermissionDeniedException.cs
│ └── MessageTooLongException.cs
└── Invoking
│ ├── IMiraiMessageSubscription.cs
│ └── Attributes
│ ├── RegisterMessageSubscriptionAttribute.cs
│ └── RegisterMiraiMessageSubscriptionResolverAttribute.cs
├── Mirai-CSharp.Example.Hosting
├── appsettings.Development.json
├── appsettings.json
├── Mirai-CSharp.Example.Hosting.csproj
├── Controllers
│ ├── RobotController.cs
│ ├── RobotController.Add.cs
│ ├── RobotController.AddGroupMessageHandler.cs
│ └── RobotController.AddFriendMessageHandler.cs
├── Program.cs
├── Properties
│ └── launchSettings.json
└── Handlers
│ └── AutoRejectFriendApplyHandler.cs
├── Mirai-CSharp.VoiceConverter
├── LameOutputChannelMode.cs
├── Mirai-CSharp.VoiceConverter.csproj
├── Mp3Metadata.cs
└── DependencyInjection
│ └── SilkLameVoiceConverterDIExtensions.cs
├── Mirai-CSharp.HttpApi
├── Handlers
│ ├── IInvarianceMiraiHttpMessageHandler.cs
│ ├── IContravarianceMiraiHttpMessageHandler.cs
│ ├── MiraiHttpMessageHandler.cs
│ └── DedicateMiraiMessageHandler.cs
├── Utility
│ ├── JsonSerializeOptionsFactory.cs
│ └── JsonConverters
│ │ ├── TimeSpanSecondsConverter.cs
│ │ ├── ChangeTypeJsonConverter.cs
│ │ └── UnixTimeStampJsonConverter.cs
├── Models
│ ├── EventArgs
│ │ ├── UnknownMessageEventArgs.cs
│ │ ├── Bot
│ │ │ ├── BotOnlineEventArgs.cs
│ │ │ ├── BotReloginEventArgs.cs
│ │ │ ├── BotUnmutedEventArgs.cs
│ │ │ ├── BotDroppedEventArgs.cs
│ │ │ ├── BotKickedOfflineEventArgs.cs
│ │ │ ├── BotPositiveOfflineEventArgs.cs
│ │ │ ├── BotKickedOutEventArgs.cs
│ │ │ ├── BotPositiveLeaveGroupEventArgs.cs
│ │ │ └── BotInvitedJoinGroupEventArgs.cs
│ │ ├── Group
│ │ │ ├── GroupDisbandEventArgs.cs
│ │ │ ├── GroupMemberUnmutedEventArgs.cs
│ │ │ ├── Specialized
│ │ │ │ ├── GroupMemberKickedEventArgs.cs
│ │ │ │ ├── GroupMemberPositiveLeaveEventArgs.cs
│ │ │ │ ├── GroupNameChangedEventArgs.cs
│ │ │ │ ├── GroupMuteAllChangedEventArgs.cs
│ │ │ │ ├── GroupAnonymousChatChangedEventArgs.cs
│ │ │ │ ├── GroupMemberCardChangedEventArgs.cs
│ │ │ │ ├── GroupConfessTalkChangedEventArgs.cs
│ │ │ │ ├── GroupMemberInviteChangedEventArgs.cs
│ │ │ │ ├── GroupMemberSpecialTitleChangedEventArgs.cs
│ │ │ │ └── GroupEntranceAnnouncementChangedEventArgs.cs
│ │ │ ├── GroupApplyEventArgs.cs
│ │ │ └── GroupMessageEventArgs.cs
│ │ ├── Friend
│ │ │ └── NewFriendApplyEventArgs.cs
│ │ ├── Temp
│ │ │ └── TempMessageEventArgs.cs
│ │ └── DisconnectedEventArgs.cs
│ ├── GroupMemberProfile.cs
│ ├── BotProfile.cs
│ ├── UserProfile.cs
│ ├── FriendProfile.cs
│ ├── ChatMessages
│ │ ├── ChatMessage.cs
│ │ ├── AtAllMessage.cs
│ │ └── UnknownMessage.cs
│ ├── StrangerInfo.cs
│ ├── MiraiSessionConfig.cs
│ └── OtherClientInfo.cs
├── Session
│ ├── IMiraiHttpSession.Management.cs
│ ├── MiraiHttpSession.Validation.cs
│ ├── PluginResistration.cs
│ ├── IMiraiHttpSession.cs
│ ├── MiraiHttpSession.Nudge.cs
│ └── IMiraiHttpSession.Configuration.cs
├── Mirai-CSharp.HttpApi.csproj
├── Extensions
│ ├── HttpClientExtensions.PostEmptyContent.cs
│ └── HttpClientExtensions.PostByteArrayContent.cs
├── Parsers
│ ├── MiraiHttpChatMessageParser.cs
│ ├── MiraiHttpMessageParser.cs
│ ├── MiraiHttpMessageParserBase.cs
│ ├── UnknownMessageParser.cs
│ ├── UnknownChatMessageParser.cs
│ ├── Attributes
│ │ └── MappableMiraiHttpMessageKeyAttribute.cs
│ ├── MiraiMappableHttpMessageParser.cs
│ └── MappableMiraiHttpChatMessageParser.cs
├── Invoking
│ ├── IMiraiHttpMessageSubscription.cs
│ └── Attributes
│ │ └── RegisterMiraiHttpMessageSubscriptionResolverAttribute.cs
├── Exceptions
│ ├── InvalidAuthKeyException.cs
│ └── InvalidSessionException.cs
└── JsonServices
│ └── MiraiHttpMessageJsonOptions.cs
└── Mirai-CSharp.ImageConverter
├── Mirai-CSharp.ImageConverter.csproj
└── DependencyInjection
└── SkiasharpImageConverterDIExtensions.cs
/Mirai-CSharp.NativeAssets.Linux/_._:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.LinuxArm/_._:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.Win32/_._:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example/ExamplePlugin.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Example
2 | {
3 | public partial class ExamplePlugin // 你想处理什么事件就实现什么事件对应的接口
4 | {
5 |
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/GroupHonorState.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | public enum GroupHonorState
4 | {
5 | Achieve = 1,
6 | Lose = 2
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.Linux/runtimes/linux-x64/native/libsilklame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Executor-Cheng/Mirai-CSharp/HEAD/Mirai-CSharp.NativeAssets.Linux/runtimes/linux-x64/native/libsilklame.so
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.Win32/runtimes/win-x64/native/libsilklame.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Executor-Cheng/Mirai-CSharp/HEAD/Mirai-CSharp.NativeAssets.Win32/runtimes/win-x64/native/libsilklame.dll
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.Win32/runtimes/win-x86/native/libsilklame.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Executor-Cheng/Mirai-CSharp/HEAD/Mirai-CSharp.NativeAssets.Win32/runtimes/win-x86/native/libsilklame.dll
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.LinuxArm/runtimes/linux-arm/native/libsilklame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Executor-Cheng/Mirai-CSharp/HEAD/Mirai-CSharp.NativeAssets.LinuxArm/runtimes/linux-arm/native/libsilklame.so
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.LinuxArm/runtimes/linux-arm64/native/libsilklame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Executor-Cheng/Mirai-CSharp/HEAD/Mirai-CSharp.NativeAssets.LinuxArm/runtimes/linux-arm64/native/libsilklame.so
--------------------------------------------------------------------------------
/Mirai-CSharp/Framework/Clients/IMessageClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Framework.Clients
4 | {
5 | public interface IMessageClient : IDisposable
6 | {
7 |
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IForwardMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | public interface IForwardMessage : IChatMessage
4 | {
5 | IForwardMessageNode[] Nodes { get; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IBotProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供机器人的资料信息接口
5 | ///
6 | public interface IBotProfile : ICommonProfile
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IUserProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供任意QQ资料信息的接口
5 | ///
6 | public interface IUserProfile : ICommonProfile
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IFriendProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供好友资料信息的接口
5 | ///
6 | public interface IFriendProfile : ICommonProfile
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupMemberProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供群员资料信息的接口
5 | ///
6 | public interface IGroupMemberProfile : ICommonProfile
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IImageMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示图片消息的基接口
5 | ///
6 | public interface IImageMessage : ICommonImageMessage
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp.VoiceConverter/LameOutputChannelMode.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.VoiceConverter
2 | {
3 | public enum LameOutputChannelMode
4 | {
5 | Stereo = 0,
6 | JointStereo = 1,
7 | Notset = 2,
8 | Mono = 3
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IAtAllMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示 @全体成员 消息的基接口
5 | ///
6 | public interface IAtAllMessage : IChatMessage
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IFlashImageMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示闪照消息的基接口
5 | ///
6 | public interface IFlashImageMessage : ICommonImageMessage
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ImageFormat.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models
4 | {
5 | [Flags]
6 | public enum ImageFormat
7 | {
8 | Unknown = 0,
9 |
10 | Png = 1,
11 |
12 | Jpeg = 2,
13 |
14 | Gif = 4
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/IUnknownMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供未知消息的相关信息接口
5 | ///
6 | public interface IUnknownMessageEventArgs : IMiraiMessage
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IChatMessage.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Models.EventArgs;
2 |
3 | namespace Mirai.CSharp.Models.ChatMessages
4 | {
5 | ///
6 | /// 表示聊天消息的基接口
7 | ///
8 | public interface IChatMessage : IMiraiMessage
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IMutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models.EventArgs
4 | {
5 | ///
6 | /// 提供禁言时间的接口
7 | ///
8 | public interface IMutedEventArgs
9 | {
10 | TimeSpan Duration { get; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Framework/Parsers/Attributes/SuppressAutoMappingAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Framework.Parsers.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public sealed class SuppressAutoMappingAttribute : Attribute
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IStrangerInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供陌生人信息的接口
5 | ///
6 | public interface IStrangerInfo : IBaseInfo
7 | {
8 | ///
9 | /// 陌生人备注(?)
10 | ///
11 | string Remark { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IOtherClientInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供其他客户端信息的接口
5 | ///
6 | public interface IOtherClientInfo : IBaseInfo
7 | {
8 | ///
9 | /// 其他客户端的平台
10 | ///
11 | string Platform { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IDiceMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示摇骰子消息的基接口
5 | ///
6 | public interface IDiceMessage : IChatMessage
7 | {
8 | ///
9 | /// 点数
10 | ///
11 | int Point { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IFriendInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供好友信息的接口。继承自
5 | ///
6 | public interface IFriendInfo : IBaseInfo
7 | {
8 | ///
9 | /// 好友备注
10 | ///
11 | string Remark { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IAppMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示App消息的基接口
5 | ///
6 | public interface IAppMessage : IChatMessage
7 | {
8 | ///
9 | /// 消息内容
10 | ///
11 | string Content { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IPokeMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示戳一戳消息的基接口
5 | ///
6 | public interface IPokeMessage : IChatMessage
7 | {
8 | ///
9 | /// 戳一戳类型
10 | ///
11 | PokeType Name { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IXmlMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示xml消息的基接口
5 | ///
6 | public interface IXmlMessage : IChatMessage
7 | {
8 | ///
9 | /// Xml原始字符串
10 | ///
11 | string Xml { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/IFriendEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | public interface IFriendEventArgs : IMiraiMessage
4 | {
5 | IFriendInfo Friend { get; }
6 | }
7 |
8 | public interface IFriendEventArgs : IFriendEventArgs, IMiraiMessage
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IJsonMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示Json消息的基接口
5 | ///
6 | public interface IJsonMessage : IChatMessage
7 | {
8 | ///
9 | /// Json原始字符串
10 | ///
11 | string Json { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IPlainMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示文字消息的基接口
5 | ///
6 | public interface IPlainMessage : IChatMessage
7 | {
8 | ///
9 | /// 文字消息
10 | ///
11 | string Message { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供群内权限和基本信息的接口。继承自
5 | ///
6 | public interface IGroupInfo : IBaseInfo
7 | {
8 | ///
9 | /// 权限信息
10 | ///
11 | GroupPermission Permission { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IForwardMessageNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models.ChatMessages
4 | {
5 | public interface IForwardMessageNode
6 | {
7 | int Id { get; }
8 |
9 | string Name { get; }
10 |
11 | long QQNumber { get; }
12 |
13 | DateTime Time { get; }
14 |
15 | IChatMessage[] Chain { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.Nudge.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Mirai.CSharp.Models;
4 |
5 | namespace Mirai.CSharp.Session
6 | {
7 | public partial class MiraiSession
8 | {
9 | ///
10 | public abstract Task NudgeAsync(NudgeTarget target, long qqNumber, long? groupNumber = null, CancellationToken token = default);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IBaseInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供基本信息(Id和名称)的接口
5 | ///
6 | public interface IBaseInfo
7 | {
8 | ///
9 | /// QQ号/群号
10 | ///
11 | long Id { get; }
12 | ///
13 | /// 昵称/群名
14 | ///
15 | string Name { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/OtherClient/IOtherClientMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | public interface IOtherClientMessageEventArgs : ICommonMessageEventArgs
4 | {
5 | IOtherClientInfo Sender { get; }
6 | }
7 |
8 | public interface IOtherClientMessageEventArgs : IOtherClientMessageEventArgs, ICommonMessageEventArgs
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Services/IVoiceConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace Mirai.CSharp.Services
7 | {
8 | public interface IVoiceConverter
9 | {
10 | bool TryConvert(ReadOnlySpan inputSpan, out byte[]? output);
11 |
12 | Task ConvertAsync(Stream inputStream, CancellationToken token = default);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Framework/Parsers/IMessageParserResolver.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Mirai.CSharp.Framework.Parsers
4 | {
5 | public interface IMessageParserResolver where TParserService : IMessageParser
6 | {
7 | TParserService? ResolveParser(in TRawdata rawdata);
8 |
9 | IEnumerable ResolveParsers(in TRawdata rawdata);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Parsers/IMiraiMessageParserResolver.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Mirai.CSharp.Framework.Parsers;
3 |
4 | namespace Mirai.CSharp.Parsers
5 | {
6 | public interface IMiraiMessageParserResolver : IMessageParserResolver where TParserService : IMiraiMessageParser
7 | {
8 | IEnumerable UnknownMessageParsers { get; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ICommonProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供通用资料信息的接口
5 | ///
6 | public interface ICommonProfile
7 | {
8 | string Nickname { get; }
9 |
10 | string Email { get; }
11 |
12 | int Age { get; }
13 |
14 | int Level { get; }
15 |
16 | string Sign { get; }
17 |
18 | ProfileGender Gender { get; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupMemberCardInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供群名片和专属头衔的接口
5 | ///
6 | public interface IGroupMemberCardInfo
7 | {
8 | ///
9 | /// 群名片
10 | ///
11 | string? Name { get; }
12 | ///
13 | /// 专属头衔
14 | ///
15 | string? SpecialTitle { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Handlers/IInvarianceMiraiHttpMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Handlers;
2 | using Mirai.CSharp.HttpApi.Models;
3 | using Mirai.CSharp.HttpApi.Session;
4 |
5 | namespace Mirai.CSharp.HttpApi.Handlers
6 | {
7 | public interface IInvarianceMiraiHttpMessageHandler : IMiraiHttpMessageHandlerBase, IInvarianceMiraiMessageHandler where TMessage : IMiraiHttpMessage
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupMemberHonorChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | public interface IGroupMemberHonorChangedEventArgs : IMemberEventArgs
4 | {
5 | GroupHonorState State { get; }
6 |
7 | string Honor { get; }
8 | }
9 |
10 | public interface IGroupMemberHonorChangedEventArgs : IGroupMemberHonorChangedEventArgs, IMemberEventArgs
11 | {
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Mirai-CSharp.Example.Hosting.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | net7.0
6 | Mirai.CSharp.Example.Hosting
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp.VoiceConverter/Mirai-CSharp.VoiceConverter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Mirai_CSharp.VoiceConverter
5 | Provides default IVoiceConverter implementation.
6 | mirai
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IMarketFaceMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示商城表情消息的基接口
5 | ///
6 | public interface IMarketFaceMessage : IChatMessage
7 | {
8 | ///
9 | /// 商城表情唯一标识
10 | ///
11 | int Id { get; }
12 | ///
13 | /// 表情显示名称
14 | ///
15 | string Name { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/UploadTarget.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 上传对象的目标类型
5 | ///
6 | public enum UploadTarget
7 | {
8 | ///
9 | /// 好友
10 | ///
11 | Friend,
12 | ///
13 | /// 群
14 | ///
15 | Group,
16 | ///
17 | /// 临时会话
18 | ///
19 | Temp
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Handlers/IContravarianceMiraiHttpMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Handlers;
2 | using Mirai.CSharp.HttpApi.Models;
3 | using Mirai.CSharp.HttpApi.Session;
4 |
5 | namespace Mirai.CSharp.HttpApi.Handlers
6 | {
7 | public interface IContravarianceMiraiHttpMessageHandler : IMiraiHttpMessageHandlerBase, IContravarianceMiraiMessageHandler where TMessage : IMiraiHttpMessage
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/General/MiraiMessage.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Framework.Models.General;
2 |
3 | namespace Mirai.CSharp.Models.EventArgs
4 | {
5 | public interface IMiraiMessage : IMessage
6 | {
7 |
8 | }
9 |
10 | public interface IMiraiMessage : IMiraiMessage, IMessage
11 | {
12 |
13 | }
14 |
15 | public abstract class MiraiMessage : Message, IMiraiMessage
16 | {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/NudgeTarget.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 戳一戳的对象
5 | ///
6 | public enum NudgeTarget
7 | {
8 | ///
9 | /// 好友
10 | ///
11 | Friend = 1,
12 | ///
13 | /// 群友
14 | ///
15 | Group = 2,
16 | ///
17 | /// 陌生人
18 | ///
19 | Stranger = 3
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ProfileGender.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 个人资料性别
5 | ///
6 | public enum ProfileGender
7 | {
8 | ///
9 | /// 未知
10 | ///
11 | Unknown = 0,
12 | ///
13 | /// 男性
14 | ///
15 | Male = 1,
16 | ///
17 | /// 女性
18 | ///
19 | Female = 2
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IAtMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示 @特定对象 消息的基接口
5 | ///
6 | public interface IAtMessage : IChatMessage
7 | {
8 | ///
9 | /// 被@的群员QQ号
10 | ///
11 | long Target { get; }
12 | ///
13 | /// At时显示的文字, 发送消息时无效, 自动使用群名片
14 | ///
15 | string? Display { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/GroupPermission.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 群成员权限
5 | ///
6 | public enum GroupPermission
7 | {
8 | ///
9 | /// 普通成员
10 | ///
11 | Member,
12 | ///
13 | /// 管理员
14 | ///
15 | Administrator,
16 | ///
17 | /// 群主
18 | ///
19 | Owner
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Handlers/IInvarianceMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Models.EventArgs;
2 | using Mirai.CSharp.Session;
3 |
4 | namespace Mirai.CSharp.Handlers
5 | {
6 | public interface IInvarianceMiraiMessageHandler : IMiraiMessageHandlerBase where TClient : IMiraiSession
7 | where TMessage : IMiraiMessage
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/IMiraiSession.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Builders;
2 | using Mirai.CSharp.Framework.Clients;
3 |
4 | namespace Mirai.CSharp.Session
5 | {
6 | public partial interface IMiraiSession : IMessageClient
7 | {
8 | ///
9 | /// 获取适合于当前会话的
10 | ///
11 | /// 一个与当前会话关联的
12 | IMessageChainBuilder GetMessageChainBuilder();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Framework/Handlers/IInvarianceMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Framework.Clients;
2 | using Mirai.CSharp.Framework.Models.General;
3 |
4 | namespace Mirai.CSharp.Framework.Handlers
5 | {
6 | public interface IInvarianceMessageHandler : IMessageHandler where TClient : IMessageClient
7 | where TMessage : IMessage
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/ISourceMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models.ChatMessages
4 | {
5 | ///
6 | /// 表示消息基本信息的基接口
7 | ///
8 | public interface ISourceMessage : IChatMessage
9 | {
10 | ///
11 | /// 消息的识别号, 用于引用回复或撤回
12 | ///
13 | int Id { get; }
14 | ///
15 | /// 消息时间
16 | ///
17 | DateTime Time { get; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 机器人本身事件接口。仅含QQ号
5 | ///
6 | public interface IBotEventArgs : IMiraiMessage
7 | {
8 | ///
9 | /// 机器人QQ号
10 | ///
11 | long QQNumber { get; }
12 | }
13 |
14 | ///
15 | public interface IBotEventArgs : IBotEventArgs, IMiraiMessage
16 | {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Framework/Handlers/IContravarianceMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Framework.Clients;
2 | using Mirai.CSharp.Framework.Models.General;
3 |
4 | namespace Mirai.CSharp.Framework.Handlers
5 | {
6 | public interface IContravarianceMessageHandler : IMessageHandler where TClient : IMessageClient
7 | where TMessage : IMessage
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp.VoiceConverter/Mp3Metadata.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.VoiceConverter
2 | {
3 | public struct Mp3Metadata
4 | {
5 | public int HeaderParsed;
6 |
7 | public int Stereo;
8 |
9 | public int Samplerate;
10 |
11 | public int Bitrate;
12 |
13 | public int Mode;
14 |
15 | public int ModeExtended;
16 |
17 | public int Framesize;
18 |
19 | public uint Nsamp;
20 |
21 | public int TotalFrames;
22 |
23 | public int Framenum;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/FriendApplyActions.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 指示如何处理添加好友请求
5 | ///
6 | public enum FriendApplyAction
7 | {
8 | ///
9 | /// 同意添加好友
10 | ///
11 | Allow = 0,
12 | ///
13 | /// 拒绝添加好友
14 | ///
15 | Deny = 1,
16 | ///
17 | /// 拒绝添加好友并添加黑名单, 不再接收该用户的好友申请
18 | ///
19 | DenyAndBlock = 2
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/PictureTarget.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models
4 | {
5 | ///
6 | /// 图片的目标类型
7 | ///
8 | [Obsolete("请使用 UploadTarget")]
9 | public enum PictureTarget
10 | {
11 | ///
12 | /// 好友
13 | ///
14 | Friend,
15 | ///
16 | /// 群
17 | ///
18 | Group,
19 | ///
20 | /// 临时会话
21 | ///
22 | Temp
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Controllers/RobotController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using Mirai.CSharp.Example.Hosting.Services;
3 |
4 | namespace Mirai.CSharp.Example.Hosting.Controllers
5 | {
6 | [ApiController]
7 | [Route("[controller]")]
8 | public sealed partial class RobotController : ControllerBase
9 | {
10 | private readonly RobotManager _robotManager;
11 |
12 | public RobotController(RobotManager robotManager)
13 | {
14 | _robotManager = robotManager;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Services/IImageConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Mirai.CSharp.Models;
6 |
7 | namespace Mirai.CSharp.Services
8 | {
9 | public interface IImageConverter
10 | {
11 | bool TryConvert(ReadOnlySpan inputSpan, ImageFormat convertTo, out ImageFormat outputFormat, out byte[]? output);
12 |
13 | Task<(ImageFormat outputFormat, byte[] output)> ConvertAsync(Stream inputStream, ImageFormat convertTo, CancellationToken token = default);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Mirai-CSharp.ImageConverter/Mirai-CSharp.ImageConverter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Mirai_CSharp.ImageConverter
5 | Provides default IImageConverter implementation.
6 | mirai
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotOnlineEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot登录成功信息的接口。继承自
5 | ///
6 | public interface IBotOnlineEventArgs : IBotEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot登录成功信息的接口。继承自 和
13 | ///
14 | public interface IBotOnlineEventArgs : IBotOnlineEventArgs, IBotEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Builders/MiraiBaseFrameworkBuilder.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Mirai.CSharp.Handlers;
3 | using Mirai.CSharp.Invoking;
4 | using Mirai.CSharp.Parsers;
5 | using Mirai.CSharp.Session;
6 |
7 | namespace Mirai.CSharp.Builders
8 | {
9 | public class MiraiBaseFrameworkBuilder : MiraiFrameworkBuilder, IMiraiSession, IMiraiMessageHandler, IMiraiMessageParser>
10 | {
11 | public MiraiBaseFrameworkBuilder(IServiceCollection services) : base(services)
12 | {
13 |
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotDroppedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot意外断开连接信息的接口。继承自
5 | ///
6 | public interface IBotDroppedEventArgs : IBotEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot意外断开连接信息的接口。继承自 ,
13 | ///
14 | public interface IBotDroppedEventArgs : IBotDroppedEventArgs, IBotEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotReloginEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot主动重新登录信息的接口。继承自
5 | ///
6 | public interface IBotReloginEventArgs : IBotEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot主动重新登录信息的接口。继承自 和
13 | ///
14 | public interface IBotReloginEventArgs : IBotReloginEventArgs, IBotEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.SendVoice.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Mirai.CSharp.Models;
5 | using Mirai.CSharp.Models.ChatMessages;
6 |
7 | namespace Mirai.CSharp.Session
8 | {
9 | public abstract partial class MiraiSession
10 | {
11 | public abstract Task UploadVoiceAsync(UploadTarget type, Stream voice, CancellationToken token = default);
12 |
13 | public abstract Task UploadVoiceAsync(UploadTarget type, string voicePath, CancellationToken token = default);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotKickedOfflineEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot被挤下线信息的接口。继承自
5 | ///
6 | public interface IBotKickedOfflineEventArgs : IBotEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot被挤下线信息的接口。继承自 和
13 | ///
14 | public interface IBotKickedOfflineEventArgs : IBotKickedOfflineEventArgs, IBotEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotUnmutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot被解除禁言事件相关信息的接口。继承自
5 | ///
6 | public interface IBotUnmutedEventArgs : IOperatorEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot被解除禁言事件相关信息的接口。继承自 和
13 | ///
14 | public interface IBotUnmutedEventArgs : IBotUnmutedEventArgs, IOperatorEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Utility/JsonSerializeOptionsFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json;
2 | #if NET6_0_OR_GREATER
3 | using System.Text.Json.Serialization;
4 | #endif
5 |
6 | namespace Mirai.CSharp.HttpApi.Utility
7 | {
8 | public static class JsonSerializeOptionsFactory
9 | {
10 | #if NET6_0_OR_GREATER
11 | public static JsonSerializerOptions IgnoreNulls => new JsonSerializerOptions { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull };
12 | #else
13 | public static JsonSerializerOptions IgnoreNulls => new JsonSerializerOptions { IgnoreNullValues = true };
14 | #endif
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotPositiveOfflineEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot主动离线信息的接口。继承自
5 | ///
6 | public interface IBotPositiveOfflineEventArgs : IBotEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot主动离线信息的接口。继承自 和
13 | ///
14 | public interface IBotPositiveOfflineEventArgs : IBotPositiveOfflineEventArgs, IBotEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/INewFriendApplyEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供好友申请相关信息的接口。继承自
5 | ///
6 | public interface INewFriendApplyEventArgs : INewApplyEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供好友申请相关信息的接口。继承自 和
13 | ///
14 | public interface INewFriendApplyEventArgs : INewFriendApplyEventArgs, INewApplyEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Extensions/MessageChainExtensions.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Models;
2 | using Mirai.CSharp.Models.ChatMessages;
3 | using System.Linq;
4 |
5 | namespace Mirai.CSharp.Extensions
6 | {
7 | public static class MessageChainExtensions // 其他的我还没想到, 以后再写
8 | {
9 | public static string GetPlain(this IChatMessage[] chain)
10 | {
11 | return string.Join(null, chain.GetPlains());
12 | }
13 |
14 | public static string[] GetPlains(this IChatMessage[] chain)
15 | {
16 | return chain.OfType().Select(p => p.Message).ToArray();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp.ImageConverter/DependencyInjection/SkiasharpImageConverterDIExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Microsoft.Extensions.DependencyInjection.Extensions;
3 | using Mirai.CSharp.Services;
4 |
5 | namespace Mirai_CSharp.ImageConverter.DependencyInjection
6 | {
7 | public static class SkiasharpImageConverterDIExtensions
8 | {
9 | public static IServiceCollection AddSkiasharpImageConverter(this IServiceCollection services)
10 | {
11 | services.TryAddSingleton();
12 | return services;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供群消息的相关信息接口。继承自
5 | ///
6 | public interface IGroupMessageEventArgs : IGroupMessageBaseEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供群消息的相关信息接口。继承自 和
13 | ///
14 | public interface IGroupMessageEventArgs : IGroupMessageEventArgs, IGroupMessageBaseEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Temp/ITempMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供临时消息的相关信息接口。继承自
5 | ///
6 | public interface ITempMessageEventArgs : IGroupMessageBaseEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供临时消息的相关信息接口。继承自 和
13 | ///
14 | public interface ITempMessageEventArgs : ITempMessageEventArgs, IGroupMessageBaseEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotKickedOutEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot被踢出一个群相关信息的接口。继承自
5 | ///
6 | public interface IBotKickedOutEventArgs : IGroupOperatingEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot被踢出一个群相关信息的接口。继承自 和
13 | ///
14 | public interface IBotKickedOutEventArgs : IBotKickedOutEventArgs, IGroupOperatingEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotMutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot被禁言事件相关信息的接口。继承自 和
5 | ///
6 | public interface IBotMutedEventArgs : IOperatorEventArgs, IMutedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot被禁言事件相关信息的接口。继承自 和
13 | ///
14 | public interface IBotMutedEventArgs : IBotMutedEventArgs, IOperatorEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.Linux/Mirai-CSharp.NativeAssets.Linux.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 |
6 |
7 |
8 | <_NativeSilkLameFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-x64\native\libsilklame*.so"/>
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotInvitedJoinGroupEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot被邀请入群相关信息的接口。继承自
5 | ///
6 | public interface IBotInvitedJoinGroupEventArgs : ICommonGroupApplyEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot被邀请入群相关信息的接口。继承自
13 | ///
14 | public interface IBotInvitedJoinGroupEventArgs : IBotInvitedJoinGroupEventArgs, ICommonGroupApplyEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotPositiveLeaveGroupEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot主动退出一个群相关信息的接口。继承自
5 | ///
6 | public interface IBotPositiveLeaveGroupEventArgs : IGroupEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot主动退出一个群相关信息的接口。继承自 和
13 | ///
14 | public interface IBotPositiveLeaveGroupEventArgs : IBotPositiveLeaveGroupEventArgs, IGroupEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Handlers/IContravarianceMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Framework.Handlers;
2 | using Mirai.CSharp.Models.EventArgs;
3 | using Mirai.CSharp.Session;
4 |
5 | namespace Mirai.CSharp.Handlers
6 | {
7 | public interface IContravarianceMiraiMessageHandler : IMiraiMessageHandlerBase, IContravarianceMessageHandler where TClient : IMiraiSession
8 | where TMessage : IMiraiMessage
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.Builders;
3 |
4 | namespace Mirai.CSharp.Session
5 | {
6 | public abstract partial class MiraiSession : IMiraiSession
7 | {
8 | ///
9 | public abstract IMessageChainBuilder GetMessageChainBuilder();
10 |
11 | protected virtual void Dispose(bool disposing)
12 | {
13 |
14 | }
15 |
16 | ///
17 | /// 释放当前会话所用资源
18 | ///
19 | public void Dispose()
20 | {
21 | Dispose(true);
22 | GC.SuppressFinalize(this);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberKickedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供成员被踢出群相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberKickedEventArgs : IMemberOperatingEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供成员被踢出群相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberKickedEventArgs : IGroupMemberKickedEventArgs, IMemberOperatingEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotJoinedGroupEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot加入了一个新群相关信息的接口。继承自
5 | ///
6 | public interface IBotJoinedGroupEventArgs : IGroupEventArgs, IInviterEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot加入了一个新群相关信息的接口。继承自 和
13 | ///
14 | public interface IBotJoinedGroupEventArgs : IBotJoinedGroupEventArgs, IGroupEventArgs, IInviterEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberPositiveLeaveEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供成员主动离群相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberPositiveLeaveEventArgs : IMemberEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供成员主动离群相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberPositiveLeaveEventArgs : IGroupMemberPositiveLeaveEventArgs, IMemberEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupMemberUnmutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供其它群成员被解除禁言事件相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberUnmutedEventArgs : IMemberOperatingEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供其它群成员被解除禁言事件相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberUnmutedEventArgs : IGroupMemberUnmutedEventArgs, IMemberOperatingEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberJoinedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供新人入群相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberJoinedEventArgs : IMemberEventArgs, IInviterEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供新人入群相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberJoinedEventArgs : IGroupMemberJoinedEventArgs, IMemberEventArgs, IInviterEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Controllers/RobotController.Add.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Microsoft.AspNetCore.Mvc;
5 |
6 | namespace Mirai.CSharp.Example.Hosting.Controllers
7 | {
8 | public sealed partial class RobotController
9 | {
10 | [HttpGet]
11 | [HttpPost]
12 | [Route("[action]")]
13 | public async Task AddAsync([Required]int robotQQ, CancellationToken token)
14 | {
15 | await _robotManager.RetriveSessionAsync(robotQQ, token);
16 | return (JsonResult)ResponseModel.CreateSuccess();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/UnknownMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using ISharedUnknownMessageEventArgs = Mirai.CSharp.Models.EventArgs.IUnknownMessageEventArgs;
2 |
3 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
4 | {
5 | ///
6 | /// 提供未知消息的相关信息接口。继承自 和
7 | ///
8 | public interface IUnknownMessageEventArgs : ISharedUnknownMessageEventArgs, IMiraiHttpMessage
9 | {
10 |
11 | }
12 |
13 | public class UnknownMessageEventArgs : MiraiHttpMessage, IUnknownMessageEventArgs
14 | {
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IFaceMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示一个QQ表情的基接口
5 | ///
6 | public interface IFaceMessage : IChatMessage
7 | {
8 | ///
9 | /// QQ表情编号, 可选, 优先高于
10 | ///
11 | ///
12 | /// 编号详见
13 | ///
14 | int Id { get; }
15 | ///
16 | /// QQ表情拼音, 可选
17 | ///
18 | string? Name { get; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/IFriendInputStatusChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供好友输入状态变更相关信息接口。继承自
5 | ///
6 | public interface IFriendInputStatusChangedEventArgs : IFriendEventArgs
7 | {
8 | bool Inputting { get; }
9 | }
10 |
11 | ///
12 | /// 提供好友输入状态变更相关信息接口。继承自 和
13 | ///
14 | public interface IFriendInputStatusChangedEventArgs : IFriendInputStatusChangedEventArgs, IFriendEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupMemberMutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供其它群成员被禁言事件相关信息的接口。继承自 和
5 | ///
6 | public interface IGroupMemberMutedEventArgs : IMemberOperatingEventArgs, IMutedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供其它群成员被禁言事件相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberMutedEventArgs : IGroupMemberMutedEventArgs, IMemberOperatingEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupNameChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供群名称改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupNameChangedEventArgs : IGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供群名称改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupNameChangedEventArgs : IGroupNameChangedEventArgs, IGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Utility/JsonConverters/TimeSpanSecondsConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Mirai.CSharp.HttpApi.Utility.JsonConverters
6 | {
7 | public class TimeSpanSecondsConverter : JsonConverter
8 | {
9 | public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
10 | {
11 | return TimeSpan.FromSeconds(reader.GetDouble());
12 | }
13 |
14 | public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options)
15 | {
16 | writer.WriteNumberValue(value.TotalSeconds);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/ICommonMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Models.ChatMessages;
2 |
3 | namespace Mirai.CSharp.Models.EventArgs
4 | {
5 | ///
6 | /// 提供通用消息的相关信息接口
7 | ///
8 | public interface ICommonMessageEventArgs : IMiraiMessage
9 | {
10 | ///
11 | /// 消息链数组
12 | ///
13 | IChatMessage[] Chain { get; }
14 | }
15 |
16 | ///
17 | /// 提供通用消息的相关信息接口。继承自 和
18 | ///
19 | public interface ICommonMessageEventArgs : ICommonMessageEventArgs, IMiraiMessage
20 | {
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupApplyEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供入群申请相关信息的接口。继承自
5 | ///
6 | public interface IGroupApplyEventArgs : ICommonGroupApplyEventArgs
7 | {
8 | ///
9 | /// 邀请人QQ号
10 | ///
11 | long? InvitorId { get; }
12 | }
13 |
14 | ///
15 | /// 提供入群申请相关信息的接口。继承自 和
16 | ///
17 | public interface IGroupApplyEventArgs : IGroupApplyEventArgs, ICommonGroupApplyEventArgs
18 | {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.VoiceConverter/DependencyInjection/SilkLameVoiceConverterDIExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Microsoft.Extensions.DependencyInjection.Extensions;
3 | using Mirai.CSharp.Services;
4 | using Mirai.CSharp.VoiceConverter;
5 |
6 | namespace Mirai_CSharp.VoiceConverter.DependencyInjection
7 | {
8 | public static class SilkLameVoiceConverterDIExtensions
9 | {
10 | public static IServiceCollection AddSilkLameVoiceConverter(this IServiceCollection services)
11 | {
12 | services.TryAddSingleton();
13 | services.TryAddSingleton();
14 | return services;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMuteAllChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供全员禁言设置被改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupMuteAllChangedEventArgs : IGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供全员禁言设置被改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMuteAllChangedEventArgs : IGroupMuteAllChangedEventArgs, IGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Hosting;
4 |
5 | namespace Mirai.CSharp.Example.Hosting
6 | {
7 | public class Program
8 | {
9 | public static Task Main(string[] args)
10 | {
11 | return CreateHostBuilder(args).RunConsoleAsync();
12 | }
13 |
14 | public static IHostBuilder CreateHostBuilder(string[] args)
15 | {
16 | return Host.CreateDefaultBuilder(args)
17 | .ConfigureWebHostDefaults(webBuilder =>
18 | {
19 | webBuilder.UseStartup();
20 | });
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/GroupApplyActions.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 指示如何处理加群请求
5 | ///
6 | public enum GroupApplyActions
7 | {
8 | ///
9 | /// 同意入群
10 | ///
11 | Allow = 0,
12 | ///
13 | /// 拒绝入群
14 | ///
15 | Deny = 1,
16 | ///
17 | /// 忽略请求
18 | ///
19 | Ignore = 2,
20 | ///
21 | /// 拒绝入群并添加黑名单, 不再接收该用户的入群申请
22 | ///
23 | DenyAndBlock = 3,
24 | ///
25 | /// 忽略入群并添加黑名单, 不再接收该用户的入群申请
26 | ///
27 | IgnoreAndBlock = 4
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/GroupMemberProfile.cs:
--------------------------------------------------------------------------------
1 | using ISharedGroupMemberProfile = Mirai.CSharp.Models.IGroupMemberProfile;
2 |
3 | namespace Mirai.CSharp.HttpApi.Models
4 | {
5 | ///
6 | public interface IGroupMemberProfile : ISharedGroupMemberProfile, ICommonProfile
7 | {
8 |
9 | }
10 |
11 | public class GroupMemberProfile : CommonProfile, IGroupMemberProfile
12 | {
13 | public GroupMemberProfile()
14 | {
15 |
16 | }
17 |
18 | public GroupMemberProfile(string nickname, string email, int age, int level, string sign, CSharp.Models.ProfileGender gender) : base(nickname, email, age, level, sign, gender)
19 | {
20 |
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/IFriendMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供好友消息的相关信息接口。继承自
5 | ///
6 | public interface IFriendMessageEventArgs : ICommonMessageEventArgs
7 | {
8 | ///
9 | /// 好友信息
10 | ///
11 | IFriendInfo Sender { get; }
12 | }
13 |
14 | ///
15 | /// 提供好友消息的相关信息接口。继承自 和
16 | ///
17 | public interface IFriendMessageEventArgs : IFriendMessageEventArgs, ICommonMessageEventArgs
18 | {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Session/IMiraiHttpSession.Management.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 |
8 | namespace Mirai.CSharp.HttpApi.Session
9 | {
10 | public partial interface IMiraiHttpSession
11 | {
12 | ///
13 | /// 异步获取已登录的所有QQ号
14 | ///
15 | ///
16 | /// 本 api 自 mirai-api-http v2.6.0 起可用
17 | ///
18 | /// 用于取消此异步操作的
19 | /// 表示此异步操作的
20 | Task GetBotListAsync(CancellationToken token = default);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/ICommonGroupApplyEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供入群申请/受邀入群相关信息的基接口。继承自
5 | ///
6 | public interface ICommonGroupApplyEventArgs : INewApplyEventArgs
7 | {
8 | ///
9 | /// 来源群名称
10 | ///
11 | string FromGroupName { get; }
12 | }
13 |
14 | ///
15 | /// 提供入群申请/受邀入群相关信息的基接口。继承自 和
16 | ///
17 | public interface ICommonGroupApplyEventArgs : ICommonGroupApplyEventArgs, INewApplyEventArgs
18 | {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Stranger/IStrangerMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供陌生人消息的相关信息接口。继承自
5 | ///
6 | public interface IStrangerMessageEventArgs : ICommonMessageEventArgs
7 | {
8 | ///
9 | /// 来源陌生人信息
10 | ///
11 | IStrangerInfo Sender { get; }
12 | }
13 |
14 | ///
15 | /// 提供陌生人消息的相关信息接口。继承自 和
16 | ///
17 | public interface IStrangerMessageEventArgs : IStrangerMessageEventArgs, ICommonMessageEventArgs
18 | {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupConfessTalkChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供坦白说设置被改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupConfessTalkChangedEventArgs : IGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供坦白说设置被改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupConfessTalkChangedEventArgs : IGroupConfessTalkChangedEventArgs, IGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/IFriendNickChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供好友昵称变更相关信息接口。继承自
5 | ///
6 | public interface IFriendNickChangedEventArgs : IFriendEventArgs, IPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供好友昵称变更相关信息接口。继承自 , 和
13 | ///
14 | public interface IFriendNickChangedEventArgs : IFriendNickChangedEventArgs, IFriendEventArgs, IPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupAnonymousChatChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供匿名聊天设置被改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupAnonymousChatChangedEventArgs : IGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供匿名聊天设置被改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupAnonymousChatChangedEventArgs : IGroupAnonymousChatChangedEventArgs, IGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberCardChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供群名片改动相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberCardChangedEventArgs : IGroupMemberPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供群名片改动相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberCardChangedEventArgs : IGroupMemberCardChangedEventArgs, IGroupMemberPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberInviteChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供群员邀请好友加群设置被改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberInviteChangedEventArgs : IGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供群员邀请好友加群设置被改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberInviteChangedEventArgs : IGroupMemberInviteChangedEventArgs, IGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/BotProfile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ISharedBotProfile = Mirai.CSharp.Models.IBotProfile;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models
5 | {
6 | ///
7 | public interface IBotProfile : ISharedBotProfile, ICommonProfile
8 | {
9 |
10 | }
11 |
12 | public class BotProfile : CommonProfile, IBotProfile
13 | {
14 | [Obsolete("此类不应由用户主动创建实例。")]
15 | public BotProfile()
16 | {
17 |
18 | }
19 |
20 | [Obsolete("此类不应由用户主动创建实例。")]
21 | public BotProfile(string nickname, string email, int age, int level, string sign, Mirai.CSharp.Models.ProfileGender gender) : base(nickname, email, age, level, sign, gender)
22 | {
23 |
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.Win32/Mirai-CSharp.NativeAssets.Win32.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 |
6 |
7 |
8 | <_NativeSilkLameFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libsilklame*.dll" Dir="x86\"/>
9 | <_NativeSilkLameFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libsilklame*.dll" Dir="x64\"/>
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/IFriendMessageRevokedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供好友撤回消息的相关信息接口。继承自
5 | ///
6 | public interface IFriendMessageRevokedEventArgs : IMessageRevokedEventArgs
7 | {
8 | ///
9 | /// 进行撤回操作的QQ号
10 | ///
11 | long Operator { get; }
12 | }
13 |
14 | ///
15 | /// 提供好友撤回消息的相关信息接口。继承自 和
16 | ///
17 | public interface IFriendMessageRevokedEventArgs : IFriendMessageRevokedEventArgs, IMessageRevokedEventArgs
18 | {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupDisbandEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mirai.CSharp.Models.EventArgs
8 | {
9 | ///
10 | /// 提供群被群主解散后bot离开群相关信息的接口。继承自
11 | ///
12 | public interface IGroupDisbandEventArgs : IGroupOperatingEventArgs
13 | {
14 |
15 | }
16 |
17 | ///
18 | /// 提供群被群主解散后bot离开群相关信息的接口。继承自 和
19 | ///
20 | public interface IGroupDisbandEventArgs : IGroupDisbandEventArgs, IGroupOperatingEventArgs
21 | {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/UserProfile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ISharedUserProfile = Mirai.CSharp.Models.IUserProfile;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models
5 | {
6 | ///
7 | public interface IUserProfile : ISharedUserProfile, ICommonProfile
8 | {
9 |
10 | }
11 |
12 | public class UserProfile : CommonProfile, IUserProfile
13 | {
14 | [Obsolete("此类不应由用户主动创建实例。")]
15 | public UserProfile()
16 | {
17 |
18 | }
19 |
20 | [Obsolete("此类不应由用户主动创建实例。")]
21 | public UserProfile(string nickname, string email, int age, int level, string sign, CSharp.Models.ProfileGender gender) : base(nickname, email, age, level, sign, gender)
22 | {
23 |
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Mirai-CSharp.NativeAssets.LinuxArm/Mirai-CSharp.NativeAssets.LinuxArm.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 |
6 |
7 |
8 | <_NativeSilkLameFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-arm\native\libsilklame*.dll" Dir="x86\"/>
9 | <_NativeSilkLameFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-arm64\native\libsilklame*.dll" Dir="x64\"/>
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupEntranceAnnouncementChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供入群公告改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupEntranceAnnouncementChangedEventArgs : IGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供入群公告改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupEntranceAnnouncementChangedEventArgs : IGroupEntranceAnnouncementChangedEventArgs, IGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Bot/IBotGroupPermissionChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供Bot在群里的权限被改变相关信息的接口。继承自
5 | ///
6 | public interface IBotGroupPermissionChangedEventArgs : IBotGroupPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供Bot在群里的权限被改变相关信息的接口。继承自 和
13 | ///
14 | public interface IBotGroupPermissionChangedEventArgs : IBotGroupPermissionChangedEventArgs, IBotGroupPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/IGroupMessageBaseEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace Mirai.CSharp.Models.EventArgs
4 | {
5 | ///
6 | /// 提供群消息和临时消息的相关信息基接口。继承自
7 | ///
8 | public interface IGroupMessageBaseEventArgs : ICommonMessageEventArgs
9 | {
10 | ///
11 | /// 消息发送者信息
12 | ///
13 | IGroupMemberInfo Sender { get; }
14 | }
15 |
16 | ///
17 | /// 提供群消息和临时消息的相关信息基接口。继承自 和
18 | ///
19 | public interface IGroupMessageBaseEventArgs : IGroupMessageBaseEventArgs, ICommonMessageEventArgs
20 | {
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberSpecialTitleChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供群头衔改动相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberSpecialTitleChangedEventArgs : IGroupMemberPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供群头衔改动相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberSpecialTitleChangedEventArgs : IGroupMemberSpecialTitleChangedEventArgs, IGroupMemberPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/FriendProfile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ISharedFriendProfile = Mirai.CSharp.Models.IFriendProfile;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models
5 | {
6 | ///
7 | public interface IFriendProfile : ISharedFriendProfile, ICommonProfile
8 | {
9 |
10 | }
11 |
12 | public class FriendProfile : CommonProfile, IFriendProfile
13 | {
14 | [Obsolete("此类不应由用户主动创建实例。")]
15 | public FriendProfile()
16 | {
17 |
18 | }
19 |
20 | [Obsolete("此类不应由用户主动创建实例。")]
21 | public FriendProfile(string nickname, string email, int age, int level, string sign, CSharp.Models.ProfileGender gender) : base(nickname, email, age, level, sign, gender)
22 | {
23 |
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IVoiceMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示语音消息的基接口
5 | ///
6 | public interface IVoiceMessage : IChatMessage
7 | {
8 | ///
9 | /// 语音文件名
10 | ///
11 | ///
12 | /// 此属性不为 时将忽略
13 | ///
14 | string? VoiceId { get; }
15 | ///
16 | /// 用于下载语音的Url
17 | ///
18 | ///
19 | /// 此属性不为 时将忽略
20 | ///
21 | string? Url { get; }
22 | ///
23 | /// 语音文件的路径
24 | ///
25 | string? Path { get; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupMessageRevokedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供群内撤回消息的相关信息接口。继承自 和
5 | ///
6 | public interface IGroupMessageRevokedEventArgs : IGroupOperatingEventArgs, IMessageRevokedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供群内撤回消息的相关信息接口。继承自 , 和
13 | ///
14 | public interface IGroupMessageRevokedEventArgs : IGroupMessageRevokedEventArgs, IGroupOperatingEventArgs, IMessageRevokedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/INewApplyEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供通用申请相关信息的接口。继承自
5 | ///
6 | public interface INewApplyEventArgs : IApplyResponseArgs
7 | {
8 | ///
9 | /// 申请人的昵称或群名片
10 | ///
11 | string NickName { get; }
12 |
13 | ///
14 | /// 申请消息
15 | ///
16 | string Message { get; }
17 | }
18 |
19 | ///
20 | /// 提供通用申请相关信息的接口。继承自 和
21 | ///
22 | public interface INewApplyEventArgs : INewApplyEventArgs, IApplyResponseArgs
23 | {
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:40870",
8 | "sslPort": 0
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "Mirai_CSharp.Example.Hosting": {
19 | "commandName": "Project",
20 | "environmentVariables": {
21 | "ASPNETCORE_ENVIRONMENT": "Development"
22 | },
23 | "applicationUrl": "http://localhost:5000",
24 | "dotnetRunMessages": "true"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Mirai-CSharp/Framework/Invoking/MessageSubscription.RegistrationNode.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Framework.Handlers;
2 |
3 | // see: https://source.dot.net/System.Private.CoreLib/CancellationTokenSource.cs.html#e46e9cfd59295b58
4 | namespace Mirai.CSharp.Framework.Invoking
5 | {
6 | public partial class MessageSubscription
7 | {
8 | protected internal sealed class RegistrationNode
9 | {
10 | public readonly Registrations Registrations;
11 | public RegistrationNode? Prev;
12 | public RegistrationNode? Next;
13 |
14 | public long Id;
15 | public IMessageHandler? Handler;
16 |
17 | public RegistrationNode(Registrations registrations)
18 | {
19 | Registrations = registrations;
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/Specialized/IGroupMemberPermissionChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供成员权限改变相关信息的接口。继承自
5 | ///
6 | public interface IGroupMemberPermissionChangedEventArgs : IGroupMemberPropertyChangedEventArgs
7 | {
8 |
9 | }
10 |
11 | ///
12 | /// 提供成员权限改变相关信息的接口。继承自 和
13 | ///
14 | public interface IGroupMemberPermissionChangedEventArgs : IGroupMemberPermissionChangedEventArgs, IGroupMemberPropertyChangedEventArgs
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/ChatMessages/ChatMessage.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using ISharedChatMessage = Mirai.CSharp.Models.ChatMessages.IChatMessage;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models.ChatMessages
5 | {
6 | ///
7 | /// 聊天消息的基接口
8 | ///
9 | public interface IChatMessage : ISharedChatMessage, IMiraiHttpMessage
10 | {
11 | ///
12 | /// 消息类型。供api或反序列化使用
13 | ///
14 | [JsonPropertyName("type")]
15 | string Type { get; }
16 | }
17 |
18 | ///
19 | /// 聊天消息的基类
20 | ///
21 | public abstract class ChatMessage : MiraiHttpMessage, IChatMessage
22 | {
23 | ///
24 | [JsonPropertyName("type")]
25 | public abstract string Type { get; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Session/MiraiHttpSession.Validation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace Mirai.CSharp.HttpApi.Session
5 | {
6 | public partial class MiraiHttpSession
7 | {
8 | protected void CheckDisposed()
9 | {
10 | if (Volatile.Read(ref _instanceCts) == null)
11 | {
12 | throw new ObjectDisposedException(nameof(MiraiHttpSession));
13 | }
14 | }
15 |
16 | protected InternalSessionInfo SafeGetSession()
17 | {
18 | CheckDisposed();
19 | InternalSessionInfo? session = _currentSession;
20 | if (session == null || !session.Connected)
21 | {
22 | throw new InvalidOperationException("请先连接到一个Session。");
23 | }
24 | return session;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.FetchProfile.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Mirai.CSharp.Models;
4 |
5 | namespace Mirai.CSharp.Session
6 | {
7 | public partial class MiraiSession
8 | {
9 | ///
10 | public abstract Task GetBotProfileAsync(CancellationToken token = default);
11 |
12 | ///
13 | public abstract Task GetFriendProfileAsync(long qqNumber, CancellationToken token = default);
14 |
15 | ///
16 | public abstract Task GetGroupMemberProfileAsync(long groupMember, long qqNumber, CancellationToken token = default);
17 |
18 | ///
19 | public abstract Task GetUserProfileAsync(long qqNumber, CancellationToken token = default);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Session/PluginResistration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Mirai.CSharp.Framework.Invoking;
4 |
5 | namespace Mirai.CSharp.HttpApi.Session
6 | {
7 | public struct PluginResistration : IDisposable
8 | {
9 | internal LinkedList? _registrations;
10 |
11 | public PluginResistration(LinkedList registrations)
12 | {
13 | _registrations = registrations;
14 | }
15 |
16 | public void Dispose()
17 | {
18 | if (_registrations is LinkedList registrations)
19 | {
20 | foreach (var registration in registrations)
21 | {
22 | registration.Dispose();
23 | }
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/IQuoteMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示引用消息的基接口
5 | ///
6 | public interface IQuoteMessage : IChatMessage
7 | {
8 | ///
9 | /// 被引用回复的原消息的messageId
10 | ///
11 | int Id { get; }
12 | ///
13 | /// 被引用回复的原消息所接收的群号, 当为好友消息时为0
14 | ///
15 | long GroupId { get; }
16 | ///
17 | /// 被引用回复的原消息的发送者的QQ号
18 | ///
19 | long SenderId { get; }
20 | ///
21 | /// 被引用回复的原消息的接收者者的QQ号(或群号)
22 | ///
23 | long TargetId { get; }
24 | ///
25 | /// 被引用回复的原消息的消息链数组
26 | ///
27 | IChatMessage[]? OriginChain { get; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/IMiraiSession.Nudge.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Mirai.CSharp.Models;
4 |
5 | namespace Mirai.CSharp.Session
6 | {
7 | public partial interface IMiraiSession
8 | {
9 | ///
10 | /// 异步发送头像戳一戳消息
11 | ///
12 | /// 要戳的对象
13 | /// 要戳的QQ号 (可以是Bot自己)
14 | /// 要戳的对象所在的群号 (戳 / 时可以为 )
15 | /// 用于取消此异步操作的
16 | /// 表示此异步操作的
17 | Task NudgeAsync(NudgeTarget target, long qqNumber, long? groupNumber = null, CancellationToken token = default);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/IMessageRevokedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models.EventArgs
4 | {
5 | ///
6 | /// 提供撤回消息的通用信息接口
7 | ///
8 | public interface IMessageRevokedEventArgs : IMiraiMessage
9 | {
10 | ///
11 | /// 原消息发送者的QQ号
12 | ///
13 | long SenderId { get; }
14 | ///
15 | /// 原消息Id
16 | ///
17 | int MessageId { get; }
18 | ///
19 | /// 原消息发送时间
20 | ///
21 | DateTime SentTime { get; }
22 | }
23 |
24 | ///
25 | /// 提供撤回消息的通用信息接口。继承自
26 | ///
27 | public interface IMessageRevokedEventArgs : IMessageRevokedEventArgs, IMiraiMessage
28 | {
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供群信息的接口
5 | ///
6 | public interface IGroupConfig
7 | {
8 | ///
9 | /// 群名
10 | ///
11 | string? Name { get; }
12 | ///
13 | /// 群公告
14 | ///
15 | string? Announcement { get; }
16 | ///
17 | /// 是否允许坦白说
18 | ///
19 | bool? ConfessTalk { get; }
20 | ///
21 | /// 是否允许群成员邀请新用户
22 | ///
23 | bool? MemberInvite { get; }
24 | ///
25 | /// 是否自动通过入群申请
26 | ///
27 | bool? AutoApprove { get; }
28 | ///
29 | /// 是否允许匿名聊天
30 | ///
31 | bool? AnonymousChat { get; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.Application.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Mirai.CSharp.Models;
4 | using Mirai.CSharp.Models.EventArgs;
5 |
6 | namespace Mirai.CSharp.Session
7 | {
8 | public abstract partial class MiraiSession
9 | {
10 | ///
11 | public abstract Task HandleBotInvitedJoinGroupAsync(IApplyResponseArgs args, GroupApplyActions action, string? message = null, CancellationToken token = default);
12 |
13 | ///
14 | public abstract Task HandleGroupApplyAsync(IApplyResponseArgs args, GroupApplyActions action, string? message = null, CancellationToken token = default);
15 |
16 | ///
17 | public abstract Task HandleNewFriendApplyAsync(IApplyResponseArgs args, FriendApplyAction action, string? message = null, CancellationToken token = default);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Controllers/RobotController.AddGroupMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Mirai.CSharp.Example.Hosting.Handlers;
6 | using Mirai.CSharp.HttpApi.Session;
7 |
8 | namespace Mirai.CSharp.Example.Hosting.Controllers
9 | {
10 | public sealed partial class RobotController
11 | {
12 | [HttpGet]
13 | [HttpPost]
14 | [Route("[action]")]
15 | public async Task AddGroupMessageHandlerAsync([Required] int robotQQ, CancellationToken token)
16 | {
17 | IMiraiHttpSession session = await _robotManager.RetriveSessionAsync(robotQQ, token);
18 | session.AddPlugin(new GroupMessageHandler());
19 | return (JsonResult)ResponseModel.CreateSuccess();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Group/IGroupSyncMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mirai.CSharp.Models.EventArgs
8 | {
9 | ///
10 | /// 提供群同步消息相关信息的接口。继承自
11 | ///
12 | public interface IGroupSyncMessageEventArgs : ICommonMessageEventArgs
13 | {
14 | ///
15 | /// 目标群信息
16 | ///
17 | IGroupInfo Subject { get; }
18 | }
19 |
20 | ///
21 | /// 提供群同步消息相关信息的接口。继承自 和
22 | ///
23 | public interface IGroupSyncMessageEventArgs : IGroupSyncMessageEventArgs, ICommonMessageEventArgs
24 | {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example.Hosting/Controllers/RobotController.AddFriendMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Mirai.CSharp.Example.Hosting.Handlers;
6 | using Mirai.CSharp.HttpApi.Session;
7 |
8 | namespace Mirai.CSharp.Example.Hosting.Controllers
9 | {
10 | public sealed partial class RobotController
11 | {
12 | [HttpGet]
13 | [HttpPost]
14 | [Route("[action]")]
15 | public async Task AddFriendMessageHandlerAsync([Required] int robotQQ, CancellationToken token)
16 | {
17 | IMiraiHttpSession session = await _robotManager.RetriveSessionAsync(robotQQ, token);
18 | session.AddPlugin(new FriendMessageHandler());
19 | return (JsonResult)ResponseModel.CreateSuccess();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Temp/ITempSyncMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mirai.CSharp.Models.EventArgs
8 | {
9 | ///
10 | /// 提供临时同步消息的相关信息接口。继承自
11 | ///
12 | public interface ITempSyncMessageEventArgs : ICommonMessageEventArgs
13 | {
14 | ///
15 | /// 目标群成员信息
16 | ///
17 | IGroupMemberInfo Subject { get; }
18 | }
19 |
20 | ///
21 | /// 提供临时同步消息的相关信息接口。继承自 和
22 | ///
23 | public interface ITempSyncMessageEventArgs : ITempSyncMessageEventArgs, ICommonMessageEventArgs
24 | {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Friend/IFriendSyncMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mirai.CSharp.Models.EventArgs
8 | {
9 | ///
10 | /// 提供好友同步消息的相关信息接口。继承自
11 | ///
12 | public interface IFriendSyncMessageEventArgs : ICommonMessageEventArgs
13 | {
14 | ///
15 | /// 目标好友信息
16 | ///
17 | IFriendInfo Subject { get; }
18 | }
19 |
20 | ///
21 | /// 提供好友同步消息的相关信息接口。继承自 和
22 | ///
23 | public interface IFriendSyncMessageEventArgs : IFriendSyncMessageEventArgs, ICommonMessageEventArgs
24 | {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/Stranger/IStrangerSyncMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mirai.CSharp.Models.EventArgs
8 | {
9 | ///
10 | /// 提供陌生人同步消息的相关信息接口。继承自
11 | ///
12 | public interface IStrangerSyncMessageEventArgs : ICommonMessageEventArgs
13 | {
14 | ///
15 | /// 目标陌生人信息
16 | ///
17 | IStrangerInfo Subject { get; }
18 | }
19 |
20 | ///
21 | /// 提供陌生人同步消息的相关信息接口。继承自 和
22 | ///
23 | public interface IStrangerSyncMessageEventArgs : IStrangerSyncMessageEventArgs, ICommonMessageEventArgs
24 | {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Mirai-CSharp.HttpApi.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Mirai.CSharp.HttpApi
5 | Using this project to interop with mirai-api-http
6 | mirai-api-http mirai
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example/Mirai-CSharp.Example.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | net6.0
7 |
9 | Mirai.CSharp.Example
10 |
11 |
12 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Extensions/HttpClientExtensions.PostEmptyContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace Mirai.CSharp.HttpApi.Extensions
7 | {
8 | public static partial class HttpClientExtensions
9 | {
10 | ///
11 | /// 异步发起一个 HttpPost 请求
12 | ///
13 | ///
14 | public static Task PostAsync(this HttpClient client, Uri uri, CancellationToken token = default)
15 | => client.PostAsync(uri, null!, token);
16 |
17 | ///
18 | public static Task PostAsync(this HttpClient client, string url, CancellationToken token = default)
19 | => client.PostAsync(new Uri(url), token);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example/ExamplePlugin.GroupApply.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Mirai.CSharp.HttpApi.Handlers;
3 | using Mirai.CSharp.HttpApi.Models.EventArgs;
4 | using Mirai.CSharp.HttpApi.Parsers;
5 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
6 | using Mirai.CSharp.HttpApi.Session;
7 | using Mirai.CSharp.Models;
8 |
9 | namespace Mirai.CSharp.Example
10 | {
11 | [RegisterMiraiHttpParser(typeof(DefaultMappableMiraiHttpMessageParser))]
12 | public partial class ExamplePlugin : IMiraiHttpMessageHandler
13 | {
14 | public async Task HandleMessageAsync(IMiraiHttpSession session, IGroupApplyEventArgs e)
15 | {
16 | // 把整个事件信息直接作为第一个参数即可, 然后根据自己需要选择一个 GroupApplyActions 枚举去处理请求
17 | // 你也可以暂存 IGroupApplyEventArgs e, 之后再调用session处理
18 | await session.HandleGroupApplyAsync(e, GroupApplyActions.Deny, "略略略");
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Handlers/MiraiHttpMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Handlers;
2 | using Mirai.CSharp.HttpApi.Models;
3 | using Mirai.CSharp.HttpApi.Session;
4 |
5 | namespace Mirai.CSharp.HttpApi.Handlers
6 | {
7 | ///
8 | /// 表示处理 类型消息或者比其派生程度更高的消息的接口
9 | ///
10 | ///
11 | /// 如需处理固定为 的消息, 请使用
12 | ///
13 | public interface IMiraiHttpMessageHandler : IMiraiHttpMessageHandlerBase, IMiraiMessageHandler, IContravarianceMiraiHttpMessageHandler where TMessage : IMiraiHttpMessage
14 | {
15 |
16 | }
17 |
18 | public abstract class MiraiHttpMessageHandler : MiraiHttpMessageHandlerBase, IMiraiHttpMessageHandler where TMessage : IMiraiHttpMessage
19 | {
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupFileDownloadInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models
4 | {
5 | ///
6 | /// 提供群文件下载信息的接口
7 | ///
8 | public interface IGroupFileDownloadInfo
9 | {
10 | ///
11 | /// 对象 Sha1 校验值
12 | ///
13 | string Sha1 { get; }
14 |
15 | ///
16 | /// 对象 Md5 哈希值
17 | ///
18 | string Md5 { get; }
19 |
20 | ///
21 | /// 对象下载链接
22 | ///
23 | string? Url { get; }
24 |
25 | ///
26 | /// 对象被下载次数
27 | ///
28 | int DownloadedTimes { get; }
29 |
30 | ///
31 | /// 对象创建时间
32 | ///
33 | DateTime CreateTime { get; }
34 |
35 | ///
36 | /// 对象修改时间
37 | ///
38 | DateTime ModifyTime { get; }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Handlers/DedicateMiraiMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.Handlers;
2 | using Mirai.CSharp.HttpApi.Models;
3 | using Mirai.CSharp.HttpApi.Session;
4 |
5 | namespace Mirai.CSharp.HttpApi.Handlers
6 | {
7 | ///
8 | /// 表示仅处理 类型消息的接口
9 | ///
10 | ///
11 | /// 如需处理比 派生程度更高的消息, 请使用
12 | ///
13 | public interface IDedicateMiraiHttpMessageHandler : IMiraiHttpMessageHandlerBase, IDedicateMiraiMessageHandler, IInvarianceMiraiHttpMessageHandler where TMessage : IMiraiHttpMessage
14 | {
15 |
16 | }
17 |
18 | public abstract class DedicateMiraiHttpMessageHandler : MiraiHttpMessageHandlerBase, IDedicateMiraiHttpMessageHandler where TMessage : IMiraiHttpMessage
19 | {
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotOnlineEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotOnlineEventArgs = Mirai.CSharp.Models.EventArgs.IBotOnlineEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot登录成功信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotOnlineEvent")]
11 | public interface IBotOnlineEventArgs : ISharedBotOnlineEventArgs, IBotEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotOnlineEventArgs : BotEventArgs, IBotOnlineEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotOnlineEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotOnlineEventArgs(long qqNumber) : base(qqNumber)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotReloginEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotReloginEventArgs = Mirai.CSharp.Models.EventArgs.IBotReloginEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot主动重新登录信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotReloginEvent")]
11 | public interface IBotReloginEventArgs : ISharedBotReloginEventArgs, IBotEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotReloginEventArgs : BotEventArgs, IBotReloginEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotReloginEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotReloginEventArgs(long qqNumber) : base(qqNumber)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/IApplyResponseArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.EventArgs
2 | {
3 | ///
4 | /// 提供用于处理相关申请所需信息的接口
5 | ///
6 | public interface IApplyResponseArgs : IMiraiMessage
7 | {
8 | ///
9 | /// 事件Id, 供 mirai-api-http 使用
10 | ///
11 | long EventId { get; }
12 |
13 | ///
14 | /// 申请人QQ号
15 | ///
16 | long FromQQ { get; }
17 |
18 | ///
19 | /// 申请来源群号
20 | ///
21 | ///
22 | /// 在好友添加事件中, 如果申请人通过某个群添加好友, 该项为该群群号, 否则为0
23 | ///
24 | long FromGroup { get; }
25 | }
26 |
27 | ///
28 | /// 提供用于处理相关申请所需信息的接口。继承自 和
29 | ///
30 | public interface IApplyResponseArgs : IApplyResponseArgs, IMiraiMessage
31 | {
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/IPropertyChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1712 // Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
2 | namespace Mirai.CSharp.Models.EventArgs
3 | {
4 | ///
5 | /// 提供修改前和修改后的 信息接口
6 | ///
7 | /// 属性类型
8 | public interface IPropertyChangedEventArgs : IMiraiMessage
9 | {
10 | ///
11 | /// 修改前
12 | ///
13 | TProperty Origin { get; }
14 | ///
15 | /// 修改后
16 | ///
17 | TProperty Current { get; }
18 | }
19 |
20 | ///
21 | /// 消息原始数据类型
22 | public interface IPropertyChangedEventArgs : IPropertyChangedEventArgs, IMiraiMessage
23 | {
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.SendImage.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Mirai.CSharp.Models;
5 | using Mirai.CSharp.Models.ChatMessages;
6 |
7 | namespace Mirai.CSharp.Session
8 | {
9 | public abstract partial class MiraiSession
10 | {
11 | public abstract Task SendImageToFriendAsync(long qqNumber, string[] urls, CancellationToken token = default);
12 |
13 | public abstract Task SendImageToGroupAsync(long groupNumber, string[] urls, CancellationToken token = default);
14 |
15 | public abstract Task SendImageToTempAsync(long qqNumber, long groupNumber, string[] urls, CancellationToken token = default);
16 |
17 | public abstract Task UploadPictureAsync(UploadTarget type, Stream image, CancellationToken token = default);
18 |
19 | public abstract Task UploadPictureAsync(UploadTarget type, string imagePath, CancellationToken token = default);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotUnmutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotUnmutedEventArgs = Mirai.CSharp.Models.EventArgs.IBotUnmutedEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot被解除禁言事件相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotUnmuteEvent")]
11 | public interface IBotUnmutedEventArgs : ISharedBotUnmutedEventArgs, IOperatorEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotUnmutedEventArgs : OperatorEventArgs, IBotUnmutedEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotUnmutedEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotUnmutedEventArgs(GroupMemberInfo @operator) : base(@operator)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.Example/ExamplePlugin.NewFriendApply.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.HttpApi.Handlers;
2 | using Mirai.CSharp.HttpApi.Models.EventArgs;
3 | using Mirai.CSharp.HttpApi.Parsers;
4 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
5 | using Mirai.CSharp.HttpApi.Session;
6 | using Mirai.CSharp.Models;
7 | using System.Threading.Tasks;
8 |
9 | namespace Mirai.CSharp.Example
10 | {
11 | [RegisterMiraiHttpParser(typeof(DefaultMappableMiraiHttpMessageParser))]
12 | public partial class ExamplePlugin : IMiraiHttpMessageHandler
13 | {
14 | public async Task HandleMessageAsync(IMiraiHttpSession session, INewFriendApplyEventArgs e)
15 | {
16 | await session.HandleNewFriendApplyAsync(e, FriendApplyAction.Deny, "略略略");
17 | // 把整个事件信息直接作为第一个参数即可, 然后根据自己需要选择一个 FriendApplyAction 枚举去处理请求
18 | // 你也可以暂存 INewFriendApplyEventArgs e, 之后再调用 session 处理
19 | e.BlockRemainingHandlers = false;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Extensions/HttpClientExtensions.PostByteArrayContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace Mirai.CSharp.HttpApi.Extensions
7 | {
8 | public static partial class HttpClientExtensions
9 | {
10 | ///
11 | /// 异步发起一个 HttpPost 请求
12 | ///
13 | ///
14 | public static Task PostAsync(this HttpClient client, Uri uri, byte[] content, CancellationToken token = default)
15 | => client.PostAsync(uri, new ByteArrayContent(content), token);
16 |
17 | ///
18 | public static Task PostAsync(this HttpClient client, string url, byte[] content, CancellationToken token = default)
19 | => client.PostAsync(new Uri(url), content, token);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Parsers/MiraiHttpChatMessageParser.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.HttpApi.Models.ChatMessages;
2 |
3 | namespace Mirai.CSharp.HttpApi.Parsers
4 | {
5 | ///
6 | /// 表示处理mirai-api-http消息的
7 | ///
8 | public interface IMiraiHttpChatMessageParser : IMiraiHttpMessageParserBase
9 | {
10 |
11 | }
12 |
13 | ///
14 | /// 表示处理mirai-api-http消息的
15 | ///
16 | ///
17 | public interface IMiraiHttpChatMessageParser : IMiraiHttpChatMessageParser,
18 | IMiraiHttpMessageParserBase where TMessage : IChatMessage
19 | {
20 |
21 | }
22 |
23 | public abstract class MiraiHttpChatMessageParser : MiraiHttpMessageParserBase, IMiraiHttpChatMessageParser where TMessage : IChatMessage
24 | {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Utility/JsonConverters/ChangeTypeJsonConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Mirai.CSharp.HttpApi.Utility.JsonConverters
6 | {
7 | public class ChangeTypeJsonConverter : ChangeTypeJsonConverter where TFrom : notnull where TTo : TFrom
8 | {
9 |
10 | }
11 |
12 | public class ChangeTypeJsonConverter : JsonConverter where TDeserializeTo : TFrom where TFrom : notnull, TSerializeTo
13 | {
14 | public override TFrom Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
15 | {
16 | return JsonSerializer.Deserialize(ref reader, options)!;
17 | }
18 |
19 | public override void Write(Utf8JsonWriter writer, TFrom value, JsonSerializerOptions options)
20 | {
21 | JsonSerializer.Serialize(writer, value!, options);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotDroppedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotDroppedEventArgs = Mirai.CSharp.Models.EventArgs.IBotDroppedEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot意外断开连接信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotOfflineEventDropped")]
11 | public interface IBotDroppedEventArgs : ISharedBotDroppedEventArgs, IBotEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotDroppedEventArgs : BotEventArgs, IBotDroppedEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotDroppedEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotDroppedEventArgs(long qqNumber) : base(qqNumber)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Parsers/MiraiHttpMessageParser.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.HttpApi.Models;
2 | using Mirai.CSharp.Parsers;
3 |
4 | namespace Mirai.CSharp.HttpApi.Parsers
5 | {
6 | ///
7 | /// 表示处理mirai-api-http消息的
8 | ///
9 | public interface IMiraiHttpMessageParser : IMiraiHttpMessageParserBase
10 | {
11 |
12 | }
13 |
14 | ///
15 | /// 表示处理mirai-api-http消息的
16 | ///
17 | ///
18 | public interface IMiraiHttpMessageParser : IMiraiHttpMessageParser,
19 | IMiraiHttpMessageParserBase where TMessage : IMiraiHttpMessage
20 | {
21 |
22 | }
23 |
24 | public abstract class MiraiHttpMessageParser : MiraiHttpMessageParserBase, IMiraiHttpMessageParser where TMessage : IMiraiHttpMessage
25 | {
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupAnnouncement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Models
4 | {
5 | ///
6 | /// 提供群公告基本信息的接口
7 | ///
8 | public interface IGroupAnnouncement
9 | {
10 | ///
11 | /// 群公告Id
12 | ///
13 | string Id { get; }
14 | ///
15 | /// 群信息
16 | ///
17 | IGroupInfo Group { get; }
18 | ///
19 | /// 群公告内容
20 | ///
21 | string Content { get; }
22 | ///
23 | /// 发布者QQ号
24 | ///
25 | long Sender { get; }
26 | ///
27 | /// 是否所有群成员已确认
28 | ///
29 | bool AllMemberConfirmed { get; }
30 | ///
31 | /// 已确认群成员人数
32 | ///
33 | int ConfirmedMembersCount { get; }
34 | ///
35 | /// 发布时间
36 | ///
37 | DateTime CreateTime { get; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/PokeType.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 戳一戳的类型。
5 | ///
6 | ///
7 | /// SVIP的Poke带Id, 无法表示两个值, 不写。
8 | /// 详见
9 | ///
10 | public enum PokeType
11 | {
12 | ///
13 | /// 戳一戳
14 | ///
15 | Poke = 1,
16 | ///
17 | /// 比心
18 | ///
19 | ShowLove,
20 | ///
21 | /// 点赞
22 | ///
23 | Like,
24 | ///
25 | /// 心碎
26 | ///
27 | Heartbroken,
28 | ///
29 | /// 666
30 | ///
31 | SixSixSix,
32 | ///
33 | /// 放大招
34 | ///
35 | FangDaZhao,
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/ICommonImageMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示图片消息的基接口
5 | ///
6 | public interface ICommonImageMessage : IChatMessage
7 | {
8 | ///
9 | /// 图片的imageId, 群图片与好友图片格式不同。不为空时将忽略url属性
10 | ///
11 | ///
12 | /// 格式如下:
13 | ///
14 | /// - {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.mirai群图片
15 | /// - /XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX好友图片
16 | ///
17 | ///
18 | string? ImageId { get; }
19 | ///
20 | /// 图片的URL, 发送时可作网络图片的链接;接收时为腾讯图片服务器的链接, 可用于图片下载
21 | ///
22 | string? Url { get; }
23 | ///
24 | /// 图片的路径, 发送本地图片, 相对路径于 plugins/MiraiAPIHTTP/images
25 | ///
26 | string? Path { get; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.GroupAnnouncement.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Mirai.CSharp.Models;
4 |
5 | namespace Mirai.CSharp.Session
6 | {
7 | public partial class MiraiSession
8 | {
9 | ///
10 | public abstract Task GetGroupAnnouncementAsync(long groupNumber, int offset, int count, CancellationToken token = default);
11 |
12 | ///
13 | public abstract Task PublishGroupAnnouncementAsync(long groupNumber, IPublishGroupAnnouncementRequest request, CancellationToken token = default);
14 |
15 | ///
16 | public abstract Task DeleteGroupAnnouncementAsync(long groupNumber, string id, CancellationToken token = default);
17 |
18 | ///
19 | public virtual Task DeleteGroupAnnouncementAsync(long groupNumber, IGroupAnnouncement announcement, CancellationToken token = default)
20 | => DeleteGroupAnnouncementAsync(groupNumber, announcement.Id, token);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Invoking/IMiraiHttpMessageSubscription.cs:
--------------------------------------------------------------------------------
1 | using Mirai.CSharp.HttpApi.Handlers;
2 | using Mirai.CSharp.HttpApi.Models;
3 | using Mirai.CSharp.HttpApi.Session;
4 | using Mirai.CSharp.Invoking;
5 | #if !NETSTANDARD2_0
6 | using System.Threading.Tasks;
7 | #endif
8 |
9 | namespace Mirai.CSharp.HttpApi.Invoking
10 | {
11 | public interface IMiraiHttpMessageSubscription : IMiraiMessageSubscription, IMiraiHttpMessageHandler
12 | {
13 |
14 | }
15 |
16 | public interface IMiraiHttpMessageSubscription : IMiraiHttpMessageSubscription,
17 | IMiraiMessageSubscription,
18 | IMiraiHttpMessageHandler where TMessage : IMiraiHttpMessage
19 | {
20 | #if !NETSTANDARD2_0
21 | Task IMiraiHttpMessageHandler.HandleMessageAsync(IMiraiHttpSession client, IMiraiHttpMessage message)
22 | => HandleMessageAsync(client, (TMessage)message);
23 | #endif
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Utility/JsonConverters/UnixTimeStampJsonConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Mirai.CSharp.HttpApi.Utility.JsonConverters
6 | {
7 | public class UnixTimeStampJsonConverter : JsonConverter
8 | {
9 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
10 | {
11 | return reader.TokenType switch
12 | {
13 | JsonTokenType.Number => Utils.UnixTime2DateTime(reader.GetInt32()),
14 | JsonTokenType.String => DateTime.Parse(reader.GetString()!),
15 | _ => throw new ArgumentException($"Expected unix timestamp or datetime string, got {reader.TokenType}")
16 | };
17 | }
18 |
19 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
20 | {
21 | writer.WriteNumberValue(Utils.DateTime2UnixTimeSeconds(value));
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/ChatMessages/ISharedMusicMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models.ChatMessages
2 | {
3 | ///
4 | /// 表示分享音乐消息的基接口
5 | ///
6 | public interface ISharedMusicMessage : IChatMessage
7 | {
8 | ///
9 | /// 类型
10 | ///
11 | string Kind { get; }
12 |
13 | ///
14 | /// 标题
15 | ///
16 | string Title { get; }
17 |
18 | ///
19 | /// 简述
20 | ///
21 | string Summary { get; }
22 |
23 | ///
24 | /// 跳转链接
25 | ///
26 | string JumpUrl { get; }
27 |
28 | ///
29 | /// 封面图片链接
30 | ///
31 | string PictureUrl { get; }
32 |
33 | ///
34 | /// 音源链接
35 | ///
36 | string MusicUrl { get; }
37 |
38 | ///
39 | /// 简介
40 | ///
41 | string Brief { get; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotKickedOfflineEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotKickedOfflineEventArgs = Mirai.CSharp.Models.EventArgs.IBotKickedOfflineEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot被挤下线信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotOfflineEventForce")]
11 | public interface IBotKickedOfflineEventArgs : ISharedBotKickedOfflineEventArgs, IBotEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotKickedOfflineEventArgs : BotEventArgs, IBotKickedOfflineEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotKickedOfflineEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotKickedOfflineEventArgs(long qqNumber) : base(qqNumber)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotPositiveOfflineEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotPositiveOfflineEventArgs = Mirai.CSharp.Models.EventArgs.IBotPositiveOfflineEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot主动离线信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotOfflineEventActive")]
11 | public interface IBotPositiveOfflineEventArgs : ISharedBotPositiveOfflineEventArgs, IBotEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotPositiveOfflineEventArgs : BotEventArgs, IBotOnlineEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotPositiveOfflineEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotPositiveOfflineEventArgs(long qqNumber) : base(qqNumber)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Session/MiraiSession.Command.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | namespace Mirai.CSharp.Session
6 | {
7 | public abstract partial class MiraiSession
8 | {
9 | ///
10 | public virtual Task ExecuteCommandAsync(string name, params string[]? args)
11 | {
12 | return ExecuteCommandAsync(name, args, default);
13 | }
14 |
15 | ///
16 | public abstract Task ExecuteCommandAsync(string name, string[]? args, CancellationToken token = default);
17 |
18 | ///
19 | public abstract Task RegisterCommandAsync(string name, string[]? alias = null, string? description = null, string? usage = null, CancellationToken token = default);
20 |
21 | ///
22 | [Obsolete("新版本的 mirai-console 中已经没有管理员概念了, 参考: https://github.com/project-mirai/mirai-api-http/pull/265#discussion_r598428011")]
23 | public abstract Task GetManagersAsync(long qqNumber, CancellationToken token = default);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/ChatMessages/AtAllMessage.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Text.Json.Serialization;
3 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
4 | using ISharedAtAllMessage = Mirai.CSharp.Models.ChatMessages.IAtAllMessage;
5 |
6 | namespace Mirai.CSharp.HttpApi.Models.ChatMessages
7 | {
8 | ///
9 | [MappableMiraiChatMessageKey(AtAllMessage.MsgType)]
10 | public interface IAtAllMessage : ISharedAtAllMessage, IChatMessage
11 | {
12 |
13 | }
14 |
15 | [DebuggerDisplay("{ToString(),nq}")]
16 | public class AtAllMessage : ChatMessage, IAtAllMessage
17 | {
18 | public const string MsgType = "AtAll";
19 |
20 | [JsonPropertyName("type")]
21 | public override string Type => MsgType;
22 | ///
23 | /// 初始化 类的新实例
24 | ///
25 | public AtAllMessage()
26 | {
27 |
28 | }
29 | ///
30 | public override string ToString()
31 | => "[mirai:atall]";
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotKickedOutEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotKickedOutEventArgs = Mirai.CSharp.Models.EventArgs.IBotKickedOutEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot被踢出一个群相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotLeaveEventKick")]
11 | public interface IBotKickedOutEventArgs : ISharedBotKickedOutEventArgs, IGroupOperatingEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotKickedOutEventArgs : GroupOperatingEventArgs, IBotKickedOutEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotKickedOutEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotKickedOutEventArgs(IGroupInfo group, IGroupMemberInfo @operator) : base(group, @operator)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Group/GroupDisbandEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedGroupDisbandEventArgs = Mirai.CSharp.Models.EventArgs.IGroupDisbandEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs.Group
6 | {
7 | ///
8 | /// 提供群被群主解散后bot离开群相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotLeaveEventDisband")]
11 | public interface IGroupDisbandEventArgs : ISharedGroupDisbandEventArgs, IGroupOperatingEventArgs
12 | {
13 |
14 | }
15 |
16 | public class GroupDisbandEventArgs : GroupOperatingEventArgs, IGroupDisbandEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public GroupDisbandEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public GroupDisbandEventArgs(IGroupInfo group, IGroupMemberInfo @operator) : base(group, @operator)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Parsers/MiraiHttpMessageParserBase.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json;
2 | using Mirai.CSharp.HttpApi.Models;
3 | using Mirai.CSharp.Parsers;
4 |
5 | namespace Mirai.CSharp.HttpApi.Parsers
6 | {
7 | ///
8 | /// 表示处理mirai-api-http消息的
9 | ///
10 | public interface IMiraiHttpMessageParserBase : IMiraiMessageParser
11 | {
12 |
13 | }
14 |
15 | ///
16 | /// 表示处理mirai-api-http消息的
17 | ///
18 | ///
19 | public interface IMiraiHttpMessageParserBase : IMiraiHttpMessageParserBase,
20 | IMiraiMessageParser where TMessage : IMiraiHttpMessage
21 | {
22 |
23 | }
24 |
25 | public abstract class MiraiHttpMessageParserBase : MiraiMessageParser, IMiraiHttpMessageParserBase where TMessage : IMiraiHttpMessage
26 | {
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/StrangerInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using ISharedStrangerInfo = Mirai.CSharp.Models.IStrangerInfo;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models
5 | {
6 | ///
7 | public interface IStrangerInfo : ISharedStrangerInfo, IBaseInfo
8 | {
9 | #if !NETSTANDARD2_0
10 | [JsonPropertyName("remark")]
11 | abstract string ISharedStrangerInfo.Remark { get; }
12 | #else
13 | [JsonPropertyName("remark")]
14 | new string Remark { get; }
15 | #endif
16 | }
17 |
18 | public class StrangerInfo : BaseInfo, IStrangerInfo
19 | {
20 | [JsonPropertyName("remark")]
21 | public string Remark { get; set; } = null!;
22 |
23 | public StrangerInfo()
24 | {
25 | }
26 |
27 | public StrangerInfo(long id, string name, string remark) : base(id, name)
28 | {
29 | Remark = remark;
30 | }
31 |
32 | #if NETSTANDARD2_0
33 | [JsonPropertyName("remark")]
34 | string ISharedStrangerInfo.Remark => Remark;
35 | #endif
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Bot/BotPositiveLeaveGroupEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedBotPositiveLeaveGroupEventArgs = Mirai.CSharp.Models.EventArgs.IBotPositiveLeaveGroupEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供Bot主动退出一个群相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("BotLeaveEventActive")]
11 | public interface IBotPositiveLeaveGroupEventArgs : ISharedBotPositiveLeaveGroupEventArgs, IGroupEventArgs
12 | {
13 |
14 | }
15 |
16 | public class BotPositiveLeaveGroupEventArgs : GroupEventArgs, IBotPositiveLeaveGroupEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public BotPositiveLeaveGroupEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public BotPositiveLeaveGroupEventArgs(GroupInfo group) : base(group)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Session/IMiraiHttpSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Handlers;
3 | using Mirai.CSharp.Session;
4 |
5 | namespace Mirai.CSharp.HttpApi.Session
6 | {
7 | public partial interface IMiraiHttpSession : IMiraiSession
8 | {
9 | ///
10 | /// 会话连接状态
11 | ///
12 | bool Connected { get; }
13 |
14 | ///
15 | /// 会话绑定的QQ号。未连接为 。
16 | ///
17 | long? QQNumber { get; }
18 |
19 | ///
20 | /// 添加一个用于处理消息的
21 | ///
22 | PluginResistration AddPlugin(IMiraiHttpMessageHandler plugin);
23 |
24 | ///
25 | /// 移除一个用于处理消息的 。 必须在之前通过 添加过
26 | ///
27 | [Obsolete("请调用 AddPlugin 返回的 PluginResistration.Dispose 方法来移除先前注册的插件。预计于 2.2.0 版本移除此方法", true)]
28 | void RemovePlugin(IMiraiHttpMessageHandler plugin);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Exceptions/BotMutedException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Exceptions
4 | {
5 | ///
6 | /// 尝试使用被禁言的机器人QQ发送消息时引发的异常
7 | ///
8 | public sealed class BotMutedException : Exception
9 | {
10 | private const string DefaultMessage = "给定的机器人QQ已被禁言。";
11 |
12 | ///
13 | /// 机器人QQ
14 | ///
15 | public long BotQQ { get; }
16 |
17 | public BotMutedException() : this(DefaultMessage) { }
18 |
19 | public BotMutedException(string message) : this(0, message) { }
20 |
21 | public BotMutedException(long botQQ) : this(botQQ, DefaultMessage, null) { }
22 |
23 | public BotMutedException(long botQQ, string message) : this(botQQ, message, null) { }
24 |
25 | public BotMutedException(string message, Exception? innerException) : this(0, message, innerException) { }
26 |
27 | public BotMutedException(long botQQ, string message, Exception? innerException) : base(message ?? DefaultMessage, innerException)
28 | {
29 | BotQQ = botQQ;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/EventArgs/IBotGroupPropertyChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1712 // Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
2 | namespace Mirai.CSharp.Models.EventArgs
3 | {
4 | ///
5 | /// 提供Bot在群中属性改变的信息接口。继承自 和
6 | ///
7 | /// 属性类型
8 | public interface IBotGroupPropertyChangedEventArgs : IPropertyChangedEventArgs, IGroupEventArgs
9 | {
10 |
11 | }
12 |
13 | ///
14 | /// 提供Bot在群中属性改变的信息接口。继承自 , 和
15 | ///
16 | /// 消息原始数据类型
17 | public interface IBotGroupPropertyChangedEventArgs : IBotGroupPropertyChangedEventArgs, IPropertyChangedEventArgs, IGroupEventArgs
18 | {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Exceptions/InvalidAuthKeyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.HttpApi.Exceptions
4 | {
5 | ///
6 | /// 提供错误的AuthKey时引发的异常
7 | ///
8 | public sealed class InvalidAuthKeyException : Exception
9 | {
10 | private const string DefaultMessage = "错误的AuthKey。";
11 |
12 | ///
13 | /// 错误的AuthKey
14 | ///
15 | public string? AuthKey { get; }
16 |
17 | public InvalidAuthKeyException() : this(null, DefaultMessage) { }
18 |
19 | public InvalidAuthKeyException(string? authKey) : this(authKey, DefaultMessage, null) { }
20 |
21 | public InvalidAuthKeyException(string? authKey, string? message) : this(authKey, message, null) { }
22 |
23 | public InvalidAuthKeyException(string? message, Exception? innerException) : this(null, message, innerException) { }
24 |
25 | public InvalidAuthKeyException(string? authKey, string? message, Exception? innerException) : base(message ?? DefaultMessage, innerException)
26 | {
27 | AuthKey = authKey;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Parsers/UnknownMessageParser.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json;
2 | using Mirai.CSharp.HttpApi.Models.EventArgs;
3 |
4 | namespace Mirai.CSharp.HttpApi.Parsers
5 | {
6 | public class UnknownMessageParser : UnknownMessageParser
7 | {
8 | ///
9 | /// 初始化 类的新实例
10 | ///
11 | public UnknownMessageParser()
12 | {
13 |
14 | }
15 | }
16 |
17 | public class UnknownMessageParser : MiraiHttpMessageParser where TMessage : IUnknownMessageEventArgs
18 | where TImpl : UnknownMessageEventArgs, TMessage, new()
19 | {
20 | public override bool CanParse(in JsonElement root)
21 | {
22 | return true;
23 | }
24 |
25 | public override TMessage Parse(in JsonElement root)
26 | {
27 | TImpl message = new TImpl();
28 | message.Rawdata = root;
29 | return message;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Exceptions/BotNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.Exceptions
4 | {
5 | ///
6 | /// 当给定的机器人QQ不存在时引发的异常
7 | ///
8 | public sealed class BotNotFoundException : Exception
9 | {
10 | public const string DefaultMessage = "给定的机器人QQ不存在。";
11 |
12 | ///
13 | /// 机器人QQ
14 | ///
15 | public long BotQQ { get; }
16 |
17 | public BotNotFoundException() : this(DefaultMessage) { }
18 |
19 | public BotNotFoundException(string? message) : this(0, message) { }
20 |
21 | public BotNotFoundException(long botQQ) : this(botQQ, DefaultMessage, null) { }
22 |
23 | public BotNotFoundException(long botQQ, string? message) : this(botQQ, message, null) { }
24 |
25 | public BotNotFoundException(string? message, Exception? innerException) : this(0, message, innerException) { }
26 |
27 | public BotNotFoundException(long botQQ, string? message, Exception? innerException) : base(message ?? DefaultMessage, innerException)
28 | {
29 | BotQQ = botQQ;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Handlers/IMiraiMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Mirai.CSharp.Framework.Handlers;
4 | using Mirai.CSharp.Models.EventArgs;
5 | using Mirai.CSharp.Session;
6 |
7 | namespace Mirai.CSharp.Handlers
8 | {
9 | ///
10 | /// 本接口默认不处理任何的
11 | ///
12 | ///
13 | /// 一般情况下应当实现
14 | ///
15 | public interface IMiraiMessageHandler : IMessageHandler
16 | {
17 | #if !NETSTANDARD2_0
18 | Task HandleMessageAsync(IMiraiSession session, IMiraiMessage message)
19 | {
20 | throw new NotSupportedException("请使用泛型接口中的 HandleMessageAsync 方法。");
21 | }
22 |
23 | Task IMessageHandler.HandleMessageAsync(Framework.Clients.IMessageClient client, Framework.Models.General.IMessage message)
24 | {
25 | return HandleMessageAsync((IMiraiSession)client, (IMiraiMessage)message);
26 | }
27 | #else
28 | Task HandleMessageAsync(IMiraiSession client, IMiraiMessage message);
29 | #endif
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Friend/NewFriendApplyEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedNewFriendApplyEventArgs = Mirai.CSharp.Models.EventArgs.INewFriendApplyEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供好友申请相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("NewFriendRequestEvent")]
11 | public interface INewFriendApplyEventArgs : ISharedNewFriendApplyEventArgs, INewApplyEventArgs
12 | {
13 |
14 | }
15 |
16 | public class NewFriendApplyEventArgs : NewApplyEventArgs, INewFriendApplyEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public NewFriendApplyEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public NewFriendApplyEventArgs(long eventId, long fromGroup, long fromQQ, string nickName, string message) : base(eventId, fromGroup, fromQQ, nickName, message)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/ChatMessages/UnknownMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models.ChatMessages
5 | {
6 | ///
7 | /// 表示未知消息的消息接口
8 | ///
9 | public interface IUnknownChatMessage : IChatMessage
10 | {
11 |
12 | }
13 |
14 | public class UnknownChatMessage
15 | : ChatMessage, IUnknownChatMessage
16 | {
17 | ///
18 | /// 本消息类不可序列化, 故不支持获取值
19 | ///
20 | public override string Type => throw new NotSupportedException();
21 | ///
22 | /// 初始化 类的新实例
23 | ///
24 | [Obsolete("本类不应由用户进行实例化。")]
25 | public UnknownChatMessage()
26 | {
27 |
28 | }
29 | ///
30 | /// 初始化 类的新实例
31 | ///
32 | /// 服务器响应的内容
33 | [Obsolete("本类不应由用户进行实例化。")]
34 | public UnknownChatMessage(JsonElement data)
35 | {
36 | Rawdata = data;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/MiraiSessionConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Mirai.CSharp.HttpApi.Options
4 | {
5 | ///
6 | /// 提供 mirai-api-http 会话相关设置的接口
7 | ///
8 | public interface IMiraiSessionConfig
9 | {
10 | ///
11 | /// 缓存大小
12 | ///
13 | int? CacheSize { get; }
14 | ///
15 | /// 是否开启Websocket
16 | ///
17 | bool? EnableWebSocket { get; }
18 | }
19 |
20 | public class MiraiSessionConfig : IMiraiSessionConfig
21 | {
22 | ///
23 | /// 缓存大小
24 | ///
25 | public int? CacheSize { get; set; }
26 | ///
27 | /// 是否启用WebSocket
28 | ///
29 | public bool? EnableWebSocket { get; set; }
30 |
31 | public MiraiSessionConfig()
32 | {
33 |
34 | }
35 |
36 | public MiraiSessionConfig(int? cacheSize, bool? enableWebSocket)
37 | {
38 | CacheSize = cacheSize;
39 | EnableWebSocket = enableWebSocket;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Parsers/UnknownChatMessageParser.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json;
2 | using Mirai.CSharp.HttpApi.Models.ChatMessages;
3 |
4 | namespace Mirai.CSharp.HttpApi.Parsers
5 | {
6 | public class UnknownChatMessageParser : UnknownChatMessageParser
7 | {
8 | ///
9 | /// 初始化 类的新实例
10 | ///
11 | public UnknownChatMessageParser()
12 | {
13 |
14 | }
15 | }
16 |
17 | public class UnknownChatMessageParser : MiraiHttpChatMessageParser where TMessage : IUnknownChatMessage
18 | where TImpl : UnknownChatMessage, TMessage, new()
19 | {
20 | public override bool CanParse(in JsonElement root)
21 | {
22 | return true;
23 | }
24 |
25 | public override TMessage Parse(in JsonElement root)
26 | {
27 | TImpl message = new TImpl();
28 | message.Rawdata = root;
29 | return message;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Group/GroupMemberUnmutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedGroupMemberUnmutedEventArgs = Mirai.CSharp.Models.EventArgs.IGroupMemberUnmutedEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供其它群成员被解除禁言事件相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("MemberUnmuteEvent")]
11 | public interface IGroupMemberUnmutedEventArgs : ISharedGroupMemberUnmutedEventArgs, IMemberOperatingEventArgs
12 | {
13 |
14 | }
15 |
16 | public class GroupMemberUnmutedEventArgs : MemberOperatingEventArgs, IGroupMemberUnmutedEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public GroupMemberUnmutedEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public GroupMemberUnmutedEventArgs(IGroupMemberInfo member, IGroupMemberInfo @operator) : base(member, @operator)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Group/Specialized/GroupMemberKickedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedGroupMemberKickedEventArgs = Mirai.CSharp.Models.EventArgs.IGroupMemberKickedEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供成员被踢出群相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("MemberLeaveEventKick")]
11 | public interface IGroupMemberKickedEventArgs : ISharedGroupMemberKickedEventArgs, IMemberOperatingEventArgs
12 | {
13 |
14 | }
15 |
16 | public class GroupMemberKickedEventArgs : MemberOperatingEventArgs, IGroupMemberKickedEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public GroupMemberKickedEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public GroupMemberKickedEventArgs(IGroupMemberInfo member, IGroupMemberInfo @operator) : base(member, @operator)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/EventArgs/Group/Specialized/GroupMemberPositiveLeaveEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mirai.CSharp.HttpApi.Parsers.Attributes;
3 | using ISharedGroupMemberPositiveLeaveEventArgs = Mirai.CSharp.Models.EventArgs.IGroupMemberPositiveLeaveEventArgs;
4 |
5 | namespace Mirai.CSharp.HttpApi.Models.EventArgs
6 | {
7 | ///
8 | /// 提供成员主动离群相关信息的接口。继承自 和
9 | ///
10 | [MappableMiraiHttpMessageKey("MemberLeaveEventQuit")]
11 | public interface IGroupMemberPositiveLeaveEventArgs : ISharedGroupMemberPositiveLeaveEventArgs, IMemberEventArgs
12 | {
13 |
14 | }
15 |
16 | public class GroupMemberPositiveLeaveEventArgs : MemberEventArgs, IGroupMemberPositiveLeaveEventArgs
17 | {
18 | [Obsolete("此类不应由用户主动创建实例。")]
19 | public GroupMemberPositiveLeaveEventArgs()
20 | {
21 |
22 | }
23 |
24 | [Obsolete("此类不应由用户主动创建实例。")]
25 | public GroupMemberPositiveLeaveEventArgs(IGroupMemberInfo member) : base(member)
26 | {
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Models/OtherClientInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using ISharedOtherClientInfo = Mirai.CSharp.Models.IOtherClientInfo;
3 |
4 | namespace Mirai.CSharp.HttpApi.Models
5 | {
6 | ///
7 | public interface IOtherClientInfo : ISharedOtherClientInfo, IBaseInfo
8 | {
9 | #if !NETSTANDARD2_0
10 | [JsonPropertyName("platform")]
11 | abstract string ISharedOtherClientInfo.Platform { get; }
12 | #else
13 | [JsonPropertyName("platform")]
14 | new string Platform { get; }
15 | #endif
16 | }
17 |
18 | public class OtherClientInfo : BaseInfo, IOtherClientInfo
19 | {
20 | [JsonPropertyName("platform")]
21 | public string Platform { get; set; } = null!;
22 |
23 | public OtherClientInfo()
24 | {
25 | }
26 |
27 | public OtherClientInfo(long id, string name, string platform) : base(id, name)
28 | {
29 | Platform = platform;
30 | }
31 |
32 | #if NETSTANDARD2_0
33 | [JsonPropertyName("remark")]
34 | string ISharedOtherClientInfo.Platform => Platform;
35 | #endif
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Models/IGroupFileInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Mirai.CSharp.Models
2 | {
3 | ///
4 | /// 提供群文件信息的接口
5 | ///
6 | public interface IGroupFileInfo
7 | {
8 | ///
9 | /// 对象名称
10 | ///
11 | string Name { get; }
12 |
13 | ///
14 | /// 对象Id
15 | ///
16 | string Id { get; }
17 |
18 | ///
19 | /// 对象路径
20 | ///
21 | string Path { get; }
22 |
23 | ///
24 | /// 父对象。不存在时为
25 | ///
26 | IGroupFileInfo? Parent { get; }
27 |
28 | ///
29 | /// 对象所在群信息
30 | ///
31 | IGroupInfo Group { get; }
32 |
33 | ///
34 | /// 对象是否为文件
35 | ///
36 | bool IsFile { get; }
37 |
38 | ///
39 | /// 对象是否为文件夹
40 | ///
41 | bool IsDirectory { get; }
42 |
43 | ///
44 | /// 对象下载信息
45 | ///
46 | IGroupFileDownloadInfo? DownloadInfo { get; }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Exceptions/InvalidSessionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.HttpApi.Exceptions
4 | {
5 | ///
6 | /// 操作一个失效, 不存在或未认证(未激活)的Session时引发的异常
7 | ///
8 | public sealed class InvalidSessionException : Exception
9 | {
10 | public const string DefaultMessage = "尝试操作一个失效, 不存在或未认证(未激活)的Session。";
11 | ///
12 | /// SessionKey
13 | ///
14 | public string? SessionKey { get; }
15 |
16 | public InvalidSessionException() : this(null, DefaultMessage) { }
17 |
18 | public InvalidSessionException(string? sessionKey) : this(sessionKey, DefaultMessage, null) { }
19 |
20 | public InvalidSessionException(string? sessionKey, string? message) : this(sessionKey, message, null) { }
21 |
22 | public InvalidSessionException(string? message, Exception? innerException) : this(null, message, innerException) { }
23 |
24 | public InvalidSessionException(string? sessionKey, string? message, Exception? innerException) : base(message ?? DefaultMessage, innerException)
25 | {
26 | SessionKey = sessionKey;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Mirai-CSharp.HttpApi/Parsers/Attributes/MappableMiraiHttpMessageKeyAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Mirai.CSharp.HttpApi.Parsers.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
6 | public abstract class MappableMiraiHttpMessageKeyBaseAttribute : Attribute
7 | {
8 | public string Key { get; }
9 |
10 | protected MappableMiraiHttpMessageKeyBaseAttribute(string key)
11 | {
12 | Key = key;
13 | }
14 | }
15 |
16 | ///
17 | /// 标记一个消息类或者消息接口在 mirai-api-http 协议中对应的type值
18 | ///
19 | public class MappableMiraiHttpMessageKeyAttribute : MappableMiraiHttpMessageKeyBaseAttribute
20 | {
21 | public MappableMiraiHttpMessageKeyAttribute(string key) : base(key)
22 | {
23 |
24 | }
25 | }
26 |
27 | ///
28 | /// 标记一个聊天在 mirai-api-http 协议中对应的type值
29 | ///
30 | public class MappableMiraiChatMessageKeyAttribute : MappableMiraiHttpMessageKeyBaseAttribute
31 | {
32 | public MappableMiraiChatMessageKeyAttribute(string key) : base(key)
33 | {
34 |
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Mirai-CSharp/Invoking/IMiraiMessageSubscription.cs:
--------------------------------------------------------------------------------
1 | #if !NETSTANDARD2_0
2 | using System.Threading.Tasks;
3 | #endif
4 | using Mirai.CSharp.Framework.Invoking;
5 | using Mirai.CSharp.Handlers;
6 | using Mirai.CSharp.Models.EventArgs;
7 | using Mirai.CSharp.Session;
8 |
9 | namespace Mirai.CSharp.Invoking
10 | {
11 | public interface IMiraiMessageSubscription : IMessageSubscription, IMiraiMessageHandler
12 | {
13 |
14 | }
15 |
16 | public interface IMiraiMessageSubscription : IMiraiMessageSubscription,
17 | IMessageSubscription,
18 | IMiraiMessageHandler