@@ -416,6 +416,9 @@ export interface ISessionArgs {
416416
417417 /** Optional localizer to use when localizing the bots responses. */
418418 localizer ?: ILocalizer ;
419+
420+ /** Optional minimum delay between messages sent to the user from the bot. */
421+ minSendDelay ?: number ;
419422}
420423
421424/** Signature of error events fired from a session. */
@@ -484,6 +487,9 @@ export interface IBotConnectorOptions {
484487
485488 /** Optional localizer used to localize the bots responses to the user. */
486489 localizer ?: ILocalizer ;
490+
491+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1000. */
492+ minSendDelay ?: number ;
487493
488494 /** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
489495 defaultDialogId ?: string ;
@@ -514,6 +520,9 @@ export interface ISkypeBotOptions {
514520
515521 /** Optional localizer used to localize the bots responses to the user. */
516522 localizer ?: ILocalizer ;
523+
524+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1000. */
525+ minSendDelay ?: number ;
517526
518527 /** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
519528 defaultDialogId ?: string ;
@@ -544,6 +553,9 @@ export interface ISlackBotOptions {
544553
545554 /** Optional localizer used to localize the bots responses to the user. */
546555 localizer ?: ILocalizer ;
556+
557+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1500. */
558+ minSendDelay ?: number ;
547559
548560 /** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
549561 defaultDialogId ?: string ;
@@ -553,6 +565,9 @@ export interface ISlackBotOptions {
553565
554566 /** Maximum time (in milliseconds) that a bot continues to recieve ambient messages after its been @mentioned. Default 5 minutes. */
555567 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 ;
556571}
557572
558573/** 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 {
583598
584599 /** Optional localizer used to localize the bots responses to the user. */
585600 localizer ?: ILocalizer ;
601+
602+ /** Optional minimum delay between messages sent to the user from the bot. Default value is 1000. */
603+ minSendDelay ?: number ;
586604
587605 /** Dialog to launch when a user initiates a new conversation with a bot. Default value is '/'. */
588606 defaultDialogId ?: string ;
@@ -852,6 +870,47 @@ export class Session {
852870 public createMessage ( text : string , args ?: any [ ] ) : IMessage ;
853871}
854872
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+
855914/**
856915 * Base class for all dialogs. Dialogs are the core component of the BotBuilder
857916 * framework. Bots use Dialogs to manage arbitrarily complex conversations with
@@ -988,6 +1047,31 @@ export class DialogAction {
9881047 * @param steps Steps of a waterfall.
9891048 */
9901049 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 ;
9911075}
9921076
9931077/**
@@ -1635,6 +1719,7 @@ export class SlackBot extends DialogCollection {
16351719 * - reply: A reply to an existing message was sent. [IBotMessageEvent]
16361720 * - send: A new message was sent to start a new conversation. [IBotMessageEvent]
16371721 * - 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]
16381723 * - message_received: The bot received a message. [IBotMessageEvent]
16391724 * - bot_channel_join: The bot has joined a channel. [IBotMessageEvent]
16401725 * - user_channel_join: A user has joined a channel. [IBotMessageEvent]
@@ -1692,6 +1777,11 @@ export class SlackSession extends Session {
16921777 /** Data that's persisted on a per channel basis. */
16931778 channelData : any ;
16941779
1780+ /**
1781+ * Causes the bot to send a 'typing' message indicating its busy.
1782+ */
1783+ isTyping ( ) : void ;
1784+
16951785 /**
16961786 * Escapes &, <, and > characters in a text string. These characters are reserved in Slack for
16971787 * control codes so should always be escaped when returning user generated text.
0 commit comments