Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ShowPrivateDataScorable.cs 1.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  1. namespace TestBot.Scorables
  2. {
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. using Microsoft.Bot.Builder.Dialogs.Internals;
  6. using Microsoft.Bot.Connector;
  7. public abstract class ShowPrivateDataScorable : TriggerScorable
  8. {
  9. private const string CodeTemplate = "~~~~\n{0}\n~~~~";
  10. public ShowPrivateDataScorable(IBotToUser botToUser, IBotData botData) : base(botToUser, botData)
  11. {
  12. }
  13. public abstract string DataKey { get; }
  14. public abstract string NotAvailableMessage { get; }
  15. protected override async Task PostAsync(IActivity item, bool state, CancellationToken token)
  16. {
  17. var data = default(string);
  18. this.BotData.PrivateConversationData.TryGetValue(this.DataKey, out data);
  19. var reply = this.BotToUser.MakeMessage();
  20. reply.Text = string.IsNullOrWhiteSpace(data) ? this.NotAvailableMessage : string.Format(CodeTemplate, data);
  21. await this.BotToUser.PostAsync(reply);
  22. }
  23. }
  24. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...