BotSharp/tests/BotSharp.Plugin.PizzaBot/Functions/GetPizzaPricesFn.cs

22 lines
547 B
C#
Raw Normal View History

2025-03-28 01:46:01 +00:00
using BotSharp.Abstraction.Conversations.Models;
using System.Text.Json;
2023-08-30 22:40:45 +00:00
2025-03-28 01:46:01 +00:00
namespace BotSharp.Plugin.PizzaBot.Functions;
2023-08-30 22:40:45 +00:00
2025-03-28 01:46:01 +00:00
public class GetPizzaPricesFn : IFunctionCallback
{
public string Name => "get_pizza_price";
2023-08-30 22:40:45 +00:00
2025-03-28 01:46:01 +00:00
public async Task<bool> Execute(RoleDialogModel message)
{
message.Data = new
{
pepperoni_unit_price = 3.2,
cheese_unit_price = 3.5,
margherita_unit_price = 3.8,
};
message.Content = JsonSerializer.Serialize(message.Data);
return true;
}
}