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
command
ICommandInfo相关的命令信息。
AfterExecuteAsync(ICommandInfo)
在应用程序命令执行后异步执行的方法。
public virtual Task AfterExecuteAsync(ICommandInfo command)
Parameters
command
ICommandInfo相关的命令信息。
Returns
BeforeExecute(ICommandInfo)
在执行应用程序命令之前同步执行的方法。
public virtual void BeforeExecute(ICommandInfo command)
Parameters
command
ICommandInfo相关的命令信息。
BeforeExecuteAsync(ICommandInfo)
在执行应用程序命令之前异步执行的方法。
public virtual Task BeforeExecuteAsync(ICommandInfo command)
Parameters
command
ICommandInfo相关的命令信息。
Returns
Construct(ModuleBuilder, InteractionService)
当模块创建完成后创建模块信息前执行的方法。
public virtual void Construct(ModuleBuilder builder, InteractionService commandService)
Parameters
builder
ModuleBuilder构建此方法的模块构建器。
commandService
InteractionService构建此方法的命令服务实例。
OnModuleBuilding(InteractionService, ModuleInfo)
当构建模块时执行的方法。
public virtual void OnModuleBuilding(InteractionService commandService, ModuleInfo module)
Parameters
commandService
InteractionService构建此方法的命令服务实例。
module
ModuleInfo此模块的信息。
ReplyCardAsync(ICard, bool, RequestOptions?)
回复卡片消息到此消息频道。
public Task<IUserMessage> ReplyCardAsync(ICard card, bool reply = false, RequestOptions? options = null)
Parameters
card
ICard要发送的卡片。
reply
bool是否回复原消息。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyCardsAsync(IEnumerable<ICard>, bool, RequestOptions?)
回复卡片消息到此消息频道。
public Task<IUserMessage> ReplyCardsAsync(IEnumerable<ICard> cards, bool reply = false, RequestOptions? options = null)
Parameters
cards
IEnumerable<ICard>要发送的卡片。
reply
bool是否回复原消息。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。
ReplyFileAsync(FileAttachment, bool, RequestOptions?)
回复文件到此消息频道。
public Task<IUserMessage> ReplyFileAsync(FileAttachment attachment, bool reply = false, RequestOptions? options = null)
Parameters
attachment
FileAttachment文件的附件信息。
reply
bool是否回复原消息。
options
RequestOptions发送请求时要使用的选项。
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
stream
Stream文件的流。
filename
string文件名。
type
AttachmentType文件的媒体类型。
imageSize
Size?图片文件的图像尺寸。
reply
bool是否回复原消息。
options
RequestOptions发送请求时要使用的选项。
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
path
string文件的路径。
filename
string文件名。
type
AttachmentType文件的媒体类型。
imageSize
Size?图片文件的图像尺寸。
reply
bool是否回复原消息。
options
RequestOptions发送请求时要使用的选项。
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
text
string要发送的文本。
imageFileInfos
IEnumerable<FileAttachment>图片文件的信息。
reply
bool是否回复原消息。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task<IUserMessage>
一个表示异步发送操作的任务。任务的结果包含所发送的消息。