Class CommandContextExtensions
Extensions for ICommandContext.
Namespace: TehGM.Wolfringo.Commands
Assembly: Wolfringo.Commands.dll
Syntax
public static class CommandContextExtensions
Methods
| Improve this Doc View SourceGetBotProfileAsync(ICommandContext, CancellationToken)
Gets profile of the bot user.
Declaration
public static Task<WolfUser> GetBotProfileAsync(this ICommandContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context. |
CancellationToken | cancellationToken | Token to cancel server request with. |
Returns
Type | Description |
---|---|
Task<WolfUser> | Profile of the bot user. |
See Also
GetRecipientAsync<T>(ICommandContext, CancellationToken)
Gets profile of the recipient of the message.
Declaration
public static async Task<T> GetRecipientAsync<T>(this ICommandContext context, CancellationToken cancellationToken = default(CancellationToken))
where T : class, IWolfEntity
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context. |
CancellationToken | cancellationToken | Token to cancel server request with. |
Returns
Type | Description |
---|---|
Task<T> | Profile of the message's recipient; if |
Type Parameters
Name | Description |
---|---|
T |
See Also
GetSenderAsync(ICommandContext, CancellationToken)
Gets profile of the user that sent the command.
Declaration
public static Task<WolfUser> GetSenderAsync(this ICommandContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context to get message sender of. |
CancellationToken | cancellationToken | Token to cancel server request with. |
Returns
Type | Description |
---|---|
Task<WolfUser> | Profile of the user that sent the command |
See Also
ReplyImageAsync(ICommandContext, IEnumerable<Byte>, CancellationToken)
Sends an image response message to group or user.
Declaration
public static Task<ChatResponse> ReplyImageAsync(this ICommandContext context, IEnumerable<byte> imageBytes, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context. |
IEnumerable<Byte> | imageBytes | Bytes of the image to send. |
CancellationToken | cancellationToken | Token to cancel server request with. |
Returns
Type | Description |
---|---|
Task<ChatResponse> | Message sending response. |
ReplyTextAsync(ICommandContext, String, CancellationToken)
Sends a text message response message to group or user.
Declaration
public static Task<ChatResponse> ReplyTextAsync(this ICommandContext context, string text, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context. |
String | text | Content of the message. |
CancellationToken | cancellationToken | Token to cancel server request with. |
Returns
Type | Description |
---|---|
Task<ChatResponse> | Message sending response. |
ReplyVoiceAsync(ICommandContext, IEnumerable<Byte>, CancellationToken)
Sends a voice response message to group or user.
Declaration
public static Task<ChatResponse> ReplyVoiceAsync(this ICommandContext context, IEnumerable<byte> voiceBytes, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context. |
IEnumerable<Byte> | voiceBytes | Bytes of the voice to send. |
CancellationToken | cancellationToken | Token to cancel server request with. |
Returns
Type | Description |
---|---|
Task<ChatResponse> | Message sending response. |