@@ -416,6 +416,9 @@ export interface ISessionArgs {
416
416
417
417
/** Optional localizer to use when localizing the bots responses. */
418
418
localizer ?: ILocalizer ;
419
+
420
+ /** Optional minimum delay between messages sent to the user from the bot. */
421
+ minSendDelay ?: number ;
419
422
}
420
423
421
424
/** Signature of error events fired from a session. */
@@ -484,6 +487,9 @@ export interface IBotConnectorOptions {
484
487
485
488
/** Optional localizer used to localize the bots responses to the user. */
486
489
localizer ?: ILocalizer ;
490
+
491
+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1000. */
492
+ minSendDelay ?: number ;
487
493
488
494
/** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
489
495
defaultDialogId ?: string ;
@@ -514,6 +520,9 @@ export interface ISkypeBotOptions {
514
520
515
521
/** Optional localizer used to localize the bots responses to the user. */
516
522
localizer ?: ILocalizer ;
523
+
524
+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1000. */
525
+ minSendDelay ?: number ;
517
526
518
527
/** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
519
528
defaultDialogId ?: string ;
@@ -544,6 +553,9 @@ export interface ISlackBotOptions {
544
553
545
554
/** Optional localizer used to localize the bots responses to the user. */
546
555
localizer ?: ILocalizer ;
556
+
557
+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1500. */
558
+ minSendDelay ?: number ;
547
559
548
560
/** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
549
561
defaultDialogId ?: string ;
@@ -553,6 +565,9 @@ export interface ISlackBotOptions {
553
565
554
566
/** Maximum time (in milliseconds) that a bot continues to recieve ambient messages after its been @mentioned. Default 5 minutes. */
555
567
ambientMentionDuration ?: number ;
568
+
569
+ /** Optional flag that if true will cause a 'typing' message to be sent when the bot recieves a message. */
570
+ sendIsType ?: boolean ;
556
571
}
557
572
558
573
/** Address info passed to SlackBot.beginDialog() calls. Specifies the address of the user or channel to start a conversation with. */
@@ -583,6 +598,9 @@ export interface ITextBotOptions {
583
598
584
599
/** Optional localizer used to localize the bots responses to the user. */
585
600
localizer ?: ILocalizer ;
601
+
602
+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1000. */
603
+ minSendDelay ?: number ;
586
604
587
605
/** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
588
606
defaultDialogId ?: string ;
@@ -852,6 +870,47 @@ export class Session {
852
870
public createMessage ( text : string , args ?: any [ ] ) : IMessage ;
853
871
}
854
872
873
+ /**
874
+ * Message builder class that simplifies building reply messages with attachments.
875
+ */
876
+ export class Message implements IMessage {
877
+ /**
878
+ * Sets the messages language.
879
+ * @param language The language of the message.
880
+ */
881
+ setLanguage ( language : string ) : Message ;
882
+
883
+ /**
884
+ * Sets the localized text of the message.
885
+ * @param session Session object used to localize the message text.
886
+ * @param text Text or template string for the reply. This will be localized using session.gettext().
887
+ * @param args Optional arguments used to format the message text when Text is a template.
888
+ */
889
+ setText ( session : Session , text : string , ...args : any [ ] ) : Message ;
890
+
891
+ /**
892
+ * Loads the plural form of a localized string for the messages language. The output string will be formatted to
893
+ * include the count by replacing %d in the string with the count.
894
+ * @param session Session object used to localize the message text.
895
+ * @param msg Singular form of the string to use as a key in the localized string table. Use %d to specify where the count should go.
896
+ * @param msg_plural Plural form of the string to use as a key in the localized string table. Use %d to specify where the count should go.
897
+ * @param count Count to use when determining whether the singular or plural form of the string should be used.
898
+ */
899
+ setNText ( session : Session , msg : string , msg_plural : string , count : number ) : Message ;
900
+
901
+ /**
902
+ * Adds an attachment to the message.
903
+ * @param attachment The attachment to add.
904
+ */
905
+ addAttachment ( attachment : IAttachment ) : Message ;
906
+
907
+ /**
908
+ * Sets the channelData for the message.
909
+ * @param data The channel data to assign.
910
+ */
911
+ setChannelData ( data : any ) : Message ;
912
+ }
913
+
855
914
/**
856
915
* Base class for all dialogs. Dialogs are the core component of the BotBuilder
857
916
* framework. Bots use Dialogs to manage arbitrarily complex conversations with
@@ -988,6 +1047,31 @@ export class DialogAction {
988
1047
* @param steps Steps of a waterfall.
989
1048
*/
990
1049
static waterfall ( steps : IDialogWaterfallStep [ ] ) : ( session : Session , args : any ) => void ;
1050
+
1051
+ /**
1052
+ * Returns a closer that wraps a built-in prompt with validation logic. The closure should be used
1053
+ * to define a new dialog for the prompt using bot.add('/myPrompt', builder.DialogAction.)
1054
+ * @example
1055
+ * <pre><code>
1056
+ * var bot = new builder.BotConnectorBot();
1057
+ * bot.add('/', [
1058
+ * function (session) {
1059
+ * session.beginDialog('/meaningOfLife', { prompt: "What's the meaning of life?" });
1060
+ * },
1061
+ * function (session, results) {
1062
+ * if (results.response) {
1063
+ * session.send("That's correct! The meaning of life is 42.");
1064
+ * } else {
1065
+ * session.send("Sorry you couldn't figure it out. Everyone knows that the meaning of life is 42.");
1066
+ * }
1067
+ * }
1068
+ * ]);
1069
+ * bot.add('/meaningOfLife'. builder.DialogAction.validatedPrompt(builder.PromptType.text, function (response) {
1070
+ * return response === '42';
1071
+ * }));
1072
+ * </code></pre>
1073
+ */
1074
+ static validatedPrompt ( promptType : PromptType , validator : ( response : any ) => boolean ) : ( session : Session , args : any ) => void ;
991
1075
}
992
1076
993
1077
/**
@@ -1635,6 +1719,7 @@ export class SlackBot extends DialogCollection {
1635
1719
* - reply: A reply to an existing message was sent. [IBotMessageEvent]
1636
1720
* - send: A new message was sent to start a new conversation. [IBotMessageEvent]
1637
1721
* - quit: The bot has elected to ended the current conversation. [IBotMessageEvent]
1722
+ * - typing: The bot is sending a 'typing' message to indicate its busy. [IBotMessageEvent]
1638
1723
* - message_received: The bot received a message. [IBotMessageEvent]
1639
1724
* - bot_channel_join: The bot has joined a channel. [IBotMessageEvent]
1640
1725
* - user_channel_join: A user has joined a channel. [IBotMessageEvent]
@@ -1692,6 +1777,11 @@ export class SlackSession extends Session {
1692
1777
/** Data that's persisted on a per channel basis. */
1693
1778
channelData : any ;
1694
1779
1780
+ /**
1781
+ * Causes the bot to send a 'typing' message indicating its busy.
1782
+ */
1783
+ isTyping ( ) : void ;
1784
+
1695
1785
/**
1696
1786
* Escapes &, <, and > characters in a text string. These characters are reserved in Slack for
1697
1787
* control codes so should always be escaped when returning user generated text.
0 commit comments