├── .gitignore
├── Icon.png
├── LICENSE
├── README.md
├── docs
├── api
│ ├── HuajiTech.CoolQ.ApiException.html
│ ├── HuajiTech.CoolQ.AppIdAttribute.html
│ ├── HuajiTech.CoolQ.AppInitializationException.html
│ ├── HuajiTech.CoolQ.AppLifecycle.html
│ ├── HuajiTech.CoolQ.CurrentPluginContext.html
│ ├── HuajiTech.CoolQ.CustomTitle.html
│ ├── HuajiTech.CoolQ.DefaultInitializer.html
│ ├── HuajiTech.CoolQ.Events.AnonymousMessageReceivedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.BotEventSource.html
│ ├── HuajiTech.CoolQ.Events.CurrentUserEventSource.html
│ ├── HuajiTech.CoolQ.Events.Extensions.html
│ ├── HuajiTech.CoolQ.Events.FileUploadedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.FriendAddedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.FriendshipRequestedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.GroupEventArgs.html
│ ├── HuajiTech.CoolQ.Events.GroupEventSource.html
│ ├── HuajiTech.CoolQ.Events.GroupMessageReceivedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.GroupMuteEventArgs.html
│ ├── HuajiTech.CoolQ.Events.IAdministratorshipEventSource.html
│ ├── HuajiTech.CoolQ.Events.IBotEventSource.html
│ ├── HuajiTech.CoolQ.Events.ICurrentUserEventSource.html
│ ├── HuajiTech.CoolQ.Events.IFriendshipEventSource.html
│ ├── HuajiTech.CoolQ.Events.IGroupEventSource.html
│ ├── HuajiTech.CoolQ.Events.IMembershipEventSource.html
│ ├── HuajiTech.CoolQ.Events.IMessageEventSource.html
│ ├── HuajiTech.CoolQ.Events.IMuteEventSource.html
│ ├── HuajiTech.CoolQ.Events.INotifyAdministratorAdded.html
│ ├── HuajiTech.CoolQ.Events.INotifyAdministratorRemoved.html
│ ├── HuajiTech.CoolQ.Events.INotifyAnonymousMessageReceived.html
│ ├── HuajiTech.CoolQ.Events.INotifyAppDisabling.html
│ ├── HuajiTech.CoolQ.Events.INotifyAppEnabled.html
│ ├── HuajiTech.CoolQ.Events.INotifyBotStarted.html
│ ├── HuajiTech.CoolQ.Events.INotifyBotStopping.html
│ ├── HuajiTech.CoolQ.Events.INotifyFileUploaded.html
│ ├── HuajiTech.CoolQ.Events.INotifyFriendAdded.html
│ ├── HuajiTech.CoolQ.Events.INotifyFriendshipRequested.html
│ ├── HuajiTech.CoolQ.Events.INotifyGroupMessageReceived.html
│ ├── HuajiTech.CoolQ.Events.INotifyGroupMuted.html
│ ├── HuajiTech.CoolQ.Events.INotifyGroupUnmuted.html
│ ├── HuajiTech.CoolQ.Events.INotifyMemberJoined.html
│ ├── HuajiTech.CoolQ.Events.INotifyMemberLeft.html
│ ├── HuajiTech.CoolQ.Events.INotifyMemberMuted.html
│ ├── HuajiTech.CoolQ.Events.INotifyMemberUnmuted.html
│ ├── HuajiTech.CoolQ.Events.INotifyMembershipInvited.html
│ ├── HuajiTech.CoolQ.Events.INotifyMembershipRequested.html
│ ├── HuajiTech.CoolQ.Events.INotifyUserMessageReceived.html
│ ├── HuajiTech.CoolQ.Events.MemberMutedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.MembershipInvitedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.MembershipRequestedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.MessageReceivedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.RoutedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.TimedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.UserMessageReceivedEventArgs.html
│ ├── HuajiTech.CoolQ.Events.html
│ ├── HuajiTech.CoolQ.Extensions.html
│ ├── HuajiTech.CoolQ.File.html
│ ├── HuajiTech.CoolQ.Gender.html
│ ├── HuajiTech.CoolQ.IAliased.html
│ ├── HuajiTech.CoolQ.IAnonymousMember.html
│ ├── HuajiTech.CoolQ.IBot.html
│ ├── HuajiTech.CoolQ.IChattable.html
│ ├── HuajiTech.CoolQ.ICurrentUser.html
│ ├── HuajiTech.CoolQ.IDisplayable.html
│ ├── HuajiTech.CoolQ.IFriend.html
│ ├── HuajiTech.CoolQ.IFriendshipRequest.html
│ ├── HuajiTech.CoolQ.IGroup.html
│ ├── HuajiTech.CoolQ.ILogger.html
│ ├── HuajiTech.CoolQ.IMember.html
│ ├── HuajiTech.CoolQ.IMembershipRequest.html
│ ├── HuajiTech.CoolQ.IMuteable.html
│ ├── HuajiTech.CoolQ.IRequest.html
│ ├── HuajiTech.CoolQ.IRequestable.html
│ ├── HuajiTech.CoolQ.ISendee.html
│ ├── HuajiTech.CoolQ.ITimedMuteable.html
│ ├── HuajiTech.CoolQ.IUser.html
│ ├── HuajiTech.CoolQ.InitializerAttribute.html
│ ├── HuajiTech.CoolQ.Loaders.AutofacLoader.html
│ ├── HuajiTech.CoolQ.Loaders.ILoader.html
│ ├── HuajiTech.CoolQ.Loaders.html
│ ├── HuajiTech.CoolQ.LoggingExtensions.html
│ ├── HuajiTech.CoolQ.MemberRole.html
│ ├── HuajiTech.CoolQ.Message.html
│ ├── HuajiTech.CoolQ.Messaging.AbstractionExtensions.html
│ ├── HuajiTech.CoolQ.Messaging.Anonymous.html
│ ├── HuajiTech.CoolQ.Messaging.At.html
│ ├── HuajiTech.CoolQ.Messaging.CQCode.html
│ ├── HuajiTech.CoolQ.Messaging.ComplexMessage.html
│ ├── HuajiTech.CoolQ.Messaging.ComplexMessageExtensions.html
│ ├── HuajiTech.CoolQ.Messaging.ContactShare.html
│ ├── HuajiTech.CoolQ.Messaging.CustomEmoticon.html
│ ├── HuajiTech.CoolQ.Messaging.CustomMusic.html
│ ├── HuajiTech.CoolQ.Messaging.Dice.html
│ ├── HuajiTech.CoolQ.Messaging.Emoji.html
│ ├── HuajiTech.CoolQ.Messaging.Emoticon.html
│ ├── HuajiTech.CoolQ.Messaging.Extensions.html
│ ├── HuajiTech.CoolQ.Messaging.ISendable.html
│ ├── HuajiTech.CoolQ.Messaging.Image.html
│ ├── HuajiTech.CoolQ.Messaging.Location.html
│ ├── HuajiTech.CoolQ.Messaging.Mention.html
│ ├── HuajiTech.CoolQ.Messaging.MentionAll.html
│ ├── HuajiTech.CoolQ.Messaging.MessageElement.html
│ ├── HuajiTech.CoolQ.Messaging.MessageElementCollectionExtensions.html
│ ├── HuajiTech.CoolQ.Messaging.Music.html
│ ├── HuajiTech.CoolQ.Messaging.MusicPlatform.html
│ ├── HuajiTech.CoolQ.Messaging.PlainText.html
│ ├── HuajiTech.CoolQ.Messaging.Record.html
│ ├── HuajiTech.CoolQ.Messaging.RedEnvelope.html
│ ├── HuajiTech.CoolQ.Messaging.RichText.html
│ ├── HuajiTech.CoolQ.Messaging.RockPaperScissors.html
│ ├── HuajiTech.CoolQ.Messaging.RockPaperScissorsKind.html
│ ├── HuajiTech.CoolQ.Messaging.Shake.html
│ ├── HuajiTech.CoolQ.Messaging.Share.html
│ ├── HuajiTech.CoolQ.Messaging.SignIn.html
│ ├── HuajiTech.CoolQ.Messaging.SigningIn.html
│ ├── HuajiTech.CoolQ.Messaging.SmallEmoticon.html
│ ├── HuajiTech.CoolQ.Messaging.html
│ ├── HuajiTech.CoolQ.Packing.ILRepacker.html
│ ├── HuajiTech.CoolQ.Packing.IPacker.html
│ ├── HuajiTech.CoolQ.Packing.html
│ ├── HuajiTech.CoolQ.Plugin.html
│ ├── HuajiTech.CoolQ.PluginAttribute.html
│ ├── HuajiTech.CoolQ.PluginContext.html
│ ├── HuajiTech.CoolQ.PluginContextExtensions.html
│ ├── HuajiTech.CoolQ.PluginLoadException.html
│ ├── HuajiTech.CoolQ.RegexMessage.html
│ ├── HuajiTech.CoolQ.SdkInfo.html
│ ├── HuajiTech.CoolQ.Status.html
│ ├── HuajiTech.CoolQ.StatusColor.html
│ ├── HuajiTech.CoolQ.html
│ ├── index.html
│ └── toc.html
├── favicon.ico
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
├── guides
│ ├── events.html
│ ├── getting_started.html
│ ├── howto_handle_message.html
│ ├── intro.html
│ ├── menus_and_statuses.html
│ ├── toc.html
│ └── your_first_app.html
├── images
│ └── favicon.ico
├── index.html
├── index.json
├── logo.svg
├── manifest.json
├── search-stopwords.json
├── styles
│ ├── docfx.css
│ ├── docfx.js
│ ├── docfx.vendor.css
│ ├── docfx.vendor.js
│ ├── lunr.js
│ ├── lunr.min.js
│ ├── main.css
│ ├── main.js
│ └── search-worker.js
├── toc.html
└── xrefmap.yml
├── documentation
├── .gitignore
├── api
│ ├── .gitignore
│ └── index.md
├── docfx.json
├── guides
│ ├── events.md
│ ├── getting_started.md
│ ├── howto_handle_message.md
│ ├── intro.md
│ ├── menus_and_statuses.md
│ ├── toc.md
│ └── your_first_app.md
├── images
│ └── favicon.ico
├── index.md
└── toc.yml
└── src
├── .editorconfig
├── .gitattributes
├── .gitignore
├── HuajiTech.CoolQ.Abstractions
├── AbstractionResources.Designer.cs
├── AbstractionResources.resx
├── AppIdAttribute.cs
├── AppLifecycle.cs
├── CurrentPluginContext.cs
├── CustomTitle.cs
├── Events
│ ├── EventArgses
│ │ ├── AnonymousMessageReceivedEventArgs.cs
│ │ ├── FileUploadedEventArgs.cs
│ │ ├── FriendAddedEventArgs.cs
│ │ ├── FriendshipRequestedEventArgs.cs
│ │ ├── GroupEventArgs.cs
│ │ ├── GroupMessageReceivedEventArgs.cs
│ │ ├── GroupMuteEventArgs.cs
│ │ ├── MemberMutedEventArgs.cs
│ │ ├── MembershipInvitedEventArgs.cs
│ │ ├── MembershipRequestedEventArgs.cs
│ │ ├── MessageReceivedEventArgs.cs
│ │ ├── RoutedEventArgs.cs
│ │ ├── TimedEventArgs.cs
│ │ └── UserMessageReceivedEventArgs.cs
│ ├── EventSources
│ │ ├── IAdministratorshipEventSource.cs
│ │ ├── IBotEventSource.cs
│ │ ├── ICurrentUserEventSource.cs
│ │ ├── IFriendshipEventSource.cs
│ │ ├── IGroupEventSource.cs
│ │ ├── IMembershipEventSource.cs
│ │ ├── IMessageEventSource.cs
│ │ └── IMuteEventSource.cs
│ ├── Extensions.cs
│ └── Notifications
│ │ ├── INotifyAdministratorAdded.cs
│ │ ├── INotifyAdministratorRemoved.cs
│ │ ├── INotifyAnonymousMessageReceived.cs
│ │ ├── INotifyAppDisabling.cs
│ │ ├── INotifyAppEnabled.cs
│ │ ├── INotifyBotStarted.cs
│ │ ├── INotifyBotStopping.cs
│ │ ├── INotifyFileUploaded.cs
│ │ ├── INotifyFriendAdded.cs
│ │ ├── INotifyFriendshipRequested.cs
│ │ ├── INotifyGroupMessageReceived.cs
│ │ ├── INotifyGroupMuted.cs
│ │ ├── INotifyGroupUnmuted.cs
│ │ ├── INotifyMemberJoined.cs
│ │ ├── INotifyMemberLeft.cs
│ │ ├── INotifyMemberMuted.cs
│ │ ├── INotifyMemberUnmuted.cs
│ │ ├── INotifyMembershipInvited.cs
│ │ ├── INotifyMembershipRequested.cs
│ │ └── INotifyUserMessageReceived.cs
├── Exceptions
│ ├── ApiException.cs
│ └── PluginLoadException.cs
├── File.cs
├── Gender.cs
├── HuajiTech.CoolQ.Abstractions.csproj
├── HuajiTech.CoolQ.Abstractions.xml
├── IAliased.cs
├── IAnonymousMember.cs
├── IBot.cs
├── IChattable.cs
├── ICurrentUser.cs
├── IDisplayable.cs
├── IFriend.cs
├── IFriendshipRequest.cs
├── IGroup.cs
├── ILoader.cs
├── ILogger.cs
├── IMember.cs
├── IMembershipRequest.cs
├── IMuteable.cs
├── IPacker.cs
├── IRequest.cs
├── IRequestable.cs
├── ISendee.cs
├── ITimedMuteable.cs
├── IUser.cs
├── LoggingExtensions.cs
├── MemberRole.cs
├── Message.cs
├── Plugin.cs
├── PluginAttribute.cs
├── PluginContext.cs
├── PluginContextExtensions.cs
└── Properties
│ └── AssemblyInfo.cs
├── HuajiTech.CoolQ.Core
├── .gitignore
├── AnonymousMember.cs
├── Bot.cs
├── Chat.cs
├── CoreResources.Designer.cs
├── CoreResources.resx
├── CurrentUser.cs
├── Enums
│ ├── AdministratorsChangedType.cs
│ ├── MessageSender.cs
│ ├── Muting.cs
│ ├── OperationKind.cs
│ ├── Response.cs
│ └── StatusColor.cs
├── ErrorHandlingExtensions.cs
├── Events
│ ├── AdministratorsChangedEventArgs.cs
│ ├── BotEventSource.cs
│ ├── CurrentUserEventSource.cs
│ └── GroupEventSource.cs
├── Exceptions
│ └── AppInitializationException.cs
├── Friend.cs
├── FriendshipRequest.cs
├── Group.cs
├── HuajiTech.CoolQ.Core.csproj
├── HuajiTech.CoolQ.Core.xml
├── InitializerAttribute.cs
├── Interop
│ ├── AnonymousMemberInfo.cs
│ ├── AnonymousMemberInfoReader.cs
│ ├── BasicGroupInfo.cs
│ ├── BasicGroupInfoReader.cs
│ ├── FileReader.cs
│ ├── FriendInfo.cs
│ ├── FriendInfoReader.cs
│ ├── GroupInfo.cs
│ ├── GroupInfoReader.cs
│ ├── MemberInfo.cs
│ ├── MemberInfoReader.cs
│ ├── Reader{T}.cs
│ ├── StatusWriter.cs
│ ├── StringKeyValuePairReader.cs
│ ├── UserInfo.cs
│ ├── UserInfoReader.cs
│ └── Writer{T}.cs
├── LogLevel.cs
├── Logger.cs
├── Member.cs
├── MembershipInvitation.cs
├── MembershipRequest.cs
├── MessageCore.cs
├── NativeMethods.cs
├── PluginContextCore.cs
├── Properties
│ └── AssemblyInfo.cs
├── RegexMessage.cs
├── Status.cs
├── StringMarshaler.cs
├── User.cs
├── Utilities
│ └── Timestamp.cs
└── app.json
├── HuajiTech.CoolQ.Loaders.Autofac
├── AutofacLoader.cs
├── AutofacLoaderResources.Designer.cs
├── AutofacLoaderResources.resx
├── HuajiTech.CoolQ.Loaders.Autofac.csproj
└── Properties
│ └── AssemblyInfo.cs
├── HuajiTech.CoolQ.Messaging
├── CQCode.cs
├── CQCodes
│ ├── Anonymous.cs
│ ├── ContactShare.cs
│ ├── CustomEmoticon.cs
│ ├── CustomMusic.cs
│ ├── Dice.cs
│ ├── Emoji.cs
│ ├── Emoticon.cs
│ ├── Image.cs
│ ├── Location.cs
│ ├── Mention.cs
│ ├── MentionAll.cs
│ ├── Music.cs
│ ├── MusicPlatform.cs
│ ├── Record.cs
│ ├── RedEnvelope.cs
│ ├── RichText.cs
│ ├── RockPaperScissors.cs
│ ├── RockPaperScissorsKind.cs
│ ├── Shake.cs
│ ├── Share.cs
│ ├── SigningIn.cs
│ └── SmallEmoticon.cs
├── ComplexMessage.cs
├── ComplexMessageExtensions.cs
├── Extensions.cs
├── HuajiTech.CoolQ.Messaging.csproj
├── HuajiTech.CoolQ.Messaging.xml
├── ISendable.cs
├── MessageElement.cs
├── MessageElementCollectionExtensions.cs
├── PlainText.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources.Designer.cs
└── Resources.resx
├── HuajiTech.CoolQ.Packing.ILRepack
├── HuajiTech.CoolQ.Packing.ILRepack.csproj
├── ILRepacker.cs
├── Properties
│ └── AssemblyInfo.cs
├── build
│ ├── HuajiTech.CoolQ.Packing.ILRepack.Placeholder.targets
│ ├── HuajiTech.CoolQ.Packing.ILRepack.props
│ └── HuajiTech.CoolQ.Packing.ILRepack.targets
└── tools
│ └── net35
│ ├── InjectModuleInitializer.exe
│ ├── Mono.Cecil.Mdb.dll
│ ├── Mono.Cecil.Pdb.dll
│ ├── Mono.Cecil.Rocks.dll
│ └── Mono.Cecil.dll
├── HuajiTech.CoolQ.sln
├── HuajiTech.CoolQ
├── DefaultInitializer.cs
├── HuajiTech.CoolQ.csproj
├── HuajiTech.CoolQ.xml
├── Messaging
│ └── AbstractionExtensions.cs
├── Properties
│ ├── AppInfo.cs
│ └── AssemblyInfo.cs
└── SdkInfo.cs
└── stylecop.json
/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # folder #
3 | ###############
4 | /**/DROP/
5 | /**/TEMP/
6 | /**/packages/
7 | /**/bin/
8 | /**/obj/
9 |
--------------------------------------------------------------------------------
/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/Icon.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HuajiTech.CoolQ
2 |
3 | 用于*酷Q*应用的 .NET SDK。
4 |
5 | ## 项目状态
6 |
7 | ~~项目目前处于测试阶段,不建议用于生产环境。~~
8 |
9 | 酷Q已无法使用,**本项目不再更新**。
10 |
11 | 已有应用可通过其他平台对于酷Q的兼容层继续使用,**不建议将本项目用于任何新的开发**。
12 |
13 | *如果事情出现巨大转机,不排除项目继续开发的可能性。*
14 |
15 | ## 特性
16 |
17 | - 通过 StdCall 导出。
18 | - 以 [NuGet 包](https://www.nuget.org/packages/HuajiTech.CoolQ/)发布。
19 | - **高度封装。**
20 |
21 | ## 复读机示例
22 |
23 | ```csharp
24 | using HuajiTech.CoolQ;
25 | using HuajiTech.CoolQ.Events;
26 |
27 | [assembly: AppId("com.example.repeater")]
28 |
29 | [Plugin]
30 | class RepeaterPlugin : Plugin
31 | {
32 | public RepeaterPlugin(IMessageEventSource eventSource)
33 | {
34 | eventSource.AddMessageReceivedEventHandler((sender, e) => e.Source.Send(e.Message));
35 | }
36 | }
37 | ```
38 |
39 | ## 文档
40 |
41 | [Github Pages](https://huajitech.github.io/coolq-dotnet-sdk/)(与代码库同步)
42 |
43 | [HuajiTech](https://www.huajitech.net/docs/coolq-dotnet-sdk/)(与最新的 NuGet 包同步)
44 |
45 | ## 讨论
46 |
47 | ~~[GitHub Issues](https://github.com/huajitech/coolq-dotnet-sdk/issues)~~ 或 [QQ群](https://jq.qq.com/?_wv=1027&k=5HPLCyU)(1094829331)。
48 |
49 | \*QQ群已不再讨论本项目。
50 |
51 | ## 许可
52 |
53 | 本项目使用 LGPL v3 进行许可。
54 |
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/docs/favicon.ico
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/docs/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/docs/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/docs/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/docs/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/docs/guides/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/docs/images/favicon.ico
--------------------------------------------------------------------------------
/docs/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
26 |
--------------------------------------------------------------------------------
/docs/search-stopwords.json:
--------------------------------------------------------------------------------
1 | [
2 | "a",
3 | "able",
4 | "about",
5 | "across",
6 | "after",
7 | "all",
8 | "almost",
9 | "also",
10 | "am",
11 | "among",
12 | "an",
13 | "and",
14 | "any",
15 | "are",
16 | "as",
17 | "at",
18 | "be",
19 | "because",
20 | "been",
21 | "but",
22 | "by",
23 | "can",
24 | "cannot",
25 | "could",
26 | "dear",
27 | "did",
28 | "do",
29 | "does",
30 | "either",
31 | "else",
32 | "ever",
33 | "every",
34 | "for",
35 | "from",
36 | "get",
37 | "got",
38 | "had",
39 | "has",
40 | "have",
41 | "he",
42 | "her",
43 | "hers",
44 | "him",
45 | "his",
46 | "how",
47 | "however",
48 | "i",
49 | "if",
50 | "in",
51 | "into",
52 | "is",
53 | "it",
54 | "its",
55 | "just",
56 | "least",
57 | "let",
58 | "like",
59 | "likely",
60 | "may",
61 | "me",
62 | "might",
63 | "most",
64 | "must",
65 | "my",
66 | "neither",
67 | "no",
68 | "nor",
69 | "not",
70 | "of",
71 | "off",
72 | "often",
73 | "on",
74 | "only",
75 | "or",
76 | "other",
77 | "our",
78 | "own",
79 | "rather",
80 | "said",
81 | "say",
82 | "says",
83 | "she",
84 | "should",
85 | "since",
86 | "so",
87 | "some",
88 | "than",
89 | "that",
90 | "the",
91 | "their",
92 | "them",
93 | "then",
94 | "there",
95 | "these",
96 | "they",
97 | "this",
98 | "tis",
99 | "to",
100 | "too",
101 | "twas",
102 | "us",
103 | "wants",
104 | "was",
105 | "we",
106 | "were",
107 | "what",
108 | "when",
109 | "where",
110 | "which",
111 | "while",
112 | "who",
113 | "whom",
114 | "why",
115 | "will",
116 | "with",
117 | "would",
118 | "yet",
119 | "you",
120 | "your"
121 | ]
122 |
--------------------------------------------------------------------------------
/docs/styles/main.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
2 |
--------------------------------------------------------------------------------
/docs/styles/search-worker.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | importScripts('lunr.min.js');
3 |
4 | var lunrIndex;
5 |
6 | var stopWords = null;
7 | var searchData = {};
8 |
9 | lunr.tokenizer.separator = /[\s\-\.]+/;
10 |
11 | var stopWordsRequest = new XMLHttpRequest();
12 | stopWordsRequest.open('GET', '../search-stopwords.json');
13 | stopWordsRequest.onload = function () {
14 | if (this.status != 200) {
15 | return;
16 | }
17 | stopWords = JSON.parse(this.responseText);
18 | buildIndex();
19 | }
20 | stopWordsRequest.send();
21 |
22 | var searchDataRequest = new XMLHttpRequest();
23 |
24 | searchDataRequest.open('GET', '../index.json');
25 | searchDataRequest.onload = function () {
26 | if (this.status != 200) {
27 | return;
28 | }
29 | searchData = JSON.parse(this.responseText);
30 |
31 | buildIndex();
32 |
33 | postMessage({ e: 'index-ready' });
34 | }
35 | searchDataRequest.send();
36 |
37 | onmessage = function (oEvent) {
38 | var q = oEvent.data.q;
39 | var hits = lunrIndex.search(q);
40 | var results = [];
41 | hits.forEach(function (hit) {
42 | var item = searchData[hit.ref];
43 | results.push({ 'href': item.href, 'title': item.title, 'keywords': item.keywords });
44 | });
45 | postMessage({ e: 'query-ready', q: q, d: results });
46 | }
47 |
48 | function buildIndex() {
49 | if (stopWords !== null && !isEmpty(searchData)) {
50 | lunrIndex = lunr(function () {
51 | this.pipeline.remove(lunr.stopWordFilter);
52 | this.ref('href');
53 | this.field('title', { boost: 50 });
54 | this.field('keywords', { boost: 20 });
55 |
56 | for (var prop in searchData) {
57 | if (searchData.hasOwnProperty(prop)) {
58 | this.add(searchData[prop]);
59 | }
60 | }
61 |
62 | var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords);
63 | lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter');
64 | this.pipeline.add(docfxStopWordFilter);
65 | this.searchPipeline.add(docfxStopWordFilter);
66 | });
67 | }
68 | }
69 |
70 | function isEmpty(obj) {
71 | if(!obj) return true;
72 |
73 | for (var prop in obj) {
74 | if (obj.hasOwnProperty(prop))
75 | return false;
76 | }
77 |
78 | return true;
79 | }
80 | })();
81 |
--------------------------------------------------------------------------------
/docs/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
15 | -
16 | 指南
17 |
18 | -
19 | API 参考
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/documentation/.gitignore:
--------------------------------------------------------------------------------
1 | /templates
--------------------------------------------------------------------------------
/documentation/api/.gitignore:
--------------------------------------------------------------------------------
1 | .manifest
2 | *.yml
--------------------------------------------------------------------------------
/documentation/api/index.md:
--------------------------------------------------------------------------------
1 | # API 参考
2 |
3 | 浏览 HuajiTech.CoolQ 的 API。
--------------------------------------------------------------------------------
/documentation/docfx.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": [
3 | {
4 | "src": [
5 | {
6 | "src": "../src",
7 | "files": [
8 | "**.csproj"
9 | ]
10 | }
11 | ],
12 | "dest": "api",
13 | "disableGitFeatures": false,
14 | "disableDefaultFilter": false
15 | }
16 | ],
17 | "build": {
18 | "content": [
19 | {
20 | "files": [
21 | "api/**.yml",
22 | "api/index.md"
23 | ]
24 | },
25 | {
26 | "files": [
27 | "guides/**.md",
28 | "guides/**/toc.yml",
29 | "toc.yml",
30 | "*.md"
31 | ]
32 | }
33 | ],
34 | "resource": [
35 | {
36 | "files": [
37 | "images/**"
38 | ]
39 | }
40 | ],
41 | "overwrite": [
42 | {
43 | "files": [
44 | "apidoc/**.md"
45 | ],
46 | "exclude": [
47 | "obj/**"
48 | ]
49 | }
50 | ],
51 | "dest": "../docs",
52 | "globalMetadataFiles": [],
53 | "fileMetadataFiles": [],
54 | "template": [
55 | "default",
56 | "default(zh-cn)",
57 | "templates/material"
58 | ],
59 | "postProcessors": [
60 | "ExtractSearchIndex"
61 | ],
62 | "noLangKeyword": false,
63 | "keepFileLink": false,
64 | "cleanupCacheHistory": false,
65 | "disableGitFeatures": false,
66 | "globalMetadata": {
67 | "_appTitle": "HuajiTech.CoolQ 文档",
68 | "_gitContribute": {
69 | "repo": "https://github.com/huajitech/coolq-dotnet-sdk",
70 | "branch": "master",
71 | "apiSpecFolder": "apidoc"
72 | },
73 | "_gitUrlPattern": "github",
74 | "_appLogoPath": "images/favicon.ico",
75 | "_appFaviconPath": "images/favicon.ico",
76 | "_enableSearch": true,
77 | "_appFooter": "本文档使用 CC BY-NC-SA 4.0 进行许可。"
78 | },
79 | }
80 | }
--------------------------------------------------------------------------------
/documentation/guides/events.md:
--------------------------------------------------------------------------------
1 | # 事件
2 |
3 | | 类型 | 说明 | 事件 |
4 | | --: | :-- | :-- |
5 | | 1 | 私聊消息处理 | @"HuajiTech.CoolQ.Events.INotifyUserMessageReceived.UserMessageReceived" |
6 | | 2 | 群消息处理 | @"HuajiTech.CoolQ.Events.INotifyGroupMessageReceived.GroupMessageReceived" |
7 | | 11 | 群文件上传事件处理 | @"HuajiTech.CoolQ.Events.INotifyFileUploaded.FileUploaded" |
8 | | 101 | 群管理变动事件处理 | @"HuajiTech.CoolQ.Events.INotifyAdministratorAdded.AdministratorAdded"、@"HuajiTech.CoolQ.Events.INotifyAdministratorRemoved.AdministratorRemoved" |
9 | | 102 | 群成员减少事件处理 | @"HuajiTech.CoolQ.Events.INotifyMemberLeft.MemberLeft" |
10 | | 103 | 群成员增加事件处理 | @"HuajiTech.CoolQ.Events.INotifyMemberJoined.MemberJoined" |
11 | | 104 | 群禁言事件处理 | @"HuajiTech.CoolQ.Events.INotifyMemberMuted.MemberMuted"、@"HuajiTech.CoolQ.Events.INotifyMemberUnmuted.MemberUnmuted"、@"HuajiTech.CoolQ.Events.INotifyGroupMuted.GroupMuted"、@"HuajiTech.CoolQ.Events.INotifyGroupUnmuted.GroupUnmuted" |
12 | | 201 | 好友已添加事件处理 | @"HuajiTech.CoolQ.Events.INotifyFriendAdded.FriendAdded" |
13 | | 301 | 好友添加请求处理 | @"HuajiTech.CoolQ.Events.INotifyFriendshipRequested.FriendshipRequested" |
14 | | 302 | 群添加请求处理 | @"HuajiTech.CoolQ.Events.INotifyMembershipInvited.MembershipInvited"、@"HuajiTech.CoolQ.Events.INotifyMembershipRequested.MembershipRequested" |
15 | | 1001 | 酷Q启动事件 | @"HuajiTech.CoolQ.Events.INotifyBotStarted.BotStarted" |
16 | | 1002 | 酷Q关闭事件 | @"HuajiTech.CoolQ.Events.INotifyBotStopping.BotStopping" |
17 | | 1003 | 应用已被启用 | @"HuajiTech.CoolQ.Events.INotifyAppEnabled.AppEnabled" |
18 | | 1004 | 应用将被停用 | @"HuajiTech.CoolQ.Events.INotifyAppDisabling.AppDisabling" |
19 |
--------------------------------------------------------------------------------
/documentation/guides/getting_started.md:
--------------------------------------------------------------------------------
1 | # 入门
2 |
3 | ## AppID
4 |
5 | 通过在程序集上应用 @"HuajiTech.CoolQ.AppIdAttribute" 指定 [AppID](https://docs.cqp.im/dev/v9/appid/)。
6 | 同一个应用中,@"HuajiTech.CoolQ.AppIdAttribute" 必须是唯一的。
7 |
8 | ## 插件类
9 |
10 | 通过为**可被实例化**的类应用 @"HuajiTech.CoolQ.PluginAttribute" 特性指定插件类。
11 | 在同一个应用中,可以指定多个插件类。插件类只会被实例化一次。
12 |
13 | 通常情况下,插件类应以 @"HuajiTech.CoolQ.Plugin" 类作为基类。
14 |
15 | 使用 @"HuajiTech.CoolQ.PluginAttribute" 特性的有参构造函数指定插件类的加载时机。
16 |
17 | ```csharp
18 | [Plugin((int)AppLifecycle.Initializing)]
19 | class MyPlugin : Plugin
20 | {
21 | }
22 | ```
23 |
24 | > [!WARNING]
25 | > 不能直接将 @"HuajiTech.CoolQ.AppLifecycle" 枚举的值传入构造函数,否则将导致应用无法编译。
26 |
27 | 若在 @"HuajiTech.CoolQ.AppLifecycle.Enabled" 阶段加载,允许在构造函数内**调用 API**或**长时间阻塞线程**,并且可以显示引发的异常的详细信息。
28 | **必须**在 `app.json` 中向酷Q**注册应用启用事件**才能在 Enabled 阶段加载。
29 |
30 | 通过将加载阶段设置为 @"HuajiTech.CoolQ.AppLifecycle.NotLoaded" (`0`),可以禁止插件类的加载。
31 |
32 | 若在 @"HuajiTech.CoolQ.AppLifecycle.Initializing" 及其他非 @"HuajiTech.CoolQ.AppLifecycle.Enabled" 阶段加载,应遵循以下原则:
33 |
34 | - ✔ 在插件类构造函数内对**类**进行初始化。
35 | - ✔ 在 @"HuajiTech.CoolQ.Events.INotifyAppEnabled.AppEnabled" 事件中初始化**应用**。
36 | - ✘ 不应在插件类构造函数内调用酷Q API。
37 | - ✘ 插件类构造函数不应长时间阻塞线程。
38 | - ✘ 插件类构造函数不应抛出异常。
39 |
40 | 有关详细信息,请参见[酷Q文库](https://docs.cqp.im/dev/v9/tips/#%E5%90%AF%E5%8A%A8-%E5%88%9D%E5%A7%8B%E5%8C%96)。
41 |
42 | ## 事件
43 |
44 | 酷Q事件都被封装为了 .NET 事件。
45 | 当酷Q使用 StdCall 调用事件对应函数时,将会对事件数据进行封装并引发相应的事件。
46 |
47 | ✘ 不允许更改 `app.json` 中预定义的事件函数名。
48 |
49 | 部分酷Q事件被合并为一个或拆分为多个事件。若要获取详细信息,请参见[事件](events.md)。
50 |
51 | ### 事件源
52 |
53 | 事件源定义了一个或一组相关的事件。
54 | 事件源是接口类型。
55 | 定义了单个事件的事件源以 `Notify` 开头,如 @"HuajiTech.CoolQ.Events.INotifyGroupMessageReceived" 接口。
56 | 定义了多个事件的事件源以 `EventSource` 结尾,如 @"HuajiTech.CoolQ.Events.IBotEventSource" 接口。
57 |
58 | ### 处理事件
59 |
60 | 在插件类构造函数中添加参数以获取事件源。通过向事件源对象附加事件处理程序来处理事件。
61 |
62 | ```csharp
63 | public MyPlugin(
64 | INotifyGroupMessageReceived notifyGroupMessageReceived,
65 | IBotEventSource botEventSource)
66 | {
67 | notifyMessageReceived.MessageReceived += ...
68 | botEventSource.AppEnabled += ...
69 | }
70 | ```
71 |
72 | > [!NOTE]
73 | > 尽可能使用定义事件最少的事件源。例如,若插件只需处理消息接收事件,
74 | 则应使用 @"HuajiTech.CoolQ.Events.INotifyGroupMessageReceived",而不是 @"HuajiTech.CoolQ.Events.ICurrentUserEventSource"。
75 |
76 | ### 路由
77 |
78 | 酷Q的所有事件数据类均派生自 @"HuajiTech.CoolQ.Events.RoutedEventArgs" 类。
79 | 将 @"HuajiTech.CoolQ.Events.RoutedEventArgs.Handled" 属性设置为 `true` 以阻断事件。
80 |
81 | ### 菜单和悬浮窗状态
82 |
83 | 菜单项被点击和悬浮窗状态更新均被视为事件。由于事件的数量无法确定,需要手动导出事件处理程序。
84 |
85 | 有关详细信息,请参见[菜单和悬浮窗状态](menus_and_statuses.md)。
86 |
87 | ## 调用酷Q API
88 |
89 | - 通过事件数据。
90 |
91 | ```csharp
92 | private void OnMemberJoined(object sender, GroupEventArgs e)
93 | {
94 | e.Operatee.Mute(TimeSpan.FromMinutes(5));
95 | e.Source.Send("欢迎 " + e.Operatee.DisplayName);
96 | }
97 | ```
98 |
99 | - 通过 @"HuajiTech.CoolQ.PluginContext" 类。对于 @"HuajiTech.CoolQ.PluginContext.Current",建议使用 @"HuajiTech.CoolQ.CurrentPluginContext" 类。
100 |
101 | ```csharp
102 | PluginContext.Current.GetUser(114514).Send("Hello!");
103 | ```
104 |
105 | - 通过 @"HuajiTech.CoolQ.Plugin" 类的 `protected` 实例方法。通常在插件类中使用此方法。
106 |
107 | ```csharp
108 | public class MyPlugin : Plugin
109 | {
110 | ...
111 | foreach (var member in Group(1919810).GetMembers())
112 | ...
113 | }
114 | ```
115 |
116 | - 通过 @"HuajiTech.CoolQ.CurrentPluginContext" 类提供的静态方法。通常在非插件类中使用此方法。
117 |
118 | ```csharp
119 | using static HuajiTech.CoolQ.CurrentPluginContext;
120 |
121 | User(114514).Send("Hello!");
122 | ```
123 |
124 | - 通过 @"HuajiTech.CoolQ.PluginContextExtensions" 类提供的常用扩展方法。
125 |
126 | ```csharp
127 | try
128 | {
129 | ...
130 | user.AsMemberOf(group);
131 | ...
132 | }
133 | catch (Exception ex)
134 | {
135 | ex.LogAsError();
136 | }
137 | ```
138 |
139 | - 通过 @"HuajiTech.CoolQ.Messaging.Image" 和 @"HuajiTech.CoolQ.Messaging.Record" 类。
140 |
141 | ```csharp
142 | image.GetFile();
143 | ```
144 |
145 | ## CQ码
146 |
147 | 可以使用 @"HuajiTech.CoolQ.Messaging.ComplexMessage" 类处理CQ码。
148 |
149 | 有关详细信息,请参见[如何:处理消息](howto_handle_message.md)中的`使用 ComplexMessage`部分。
150 |
151 | ## .NET Core
152 |
153 | 目前,HuajiTech.CoolQ 暂不支持在 .NET Core 上运行。有计划在未来的版本添加对 .NET Core 的支持。
154 |
--------------------------------------------------------------------------------
/documentation/guides/howto_handle_message.md:
--------------------------------------------------------------------------------
1 | # 如何:处理消息
2 |
3 | ## 判断消息来源类型
4 |
5 | ```csharp
6 | if (e.Source is IGroup) { } // 群消息。
7 | if (e.Source is IUser) { } // 私聊消息(包括临时会话和好友消息)。
8 | if (e.Source is IMember) { } // 群临时会话消息(注意:由于酷Q限制,所在群为 Group(0))。
9 | if (e.Source is IFriend) { } // 好友消息。
10 | ```
11 |
12 | ## 使用 @"HuajiTech.CoolQ.Messaging.ComplexMessage"
13 |
14 | 通过 @"HuajiTech.CoolQ.Messaging.AbstractionExtensions.Parse(HuajiTech.CoolQ.Message,System.Boolean)" 扩展方法解析消息。
15 |
16 | ```csharp
17 | var message = e.Message.Parse();
18 | ```
19 |
20 | 获取消息中的所有纯文本拼接成的字符串。
21 |
22 | ```csharp
23 | message.GetPlainText();
24 | ```
25 |
26 | 判断机器人是否被提及(@)。
27 |
28 | ```csharp
29 | if (message.Contains(CurrentUser.Mention()))
30 | {
31 | ...
32 | }
33 | ```
34 |
35 | 使用 @"HuajiTech.CoolQ.Messaging.AbstractionExtensions.Mention(HuajiTech.CoolQ.IUser)" 提及消息的发送者。
36 |
37 | ```csharp
38 | e.Source.Send(e.Sender.Mention() + " How are you?");
39 | // 或直接使用 Reply 扩展方法。
40 | e.Reply("How are you?");
41 | ```
42 |
43 | 解构复合消息。
44 |
45 | ```csharp
46 | var (a, b, c) = message;
47 | ```
48 |
49 | 解构、模式匹配并获取剩余内容。
50 |
51 | ```csharp
52 | if (message is (Mention mention, Image image))
53 | {
54 | var rest = message.Skip(2).ToComplexMessage();
55 | ...
56 | }
57 | ```
58 |
59 | ## 使用正则消息
60 |
61 | 通过 @"HuajiTech.CoolQ.RegexMessage.Decode(HuajiTech.CoolQ.Message)" 扩展方法解码正则消息。
62 |
63 | ```csharp
64 | var args = e.Message.Decode();
65 | ```
66 |
67 | 获取 `Name` 键的值。
68 |
69 | ```csharp
70 | args["Name"]
71 | ```
72 |
--------------------------------------------------------------------------------
/documentation/guides/intro.md:
--------------------------------------------------------------------------------
1 | # 简介
2 |
3 | HuajiTech.CoolQ 是一个用于酷Q应用的 .NET SDK,旨在简化开发。
4 |
5 | ## 特性
6 |
7 | - 通过 StdCall 导出。
8 | - 以 [NuGet 包](https://www.nuget.org/packages/HuajiTech.CoolQ/)发布。
9 | - **高度封装。**
10 |
11 | ## 不适合使用此 SDK 的情况
12 |
13 | - 你希望直接操作酷Q API。
14 | - 你需要很强的自定义能力。
15 |
16 | ## 接下来
17 |
18 | [你的第一个应用](your_first_app.md)
19 |
--------------------------------------------------------------------------------
/documentation/guides/menus_and_statuses.md:
--------------------------------------------------------------------------------
1 | # 菜单和悬浮窗状态
2 |
3 | ## 事件处理程序
4 |
5 | 菜单和悬浮窗状态的事件处理程序必须为静态方法。
6 |
7 | ### 菜单项被点击
8 |
9 | 菜单项被点击事件没有任何形参,也没有返回值。
10 |
11 | ```csharp
12 | static void OnMenuItemClicked();
13 | ```
14 |
15 | ### 悬浮窗状态更新
16 |
17 | 悬浮窗状态更新事件没有任何形参,返回一个字符串。返回的字符串是以 Base64 编码的状态数据。
18 |
19 | ```csharp
20 | static string OnStatusUpdating();
21 | ```
22 |
23 | 通过 @"HuajiTech.CoolQ.Status" 类和 @"HuajiTech.CoolQ.Status.Encode" 方法可以方便地创建状态数据并进行编码。
24 |
25 | ```csharp
26 | static string OnStatusUpdating()
27 | {
28 | return new HuajiTech.CoolQ.Status(
29 | value: "值",
30 | unit: "单位",
31 | color: HuajiTech.CoolQ.StatusColor.Green
32 | ).Encode();
33 | }
34 | ```
35 |
36 | ## 将托管方法导出为非托管方法
37 |
38 | 上面创建的事件处理程序是托管方法,但酷Q只能调用以 StdCall 导出的非托管方法。
39 | 通过 `HuajiTech.UnmanagedExports.DllExportAttribute` 可以标记要导出的方法。
40 |
41 | ```csharp
42 | [HuajiTech.UnmanagedExports.DllExport]
43 | static string OnStatusUpdating();
44 | ```
45 |
46 | 通过设置 `HuajiTech.UnmanagedExports.DllExportAttribute.EntryPoint` 属性,可以自定义导出后的方法的入口点名称。
47 | 如果 `EntryPoint` 属性为 `null`,将会使用方法名称作为入口点名称。
48 | 不能定义重复的入口点名称。
49 |
50 | ```csharp
51 | [HuajiTech.UnmanagedExports.DllExport(EntryPoint = "OnMenuItemClicked")]
52 | static void OpenConfiguration();
53 | ```
54 |
55 | ## 配置 `app.json`
56 |
57 | 在 `app.json` 中的 `status` 或 `menu` 下增加相应格式的元素,并将 `function` 的值设为导出的入口点名称。
58 |
59 | ```json
60 | "menu": [
61 | {
62 | "name": "菜单项",
63 | "function": "OnMenuItemClicked"
64 | }
65 | ],
66 | "status": [
67 | {
68 | "id": 1,
69 | "name": "悬浮窗",
70 | "title": "FLOAT",
71 | "function": "OnStatusUpdating",
72 | "period": "1000"
73 | }
74 | ]
75 | ```
76 |
--------------------------------------------------------------------------------
/documentation/guides/toc.md:
--------------------------------------------------------------------------------
1 | # [简介](intro.md)
2 |
3 | # [你的第一个应用](your_first_app.md)
4 |
5 | # [入门](getting_started.md)
6 |
7 | # [事件](events.md)
8 |
9 | # [菜单和悬浮窗状态](menus_and_statuses.md)
10 |
11 | # [如何:处理消息](howto_handle_message.md)
--------------------------------------------------------------------------------
/documentation/guides/your_first_app.md:
--------------------------------------------------------------------------------
1 | # 你的第一个应用
2 |
3 | 1. 创建一个新的 C# 类库项目,并选择 **.NET Framework 4.6.1** 及以上版本作为目标框架。
4 | 2. 安装 HuajiTech.CoolQ NuGet 包。
5 | 3. 将以下代码粘贴到 `MyPlugin.cs`。
6 |
7 | ```csharp
8 | using HuajiTech.CoolQ;
9 | using HuajiTech.CoolQ.Events;
10 |
11 | [Plugin]
12 | public class MyPlugin : Plugin
13 | {
14 | public MyPlugin(IMessageEventSource eventSource)
15 | {
16 | eventSource.AddMessageReceivedEventHandler((sender, e) =>
17 | {
18 | // 向消息来源聊天发送收到的消息,即复读。
19 | e.Source.Send(e.Message);
20 | });
21 | }
22 | }
23 | ```
24 |
25 | 4. 编译。
26 | 5. 将 `{输出目录}\app.publish\` 中的文件复制到酷Q的 `dev\com.example.app\` 目录。
27 | 6. 重载应用并启用。
28 |
29 | ## 接下来
30 |
31 | [入门](getting_started.md)
32 |
--------------------------------------------------------------------------------
/documentation/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huajitech/coolq-dotnet-sdk/6d7fdbf4ae6bb41c2f2df24d9011fe08505072fa/documentation/images/favicon.ico
--------------------------------------------------------------------------------
/documentation/index.md:
--------------------------------------------------------------------------------
1 | # HuajiTech.CoolQ 文档
2 |
3 | - 通过 [GitHub 主页](https://github.com/huajitech/coolq-dotnet-sdk) 认识该项目。
4 | - 查看 [指南](guides/intro.md) 以快速入门。
5 | - 在 [API 参考](api/index.md) 中了解技术细节。
6 |
--------------------------------------------------------------------------------
/documentation/toc.yml:
--------------------------------------------------------------------------------
1 | - name: 指南
2 | href: guides/
3 | - name: API 参考
4 | href: api/
5 | homepage: api/index.md
--------------------------------------------------------------------------------
/src/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/AppIdAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 指定当前程序集的 AppID。
7 | /// 此类不能被继承。
8 | ///
9 | [AttributeUsage(AttributeTargets.Assembly)]
10 | public sealed class AppIdAttribute : Attribute
11 | {
12 | ///
13 | /// 以指定的 ID 初始化一个 类的新实例。
14 | ///
15 | /// 应用的 AppID。
16 | public AppIdAttribute(string id) => Id = id;
17 |
18 | ///
19 | /// 获取当前 实例的 ID。
20 | ///
21 | public string Id { get; }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/AppLifecycle.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 指定应用生命周期。
5 | ///
6 | public enum AppLifecycle
7 | {
8 | ///
9 | /// 应用未被加载。
10 | ///
11 | NotLoaded,
12 |
13 | ///
14 | /// 应用已被加载。
15 | ///
16 | Loaded,
17 |
18 | ///
19 | /// 应用正在初始化。
20 | ///
21 | Initializing,
22 |
23 | ///
24 | /// 机器人已启动。
25 | ///
26 | BotStarted,
27 |
28 | ///
29 | /// 应用已被启用。
30 | ///
31 | Enabled,
32 |
33 | ///
34 | /// 应用正在停用。
35 | ///
36 | Disabling,
37 |
38 | ///
39 | /// 机器人正在关闭。
40 | ///
41 | BotStopping
42 | }
43 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/CurrentPluginContext.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 提供操作 的静态方法。
5 | ///
6 | public static class CurrentPluginContext
7 | {
8 | ///
9 | /// 获取 的 。
10 | ///
11 | public static IBot Bot => PluginContext.Current.Bot;
12 |
13 | ///
14 | /// 获取 的 。
15 | ///
16 | public static ICurrentUser CurrentUser => Bot.CurrentUser;
17 |
18 | ///
19 | /// 获取 的 。
20 | ///
21 | public static ILogger Logger => Bot.Logger;
22 |
23 | ///
24 | /// 创建指定号码的好友。
25 | ///
26 | /// 号码。
27 | public static IFriend Friend(long number) => PluginContext.Current.GetFriend(number);
28 |
29 | ///
30 | /// 创建指定号码的群。
31 | ///
32 | /// 号码。
33 | public static IGroup Group(long number) => PluginContext.Current.GetGroup(number);
34 |
35 | ///
36 | /// 创建指定号码和群的成员。
37 | ///
38 | /// 号码。
39 | /// 群。
40 | public static IMember Member(long number, IGroup group) => PluginContext.Current.GetMember(number, group);
41 |
42 | ///
43 | /// 创建指定号码和群号码的成员。
44 | ///
45 | /// 号码。
46 | /// 群号码。
47 | public static IMember Member(long number, long groupNumber) => PluginContext.Current.GetMember(number, groupNumber);
48 |
49 | ///
50 | /// 创建指定号码的用户。
51 | ///
52 | /// 号码。
53 | public static IUser User(long number) => PluginContext.Current.GetUser(number);
54 |
55 | ///
56 | /// 创建指定 ID 的消息。
57 | ///
58 | /// ID。
59 | public static Message Message(int id) => PluginContext.Current.GetMessage(id);
60 | }
61 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/CustomTitle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 表示自定义头衔。
7 | ///
8 | public class CustomTitle
9 | {
10 | ///
11 | /// 以指定的文本和过期时间初始化一个 类的新实例。
12 | ///
13 | /// 文本。
14 | /// 过期时间。
15 | /// 为 、 或仅由空白字符组成。
16 | public CustomTitle(string text, DateTime? expirationTime = null)
17 | {
18 | if (string.IsNullOrWhiteSpace(text))
19 | {
20 | throw new ArgumentException(AbstractionResources.FieldCannotBeEmptyOrWhiteSpace, nameof(text));
21 | }
22 |
23 | Text = text;
24 | ExpirationTime = expirationTime;
25 | }
26 |
27 | ///
28 | /// 获取当前 实例的过期时间。
29 | /// 如果没有过期时间,则为 。
30 | ///
31 | public DateTime? ExpirationTime { get; }
32 |
33 | ///
34 | /// 获取当前 的文本。
35 | ///
36 | public string Text { get; }
37 | }
38 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/AnonymousMessageReceivedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 为 事件提供数据。
5 | ///
6 | public class AnonymousMessageReceivedEventArgs : RoutedEventArgs
7 | {
8 | public AnonymousMessageReceivedEventArgs(Message message, IGroup source, IAnonymousMember sender)
9 | {
10 | Message = message;
11 | Source = source;
12 | Sender = sender;
13 | }
14 |
15 | ///
16 | /// 获取消息。
17 | ///
18 | public virtual Message Message { get; }
19 |
20 | ///
21 | /// 获取发送者。
22 | ///
23 | public virtual IAnonymousMember Sender { get; }
24 |
25 | ///
26 | /// 获取来源群。
27 | ///
28 | public virtual IGroup Source { get; }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/FileUploadedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 事件提供数据。
7 | ///
8 | public class FileUploadedEventArgs : TimedEventArgs
9 | {
10 | public FileUploadedEventArgs(DateTime time, IGroup source, IMember uploader, File file)
11 | : base(time)
12 | {
13 | Source = source;
14 | Uploader = uploader;
15 | File = file;
16 | }
17 |
18 | ///
19 | /// 获取来源群。
20 | ///
21 | public virtual IGroup Source { get; }
22 |
23 | ///
24 | /// 获取上传用户。
25 | ///
26 | public virtual IMember Uploader { get; }
27 |
28 | ///
29 | /// 获取上传的文件。
30 | ///
31 | public virtual File File { get; }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/FriendAddedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 事件提供数据。
7 | ///
8 | public class FriendAddedEventArgs : TimedEventArgs
9 | {
10 | public FriendAddedEventArgs(DateTime time, IFriend operatee)
11 | : base(time)
12 | {
13 | Operatee = operatee;
14 | }
15 |
16 | ///
17 | /// 获取添加的好友。
18 | ///
19 | public virtual IFriend Operatee { get; }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/FriendshipRequestedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 事件提供数据。
7 | ///
8 | public class FriendshipRequestedEventArgs : TimedEventArgs
9 | {
10 | public FriendshipRequestedEventArgs(DateTime time, IUser requester, IFriendshipRequest request)
11 | : base(time)
12 | {
13 | Requester = requester;
14 | Request = request;
15 | }
16 |
17 | ///
18 | /// 获取请求用户。
19 | ///
20 | public virtual IUser Requester { get; }
21 |
22 | ///
23 | /// 获取请求。
24 | ///
25 | public virtual IFriendshipRequest Request { get; }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/GroupEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为群事件提供数据。
7 | ///
8 | public class GroupEventArgs : TimedEventArgs
9 | {
10 | public GroupEventArgs(DateTime time, IGroup source, IMember @operator, IMember operatee)
11 | : base(time)
12 | {
13 | Source = source;
14 | Operator = @operator;
15 | Operatee = operatee;
16 | }
17 |
18 | ///
19 | /// 获取来源群。
20 | ///
21 | public virtual IGroup Source { get; }
22 |
23 | ///
24 | /// 获取操作人。
25 | ///
26 | [System.Diagnostics.CodeAnalysis.SuppressMessage(
27 | "Naming", "CA1716:标识符不应与关键字匹配", Justification = "<挂起>")]
28 | public virtual IMember Operator { get; }
29 |
30 | ///
31 | /// 获取被操作人。
32 | ///
33 | public virtual IMember Operatee { get; }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/GroupMessageReceivedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 为 事件提供数据。
5 | ///
6 | public class GroupMessageReceivedEventArgs : MessageReceivedEventArgs
7 | {
8 | public GroupMessageReceivedEventArgs(Message message, IGroup source, IMember sender)
9 | : base(message, source, sender)
10 | {
11 | Source = source;
12 | Sender = sender;
13 | }
14 |
15 | ///
16 | /// 获取来源群。
17 | ///
18 | public new virtual IGroup Source { get; }
19 |
20 | ///
21 | /// 获取发送成员。
22 | ///
23 | public new virtual IMember Sender { get; }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/GroupMuteEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 和 事件提供数据。
7 | ///
8 | public class GroupMuteEventArgs : TimedEventArgs
9 | {
10 | public GroupMuteEventArgs(DateTime time, IGroup source, IMember @operator)
11 | : base(time)
12 | {
13 | Source = source;
14 | Operator = @operator;
15 | }
16 |
17 | ///
18 | /// 获取来源群。
19 | ///
20 | public virtual IGroup Source { get; }
21 |
22 | ///
23 | /// 获取操作者。
24 | ///
25 | [System.Diagnostics.CodeAnalysis.SuppressMessage(
26 | "Naming", "CA1716:标识符不应与关键字匹配", Justification = "<挂起>")]
27 | public virtual IMember Operator { get; }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/MemberMutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 事件提供数据。
7 | ///
8 | public class MemberMutedEventArgs : GroupEventArgs
9 | {
10 | public MemberMutedEventArgs(
11 | DateTime time, IGroup source, IMember @operator, IMember operatee, TimeSpan duration)
12 | : base(time, source, @operator, operatee)
13 | {
14 | Duration = duration;
15 | }
16 |
17 | ///
18 | /// 获取禁言时长。
19 | ///
20 | public virtual TimeSpan Duration { get; }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/MembershipInvitedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 事件提供数据。
7 | ///
8 | public class MembershipInvitedEventArgs : TimedEventArgs
9 | {
10 | public MembershipInvitedEventArgs(
11 | DateTime time, IGroup target, IUser inviter, IRequest invitation)
12 | : base(time)
13 | {
14 | Target = target;
15 | Inviter = inviter;
16 | Invitation = invitation;
17 | }
18 |
19 | ///
20 | /// 获取目标群。
21 | ///
22 | public virtual IGroup Target { get; }
23 |
24 | ///
25 | /// 获取邀请用户。
26 | ///
27 | public virtual IUser Inviter { get; }
28 |
29 | ///
30 | /// 获取邀请。
31 | ///
32 | public virtual IRequest Invitation { get; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/MembershipRequestedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为 事件提供数据。
7 | ///
8 | public class MembershipRequestedEventArgs : TimedEventArgs
9 | {
10 | public MembershipRequestedEventArgs(
11 | DateTime time, IGroup source, IUser requester, IMembershipRequest request)
12 | : base(time)
13 | {
14 | Source = source;
15 | Requester = requester;
16 | Request = request;
17 | }
18 |
19 | ///
20 | /// 获取来源群。
21 | ///
22 | public virtual IGroup Source { get; }
23 |
24 | ///
25 | /// 获取请求用户。
26 | ///
27 | public virtual IUser Requester { get; }
28 |
29 | ///
30 | /// 获取请求。
31 | ///
32 | public virtual IMembershipRequest Request { get; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/MessageReceivedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 为消息接收事件数据提供基类。
5 | ///
6 | public class MessageReceivedEventArgs : RoutedEventArgs
7 | {
8 | public MessageReceivedEventArgs(Message message, IChattable source, IUser sender)
9 | {
10 | Message = message;
11 | Source = source;
12 | Sender = sender;
13 | }
14 |
15 | ///
16 | /// 获取消息。
17 | ///
18 | public virtual Message Message { get; }
19 |
20 | ///
21 | /// 获取来源聊天。
22 | ///
23 | public virtual IChattable Source { get; }
24 |
25 | ///
26 | /// 获取发送者。
27 | ///
28 | public virtual IUser Sender { get; }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/RoutedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 表示路由事件的数据,并为所有事件数据提供基类。
7 | ///
8 | public class RoutedEventArgs : EventArgs
9 | {
10 | ///
11 | /// 获取或设置一个值,指示事件是否已处理完毕。
12 | ///
13 | public virtual bool Handled { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/TimedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 为可以提供引发时间的事件数据提供基类。
7 | ///
8 | public class TimedEventArgs : RoutedEventArgs
9 | {
10 | public TimedEventArgs(DateTime time)
11 | {
12 | Time = time;
13 | }
14 |
15 | ///
16 | /// 获取事件发生的时间。
17 | ///
18 | public virtual DateTime Time { get; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventArgses/UserMessageReceivedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 为 事件提供数据。
5 | ///
6 | public class UserMessageReceivedEventArgs : MessageReceivedEventArgs
7 | {
8 | public UserMessageReceivedEventArgs(Message message, IUser source, IUser sender)
9 | : base(message, source, sender)
10 | {
11 | Source = source;
12 | }
13 |
14 | ///
15 | /// 获取来源用户。
16 | ///
17 | public new virtual IUser Source { get; }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IAdministratorshipEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义管理员事件。
5 | ///
6 | public interface IAdministratorshipEventSource : INotifyAdministratorAdded, INotifyAdministratorRemoved
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IBotEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义机器人事件。
5 | ///
6 | public interface IBotEventSource :
7 | INotifyAppDisabling,
8 | INotifyAppEnabled,
9 | INotifyBotStarted,
10 | INotifyBotStopping
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/ICurrentUserEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义当前用户事件。
5 | ///
6 | public interface ICurrentUserEventSource : IMessageEventSource, IFriendshipEventSource
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IFriendshipEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义好友事件。
5 | ///
6 | public interface IFriendshipEventSource : INotifyFriendAdded, INotifyFriendshipRequested
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IGroupEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义群事件。
5 | ///
6 | public interface IGroupEventSource :
7 | IMuteEventSource,
8 | IMembershipEventSource,
9 | IAdministratorshipEventSource,
10 | INotifyFileUploaded
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IMembershipEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义群成员事件。
5 | ///
6 | public interface IMembershipEventSource :
7 | INotifyMemberJoined,
8 | INotifyMemberLeft,
9 | INotifyMembershipRequested,
10 | INotifyMembershipInvited
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IMessageEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义消息事件。
5 | ///
6 | public interface IMessageEventSource :
7 | INotifyAnonymousMessageReceived,
8 | INotifyUserMessageReceived,
9 | INotifyGroupMessageReceived
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/EventSources/IMuteEventSource.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ.Events
2 | {
3 | ///
4 | /// 定义禁言事件。
5 | ///
6 | public interface IMuteEventSource :
7 | INotifyMemberMuted,
8 | INotifyMemberUnmuted,
9 | INotifyGroupMuted,
10 | INotifyGroupUnmuted
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义扩展方法。
7 | ///
8 | public static class Extensions
9 | {
10 | ///
11 | /// 添加消息接收事件处理程序。
12 | /// 即同时添加私聊消息接收事件和群消息接收事件的事件处理程序。
13 | ///
14 | /// 事件源。
15 | /// 事件处理程序。
16 | public static void AddMessageReceivedEventHandler(
17 | this IMessageEventSource messageEventSource,
18 | EventHandler handler)
19 | {
20 | if (messageEventSource is null)
21 | {
22 | throw new ArgumentNullException(nameof(messageEventSource));
23 | }
24 |
25 | messageEventSource.UserMessageReceived += new EventHandler(handler);
26 | messageEventSource.GroupMessageReceived += new EventHandler(handler);
27 | }
28 |
29 | ///
30 | /// 移除消息接收事件处理程序。
31 | /// 即同时移除私聊消息接收事件和群消息接收事件的事件处理程序。
32 | ///
33 | /// 事件源。
34 | /// 事件处理程序。
35 | public static void RemoveMessageReceivedEventHandler(
36 | this IMessageEventSource messageEventSource,
37 | EventHandler handler)
38 | {
39 | if (messageEventSource is null)
40 | {
41 | throw new ArgumentNullException(nameof(messageEventSource));
42 | }
43 |
44 | messageEventSource.UserMessageReceived -= new EventHandler(handler);
45 | messageEventSource.GroupMessageReceived -= new EventHandler(handler);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyAdministratorAdded.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义管理员添加事件。
7 | ///
8 | public interface INotifyAdministratorAdded
9 | {
10 | ///
11 | /// 在添加管理员时引发。
12 | ///
13 | event EventHandler AdministratorAdded;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyAdministratorRemoved.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义管理员移除事件。
7 | ///
8 | public interface INotifyAdministratorRemoved
9 | {
10 | ///
11 | /// 在移除管理员时引发。
12 | ///
13 | event EventHandler AdministratorRemoved;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyAnonymousMessageReceived.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义匿名消息接收事件。
7 | ///
8 | public interface INotifyAnonymousMessageReceived
9 | {
10 | ///
11 | /// 在收到匿名消息时引发。
12 | ///
13 | event EventHandler AnonymousMessageReceived;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyAppDisabling.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义应用禁用事件。
7 | ///
8 | public interface INotifyAppDisabling
9 | {
10 | ///
11 | /// 在应用被禁用时引发。
12 | ///
13 | event EventHandler AppDisabling;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyAppEnabled.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义应用启用事件。
7 | ///
8 | public interface INotifyAppEnabled
9 | {
10 | ///
11 | /// 在应用被启用时引发。
12 | ///
13 | event EventHandler AppEnabled;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyBotStarted.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义机器人启动事件。
7 | ///
8 | public interface INotifyBotStarted
9 | {
10 | ///
11 | /// 在机器人启动时引发。
12 | ///
13 | event EventHandler BotStarted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyBotStopping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义机器人停止事件。
7 | ///
8 | public interface INotifyBotStopping
9 | {
10 | ///
11 | /// 在机器人停止时引发。
12 | ///
13 | event EventHandler BotStopping;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyFileUploaded.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义文件上传事件。
7 | ///
8 | public interface INotifyFileUploaded
9 | {
10 | ///
11 | /// 在上传文件时引发。
12 | ///
13 | event EventHandler FileUploaded;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyFriendAdded.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义好友已添加事件。
7 | ///
8 | public interface INotifyFriendAdded
9 | {
10 | ///
11 | /// 在好友已添加时引发。
12 | ///
13 | event EventHandler FriendAdded;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyFriendshipRequested.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义好友正在添加事件。
7 | ///
8 | public interface INotifyFriendshipRequested
9 | {
10 | ///
11 | /// 在收到好友请求时引发。
12 | ///
13 | event EventHandler FriendshipRequested;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyGroupMessageReceived.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义群消息接收事件。
7 | ///
8 | public interface INotifyGroupMessageReceived
9 | {
10 | ///
11 | /// 在收到群消息时引发。
12 | ///
13 | event EventHandler GroupMessageReceived;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyGroupMuted.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义群禁言事件。
7 | ///
8 | public interface INotifyGroupMuted
9 | {
10 | ///
11 | /// 在禁言时引发。
12 | ///
13 | event EventHandler GroupMuted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyGroupUnmuted.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义群解除禁言事件。
7 | ///
8 | public interface INotifyGroupUnmuted
9 | {
10 | ///
11 | /// 在解除禁言时引发。
12 | ///
13 | event EventHandler GroupUnmuted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyMemberJoined.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义成员加入事件。
7 | ///
8 | public interface INotifyMemberJoined
9 | {
10 | ///
11 | /// 在成员加入时引发。
12 | ///
13 | event EventHandler MemberJoined;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyMemberLeft.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义成员离开事件。
7 | ///
8 | public interface INotifyMemberLeft
9 | {
10 | ///
11 | /// 在成员离开时引发。
12 | ///
13 | event EventHandler MemberLeft;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyMemberMuted.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义成员禁言事件。
7 | ///
8 | public interface INotifyMemberMuted
9 | {
10 | ///
11 | /// 在禁言时引发。
12 | ///
13 | event EventHandler MemberMuted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyMemberUnmuted.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义成员解除禁言事件。
7 | ///
8 | public interface INotifyMemberUnmuted
9 | {
10 | ///
11 | /// 在解除禁言时引发。
12 | ///
13 | event EventHandler MemberUnmuted;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyMembershipInvited.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义入群邀请事件。
7 | ///
8 | public interface INotifyMembershipInvited
9 | {
10 | ///
11 | /// 在被邀请加群时引发。
12 | ///
13 | event EventHandler MembershipInvited;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyMembershipRequested.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义入群请求事件。
7 | ///
8 | public interface INotifyMembershipRequested
9 | {
10 | ///
11 | /// 在收到入群请求时引发。
12 | ///
13 | event EventHandler MembershipRequested;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Events/Notifications/INotifyUserMessageReceived.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ.Events
4 | {
5 | ///
6 | /// 定义私聊消息接收事件。
7 | ///
8 | public interface INotifyUserMessageReceived
9 | {
10 | ///
11 | /// 在收到私聊消息时引发。
12 | ///
13 | event EventHandler UserMessageReceived;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Exceptions/ApiException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 |
4 | namespace HuajiTech.CoolQ
5 | {
6 | ///
7 | /// 在 API 调用发生错误时引发的异常。
8 | ///
9 | [Serializable]
10 | public class ApiException : Exception
11 | {
12 | public ApiException()
13 | {
14 | }
15 |
16 | public ApiException(string message)
17 | : base(message)
18 | {
19 | }
20 |
21 | public ApiException(string message, int errorCode)
22 | : this(message)
23 | {
24 | ErrorCode = errorCode;
25 | }
26 |
27 | public ApiException(string message, Exception innerException)
28 | : base(message, innerException)
29 | {
30 | }
31 |
32 | protected ApiException(SerializationInfo info, StreamingContext context)
33 | : base(info, context)
34 | {
35 | }
36 |
37 | ///
38 | /// 获取当前 实例的错误代码。
39 | /// 如果没有错误代码,则为 。
40 | ///
41 | public int? ErrorCode { get; }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Exceptions/PluginLoadException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 |
4 | namespace HuajiTech.CoolQ
5 | {
6 | [Serializable]
7 | public class PluginLoadException : Exception
8 | {
9 | public PluginLoadException()
10 | {
11 | }
12 |
13 | public PluginLoadException(string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public PluginLoadException(string message, Exception innerException)
19 | : base(message, innerException)
20 | {
21 | }
22 |
23 | protected PluginLoadException(SerializationInfo info, StreamingContext context)
24 | : base(info, context)
25 | {
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/File.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 表示文件。
5 | ///
6 | public class File
7 | {
8 | ///
9 | /// 以指定的 ID、名称、长度和 BusID 初始化一个 类的新实例。
10 | ///
11 | /// ID。
12 | /// 名称。
13 | /// 长度。
14 | /// BusID。
15 | public File(string id, string name, long length, long busId)
16 | {
17 | Id = id;
18 | Name = name;
19 | Length = length;
20 | BusId = busId;
21 | }
22 |
23 | ///
24 | /// 获取当前 实例的 BusID。
25 | ///
26 | public long BusId { get; }
27 |
28 | ///
29 | /// 获取当前 实例的 ID。
30 | ///
31 | public string Id { get; }
32 |
33 | ///
34 | /// 获取当前 实例的长度。
35 | ///
36 | public long Length { get; }
37 |
38 | ///
39 | /// 获取当前 实例的名称。
40 | ///
41 | public string Name { get; }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/Gender.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 指定性别。
5 | ///
6 | public enum Gender
7 | {
8 | ///
9 | /// 男。
10 | ///
11 | Male,
12 |
13 | ///
14 | /// 女。
15 | ///
16 | Female,
17 |
18 | ///
19 | /// 未知。
20 | ///
21 | Unknown = 255
22 | }
23 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/HuajiTech.CoolQ.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | HuajiTech.CoolQ
5 | netstandard2.0;net461;net45
6 | 8
7 | enable
8 | true
9 | HuajiTech.CoolQ.Abstractions.pfx
10 | 0.4.0-beta
11 | SYC
12 | HuajiTech
13 | 对于 HuajiTech.CoolQ 的抽象。
14 | Copyright (C) 2020 HuajiTech
15 | LGPL-3.0-or-later
16 | https://github.com/huajitech/coolq-dotnet-sdk
17 | Icon.png
18 | https://github.com/huajitech/coolq-dotnet-sdk
19 | git
20 | HuajiTech, CoolQ, 酷Q, QQ, Bot, Robot, 机器人
21 | 这是一个测试版本,不建议用于生产环境。
22 | zh-CN
23 | true
24 | true
25 | C:\Users\SYC\source\repos\HuajiTech.CoolQ\src\HuajiTech.CoolQ.Abstractions\HuajiTech.CoolQ.Abstractions.xml
26 |
27 |
28 |
29 |
30 | True
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | all
42 | runtime; build; native; contentfiles; analyzers; buildtransitive
43 |
44 |
45 | all
46 | runtime; build; native; contentfiles; analyzers; buildtransitive
47 |
48 |
49 |
50 |
51 |
52 | AbstractionResources.resx
53 | True
54 | True
55 |
56 |
57 |
58 |
59 |
60 | AbstractionResources.Designer.cs
61 | ResXFileCodeGenerator
62 |
63 |
64 |
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IAliased.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 提供别名。
5 | ///
6 | public interface IAliased
7 | {
8 | ///
9 | /// 获取当前 实例的别名。
10 | ///
11 | [System.Diagnostics.CodeAnalysis.SuppressMessage(
12 | "Naming", "CA1716:标识符不应与关键字匹配", Justification = "<挂起>")]
13 | string? Alias { get; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IAnonymousMember.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 定义匿名成员。
7 | ///
8 | public interface IAnonymousMember : IDisplayable, IMuteable, IEquatable
9 | {
10 | ///
11 | /// 获取当前 实例的标识符。
12 | ///
13 | long Id { get; }
14 |
15 | ///
16 | /// 获取当前 实例的所属群。
17 | ///
18 | public IGroup Group { get; }
19 |
20 | ///
21 | /// 获取当前 实例的名称。
22 | ///
23 | public string? Name { get; }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IBot.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 定义机器人。
7 | ///
8 | public interface IBot
9 | {
10 | ///
11 | /// 获取一个值,指示当前 实例是否可以发送图片。
12 | ///
13 | bool CanSendImage { get; }
14 |
15 | ///
16 | /// 获取一个值,指示当前 实例是否可以发送录音。
17 | ///
18 | bool CanSendRecord { get; }
19 |
20 | ///
21 | /// 获取当前 实例的当前用户。
22 | ///
23 | ICurrentUser CurrentUser { get; }
24 |
25 | ///
26 | /// 获取当前 实例的日志记录器。
27 | ///
28 | ILogger Logger { get; }
29 |
30 | ///
31 | /// 获取当前 实例的应用目录。
32 | ///
33 | DirectoryInfo AppDirectory { get; }
34 |
35 | ///
36 | /// 请求指定文件名的图片。
37 | ///
38 | /// 请求获取的图片的文件名。
39 | FileInfo GetImage(string fileName);
40 |
41 | ///
42 | /// 请求指定文件名的录音。
43 | ///
44 | /// 请求获取的录音的文件名。
45 | /// 请求获取的录音的格式。
46 | FileInfo GetRecord(string fileName, string fileFormat);
47 | }
48 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IChattable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 定义聊天。
7 | ///
8 | public interface IChattable : ISendee, IDisplayable, IEquatable
9 | {
10 | ///
11 | /// 获取当前 实例的号码。
12 | ///
13 | long Number { get; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/ICurrentUser.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 定义当前用户。
7 | ///
8 | public interface ICurrentUser : IUser
9 | {
10 | ///
11 | /// 获取当前 实例的所有好友。
12 | ///
13 | IReadOnlyCollection GetFriends();
14 |
15 | ///
16 | /// 获取当前 实例在指定域下的 Cookies。
17 | ///
18 | string GetCookies(string domain);
19 |
20 | ///
21 | /// 获取当前 实例的 CSRF 令牌。
22 | ///
23 | int GetCsrfToken();
24 |
25 | ///
26 | /// 获取当前 实例的所有群。
27 | ///
28 | IReadOnlyCollection GetGroups();
29 | }
30 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IDisplayable.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 提供用于显示的属性。
5 | ///
6 | public interface IDisplayable
7 | {
8 | ///
9 | /// 获取当前 实例的显示名称。
10 | ///
11 | string DisplayName { get; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IFriend.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 定义好友。
5 | ///
6 | public interface IFriend : IUser, IAliased
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IFriendshipRequest.cs:
--------------------------------------------------------------------------------
1 | namespace HuajiTech.CoolQ
2 | {
3 | ///
4 | /// 定义好友请求。
5 | ///
6 | public interface IFriendshipRequest : IRequest
7 | {
8 | ///
9 | /// 同意当前请求,并为好友设置别名。
10 | ///
11 | /// 要设置的别名。
12 | [System.Diagnostics.CodeAnalysis.SuppressMessage(
13 | "Naming", "CA1716:标识符不应与关键字匹配", Justification = "<挂起>")]
14 | void Accept(string alias);
15 | }
16 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/IGroup.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace HuajiTech.CoolQ
4 | {
5 | ///
6 | /// 定义群。
7 | ///
8 | public interface IGroup : IChattable, IMuteable, IRequestable
9 | {
10 | ///
11 | /// 获取当前 实例的名称。
12 | ///
13 | public string? Name { get; }
14 |
15 | ///
16 | /// 获取当前 实例的成员容量。
17 | ///
18 | int MemberCapacity { get; }
19 |
20 | ///
21 | /// 获取当前 实例的成员数。
22 | ///
23 | int MemberCount { get; }
24 |
25 | ///
26 | /// 禁用当前 实例的匿名功能。
27 | ///
28 | void DisableAnonymous();
29 |
30 | ///
31 | /// 解散当前 实例。
32 | ///
33 | void Disband();
34 |
35 | ///
36 | /// 启用当前 实例的匿名功能。
37 | ///
38 | void EnableAnonymous();
39 |
40 | ///
41 | /// 获取当前 实例的所有成员。
42 | ///
43 | IReadOnlyCollection GetMembers();
44 |
45 | ///
46 | /// 离开当前 实例。
47 | ///
48 | void Leave();
49 | }
50 | }
--------------------------------------------------------------------------------
/src/HuajiTech.CoolQ.Abstractions/ILoader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace HuajiTech.CoolQ.Loaders
5 | {
6 | ///
7 | /// 定义加载器。
8 | ///
9 | public interface ILoader
10 | {
11 | ///
12 | /// 获取指定类型的插件。
13 | ///
14 | /// 插件的类型。
15 | /// 指定的插件类型的实例。
16 | T GetPlugin()
17 | where T : notnull;
18 |
19 | ///
20 | /// 获取指定类型的插件。
21 | ///
22 | /// 插件的类型。
23 | /// 指定的插件类型的实例。
24 | object GetPlugin(Type pluginType);
25 |
26 | ///
27 | /// 获取在指定加载时机加载的插件。
28 | ///
29 | /// 加载时机。
30 | /// 取在指定加载时机加载的插件集合。
31 | /// 如果没有在指定的加载时机加载的插件,则该方法返回空序列。
32 | IReadOnlyCollection