Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1818 from ellipsesynergie/ask-signature
Browse files Browse the repository at this point in the history
Fix ask/addQuestion type signatures
  • Loading branch information
benbrown authored Oct 28, 2019
2 parents 9af60d7 + 72869db commit ee95999
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/botkit/src/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
* @param handlers one or more handler functions defining possible conditional actions based on the response to the question.
* @param key name of variable to store response in.
*/
public ask(message: Partial<BotkitMessageTemplate> | string, handlers: BotkitConvoTrigger | BotkitConvoTrigger[], key: {key: string} | string | null): BotkitConversation {
public ask(message: Partial<BotkitMessageTemplate> | string, handlers: BotkitConvoHandler | BotkitConvoTrigger[], key: {key: string} | string | null): BotkitConversation {
this.addQuestion(message, handlers, key, 'default');
return this;
}
Expand All @@ -343,7 +343,7 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
* @param key Name of variable to store response in.
* @param thread_name Name of thread to which message will be added
*/
public addQuestion(message: Partial<BotkitMessageTemplate> | string, handlers: BotkitConvoTrigger | BotkitConvoTrigger[], key: {key: string} | string | null, thread_name: string): BotkitConversation {
public addQuestion(message: Partial<BotkitMessageTemplate> | string, handlers: BotkitConvoHandler | BotkitConvoTrigger[], key: {key: string} | string | null, thread_name: string): BotkitConversation {
if (!thread_name) {
thread_name = 'default';
}
Expand Down Expand Up @@ -373,6 +373,8 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
handler: handlers
}
];
} else {
throw new Error("Unsupported handlers type: " + typeof (handlers));
}

// ensure all options have a type field
Expand Down Expand Up @@ -773,7 +775,7 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
}

outgoing.channelData = outgoing.channelData ? outgoing.channelData : {};

/*******************************************************************************************************************/
// allow dynamic generation of quick replies and/or attachments
if (typeof(line.quick_replies)=='function') {
Expand Down

0 comments on commit ee95999

Please sign in to comment.