This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add missing methods to d.ts #1359
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,15 @@ import * as express from 'express'; | |
import * as http from "http" | ||
|
||
declare namespace botkit { | ||
function botframeworkbot(configuration: BotFrameworkConfiguration): BotFrameworkController; | ||
function consolebot(configuration: ConsoleConfiguration): ConsoleController; | ||
function facebookbot(configuration: FacebookConfiguration): FacebookController; | ||
function slackbot(configuration: SlackConfiguration): SlackController; | ||
function sparkbot(configuration: CiscoSparkConfiguration): CiscoSparkController; | ||
function facebookbot(configuration: FacebookConfiguration): FacebookController; | ||
function twilioipmbot(configuration: TwilioIPMConfiguration): TwilioIPMController; | ||
function twiliosmsbot(configuration: TwilioSMSConfiguration): TwilioSMSController; | ||
function botframeworkbot(configuration: BotFrameworkConfiguration): BotFrameworkController; | ||
function teamsbot(configuration: TeamsConfiguration): TeamsController; | ||
function consolebot(configuration: ConsoleConfiguration): ConsoleController; | ||
function jabberbot(configuration: JabberConfiguration): JabberController; | ||
function socketbot(configuration: WebConfiguration): WebController; | ||
function anywhere(configuration: WebConfiguration): WebController; | ||
|
||
|
@@ -20,16 +22,22 @@ declare namespace botkit { | |
no: RegExp; | ||
quit: RegExp; | ||
}; | ||
createConversation(message: M, cb: (err: Error, convo: Conversation<M>) => void): void; | ||
say(message: string | M, cb?: (err: Error, res?: any) => void): void | ||
replyWithQuestion(src: M, question: string | M, cb: ConversationCallback<M>): void | ||
reply(src: M, resp: string | M, cb?: (err: Error, res: any) => void): void; | ||
findConversation(message: M, cb: (convo?: Conversation<M>) => void): void; | ||
createConversation(message: M, cb: (err: Error, convo: Conversation<M>) => void): void; | ||
startConversation(message: M, cb: (err: Error, convo: Conversation<M>) => void): void; | ||
|
||
// abstract function | ||
send(src: M, cb?: (err: Error, res?: any) => void): void; | ||
} | ||
interface BotFrameworkBot extends Bot<BotFrameworkSpawnConfiguration, BotFrameworkMessage> { | ||
} | ||
interface BotFrameworkConfiguration extends Configuration { | ||
} | ||
interface BotFrameworkController extends Controller<BotFrameworkSpawnConfiguration, BotFrameworkMessage, BotFrameworkBot> { | ||
createWebhookEndpoints(webserver: any, bot: TwilioSMSBot, cb?: () => void): this; | ||
createWebhookEndpoints(webserver: any, bot: BotFrameworkBot, cb?: () => void): this; | ||
} | ||
interface BotFrameworkMessage extends Message { | ||
} | ||
|
@@ -217,6 +225,22 @@ declare namespace botkit { | |
name: string; | ||
emails: string[]; | ||
} | ||
interface JabberBot extends Bot<JabberSpawnConfiguration, JabberMessage> { | ||
} | ||
interface JabberConfiguration extends Configuration { | ||
} | ||
interface JabberController extends Controller<JabberSpawnConfiguration, JabberMessage, JabberBot> { | ||
} | ||
interface JabberMessage extends Message { | ||
} | ||
interface JabberSpawnConfiguration { | ||
client: { | ||
jid?: string, | ||
password?: string, | ||
host?: string, | ||
port?: number | ||
} | ||
} | ||
interface Message { | ||
action?: string; | ||
channel?: string; | ||
|
@@ -465,6 +489,91 @@ declare namespace botkit { | |
interface Team { | ||
id: string; | ||
} | ||
interface TeamsAPI { | ||
getUserById(conversationId: string, userId: string, cb: (err: Error, user_profile: any) => void); | ||
getUserByUpn(conversationId: string, upn: string, cb: (err: Error, user_profile: any) => void); | ||
getConversationMembers(conversationId: string, cb: (err: Error, members: any[]) => void); | ||
getTeamRoster(teamId: string, cb: (err: Error, members: any[]) => void); | ||
updateMessage(conversationId: string, messageId: string, replacement: TeamsMessage, cb: (err: Error, results: any) => void) | ||
getChannels(teamId: string, cb: (err: Error, channels: any[]) => void); | ||
} | ||
interface TeamsAttachment { | ||
content: TeamsAttachmentContent; | ||
contentType: string; | ||
|
||
title(v: string): this; | ||
subtitle(v: string): this; | ||
text(v: string): this; | ||
image(object: _TeamsAttachmentContentImage): this; | ||
image(url: string, alt?: string): this; | ||
button(object: _TeamsAttachmentContentButtonAction): this; | ||
button(type: string, title: string, value: string): this; | ||
tap(object: _TeamsAttachmentContentTapAction): this; | ||
tap(type: string, title: string, payload: string): this; | ||
} | ||
interface TeamsAttachmentContent { | ||
title?: string; | ||
subtitle?: string; | ||
text?: string; | ||
images?: _TeamsAttachmentContentImage[]; | ||
buttons?: _TeamsAttachmentContentButtonAction[]; | ||
tap?: _TeamsAttachmentContentTapAction; | ||
} | ||
interface _TeamsAttachmentContentButtonAction { | ||
type: string; | ||
title: string; | ||
image?: string; | ||
value: string; | ||
} | ||
interface _TeamsAttachmentContentImage { | ||
url: string; | ||
alt?: string; | ||
} | ||
interface _TeamsAttachmentContentTapAction { | ||
type: string; | ||
value: string; | ||
} | ||
interface TeamsBot extends Bot<TeamsSpawnConfiguration, TeamsMessage> { | ||
api: TeamsAPI; | ||
|
||
createHero(object: TeamsAttachmentContent): TeamsAttachment; | ||
createHero(title?: string, subtitle?: string, text?: string, images?: _TeamsAttachmentContentImage[], buttons?: _TeamsAttachmentContentButtonAction[], tap?: _TeamsAttachmentContentTapAction): TeamsAttachment; | ||
createThumbnail(object: TeamsAttachmentContent): TeamsAttachment; | ||
createThumbnail(title?: string, subtitle?: string, text?: string, images?: _TeamsAttachmentContentImage[], buttons?: _TeamsAttachmentContentButtonAction[], tap?: _TeamsAttachmentContentTapAction): TeamsAttachment; | ||
} | ||
interface TeamsConfiguration extends Configuration { | ||
clientId?: string; | ||
clientSecret?: string; | ||
} | ||
interface TeamsController extends Controller<TeamsSpawnConfiguration, TeamsMessage, TeamsBot> { | ||
createWebhookEndpoints(): this; | ||
} | ||
interface TeamsMessage extends Message { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TeamsMessage has many custom fields. |
||
// for outgoing message | ||
summary: string, | ||
attachments?: TeamsAttachment[]; | ||
attachmentLayout?: 'list' | 'grid'; | ||
// for incoming events | ||
type?: [ | ||
'direct_message' | | ||
'direct_mention' | | ||
'mention' | | ||
'bot_channel_join' | | ||
'user_channel_join' | | ||
'bot_channel_leave' | | ||
'user_channel_leave' | | ||
'channelDeleted' | | ||
'channelRenamed' | | ||
'channelCreated' | | ||
'invoke' | | ||
'composeExtension' | ||
] | ||
raw_message?: any | ||
} | ||
interface TeamsSpawnConfiguration { | ||
serviceUrl: string | ||
team?: string // GUID | ||
} | ||
interface TwilioIPMBot extends Bot<TwilioIPMSpawnConfiguration, TwilioIPMMessage> { | ||
readonly api: any; | ||
} | ||
|
@@ -499,8 +608,6 @@ declare namespace botkit { | |
} | ||
interface WebBot extends Bot<WebSpawnConfiguration, WebMessage> { | ||
connected: boolean; | ||
send(src: WebMessage, cb?: (err: Error, res: any) => void): void; | ||
findConversation(message: WebMessage, cb: (convo?: Conversation<WebMessage>) => void): void; | ||
} | ||
interface WebConfiguration extends Configuration { | ||
replyWithTyping?: boolean; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that JabberMessage has custom fields stanza and group, please add them to this interface.
https://github.com/howdyai/botkit/blob/master/lib/JabberBot.js#L192-L195
from_jid field could be useful too.