Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/SampleApp/Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ static async IAsyncEnumerable<Response> ProcessMessagesAsync(
else if (message is InteractiveMessage interactive)
{
logger.LogWarning("👤 chose {Button} ({Title})", interactive.Button.Id, interactive.Button.Title);
yield return interactive.Text($"👤 chose: {interactive.Button.Title} ({interactive.Button.Id})");
yield return interactive.Reply($"👤 chose: {interactive.Button.Title} ({interactive.Button.Id})");
}
else if (message is ReactionMessage reaction)
{
logger.LogInformation("👤 reaction: {Reaction}", reaction.Emoji);
yield return reaction.Text($"👤 reaction: {reaction.Emoji}");
yield return reaction.Reply($"👤 reaction: {reaction.Emoji}");
}
else if (message is StatusMessage status)
{
Expand All @@ -95,7 +95,7 @@ static async IAsyncEnumerable<Response> ProcessMessagesAsync(

// simulate some hard work at hand, like doing some LLM-stuff :)
//await Task.Delay(2000);
yield return content.Text(
yield return content.Reply(
$"☑️ Got your {content.Content.Type}:\r\n{JsonSerializer.Serialize(content, options)}",
new Button("btn_good", "👍"),
new Button("btn_bad", "👎"));
Expand Down
4 changes: 2 additions & 2 deletions src/WhatsApp/MessageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public static TemplateResponse Reengage(this ErrorMessage message)
/// <summary>
/// Creates a text response for the message.
/// </summary>
public static TextResponse Text(this Message message, string text)
public static TextResponse Reply(this Message message, string text)
=> new(message.From.Number, message.To.Id, message.Id, message.ConversationId, text);

/// <summary>
/// Creates a text response with buttons for the message.
/// </summary>
public static TextResponse Text(this Message message, string text, Button button1, Button? button2 = default)
public static TextResponse Reply(this Message message, string text, Button button1, Button? button2 = default)
=> new(message.From.Number, message.To.Id, message.Id, message.ConversationId, text, button1, button2);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/WhatsApp/TextResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// interaction. If no buttons are provided, the response will consist of only the text message.</remarks>
/// <param name="Number">The phone number of the recipient in international format.</param>
/// <param name="Service">The identifier of the service handling the message.</param>
/// <param name="Context">The unique identifier of the message to which the reaction is being sent.</param>
/// <param name="Context">The unique identifier of the message to which this response is a reply to .</param>
/// <param name="Text">The text content of the response message.</param>
/// <param name="Button1">An optional button to include in the response for user interaction.</param>
/// <param name="Button2">An optional second button to include in the response for user interaction.</param>
Expand Down