Class InteractionModuleBase<T>
- Namespace
- HeyBox.Interactions
- Assembly
- HeyBox.Net.Interactions.dll
提供一个用于继承的命令模块基类。
public abstract class InteractionModuleBase<T> : IInteractionModuleBase where T : class, IInteractionContext
Type Parameters
T命令上下文的类型。
- Inheritance
-
InteractionModuleBase<T>
- Implements
- Derived
- Inherited Members
Properties
Context
Gets the underlying context of the command.
public T Context { get; }
Property Value
- T
Methods
AfterExecute(ICommandInfo)
在应用程序命令执行后同步执行的方法。
public virtual void AfterExecute(ICommandInfo command)
Parameters
commandICommandInfo相关的命令信息。
AfterExecuteAsync(ICommandInfo)
在应用程序命令执行后异步执行的方法。
public virtual Task AfterExecuteAsync(ICommandInfo command)
Parameters
commandICommandInfo相关的命令信息。
Returns
BeforeExecute(ICommandInfo)
在执行应用程序命令之前同步执行的方法。
public virtual void BeforeExecute(ICommandInfo command)
Parameters
commandICommandInfo相关的命令信息。
BeforeExecuteAsync(ICommandInfo)
在执行应用程序命令之前异步执行的方法。
public virtual Task BeforeExecuteAsync(ICommandInfo command)
Parameters
commandICommandInfo相关的命令信息。
Returns
Construct(ModuleBuilder, InteractionService)
当模块创建完成后创建模块信息前执行的方法。
public virtual void Construct(ModuleBuilder builder, InteractionService commandService)
Parameters
builderModuleBuilder构建此方法的模块构建器。
commandServiceInteractionService构建此方法的命令服务实例。
OnModuleBuilding(InteractionService, ModuleInfo)
当构建模块时执行的方法。
public virtual void OnModuleBuilding(InteractionService commandService, ModuleInfo module)
Parameters
commandServiceInteractionService构建此方法的命令服务实例。
moduleModuleInfo此模块的信息。
ReplyCardAsync(ICard, bool, RequestOptions?)
回复卡片消息到此消息频道。
public Task<IUserMessage> ReplyCardAsync(ICard card, bool reply = false, RequestOptions? options = null)
Parameters
cardICard要发送的卡片。
replybool是否回复原消息。
optionsRequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyCardsAsync(IEnumerable<ICard>, bool, RequestOptions?)
回复卡片消息到此消息频道。
public Task<IUserMessage> ReplyCardsAsync(IEnumerable<ICard> cards, bool reply = false, RequestOptions? options = null)
Parameters
cardsIEnumerable<ICard>要发送的卡片。
replybool是否回复原消息。
optionsRequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyFileAsync(FileAttachment, bool, RequestOptions?)
回复文件到此消息频道。
public Task<IUserMessage> ReplyFileAsync(FileAttachment attachment, bool reply = false, RequestOptions? options = null)
Parameters
attachmentFileAttachment文件的附件信息。
replybool是否回复原消息。
optionsRequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyFileAsync(Stream, string, AttachmentType, Size?, bool, RequestOptions?)
回复文件到此消息频道。
public Task<IUserMessage> ReplyFileAsync(Stream stream, string filename, AttachmentType type = AttachmentType.Image, Size? imageSize = null, bool reply = false, RequestOptions? options = null)
Parameters
streamStream文件的流。
filenamestring文件名。
typeAttachmentType文件的媒体类型。
imageSizeSize?图片文件的图像尺寸。
replybool是否回复原消息。
optionsRequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyFileAsync(string, string?, AttachmentType, Size?, bool, RequestOptions?)
回复文件到此消息频道。
public Task<IUserMessage> ReplyFileAsync(string path, string? filename = null, AttachmentType type = AttachmentType.Image, Size? imageSize = null, bool reply = false, RequestOptions? options = null)
Parameters
pathstring文件的路径。
filenamestring文件名。
typeAttachmentType文件的媒体类型。
imageSizeSize?图片文件的图像尺寸。
replybool是否回复原消息。
optionsRequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyTextAsync(string, IEnumerable<FileAttachment>?, bool, RequestOptions?)
回复文本消息到此消息频道。
public Task<IUserMessage> ReplyTextAsync(string text, IEnumerable<FileAttachment>? imageFileInfos = null, bool reply = false, RequestOptions? options = null)
Parameters
textstring要发送的文本。
imageFileInfosIEnumerable<FileAttachment>图片文件的信息。
replybool是否回复原消息。
optionsRequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。