Compartilhar via


NotificationBot class

Warning

This API is now deprecated.

Use BotBuilderCloudAdapter.NotificationBot instead.

Constructors

NotificationBot(BotFrameworkAdapter, NotificationOptions_2)

constructor of the notification bot.

Methods

findAllChannels((channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>)

Returns all Channel where predicate is true, and empty array otherwise. (Ensure the bot app is installed into the General channel, otherwise empty array will be returned.)

findAllMembers((member: Member) => Promise<boolean>, SearchScope)

Returns all Member where predicate is true, and empty array otherwise.

findChannel((channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>)

Returns the first Channel where predicate is true, and undefined otherwise. (Ensure the bot app is installed into the General channel, otherwise undefined will be returned.)

findMember((member: Member) => Promise<boolean>, SearchScope)

Returns the first Member where predicate is true, and undefined otherwise.

installations()

Get all targets where the bot is installed.

Constructor Details

NotificationBot(BotFrameworkAdapter, NotificationOptions_2)

constructor of the notification bot.

new NotificationBot(adapter: BotFrameworkAdapter, options?: NotificationOptions_2)

Parameters

adapter

BotFrameworkAdapter

the bound BotFrameworkAdapter

options
NotificationOptions

initialize options

Remarks

To ensure accuracy, it's recommended to initialize before handling any message.

Method Details

findAllChannels((channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>)

Returns all Channel where predicate is true, and empty array otherwise. (Ensure the bot app is installed into the General channel, otherwise empty array will be returned.)

function findAllChannels(predicate: (channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>): Promise<Channel[]>

Parameters

predicate

(channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>

find calls predicate for each channel of the installation.

Returns

Promise<Channel[]>

an array of Channel where predicate is true, and empty array otherwise.

findAllMembers((member: Member) => Promise<boolean>, SearchScope)

Returns all Member where predicate is true, and empty array otherwise.

function findAllMembers(predicate: (member: Member) => Promise<boolean>, scope?: SearchScope): Promise<Member[]>

Parameters

predicate

(member: Member) => Promise<boolean>

find calls predicate for each member of the installation.

scope
SearchScope

the scope to find members from the installations (personal chat, group chat, Teams channel).

Returns

Promise<Member[]>

an array of Member where predicate is true, and empty array otherwise.

findChannel((channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>)

Returns the first Channel where predicate is true, and undefined otherwise. (Ensure the bot app is installed into the General channel, otherwise undefined will be returned.)

function findChannel(predicate: (channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>): Promise<undefined | Channel>

Parameters

predicate

(channel: Channel, teamDetails: undefined | TeamDetails) => Promise<boolean>

find calls predicate once for each channel of the installation, until it finds one where predicate returns true. If such a channel is found, find immediately returns that channel. Otherwise, find returns undefined.

Returns

Promise<undefined | Channel>

the first Channel where predicate is true, and undefined otherwise.

findMember((member: Member) => Promise<boolean>, SearchScope)

Returns the first Member where predicate is true, and undefined otherwise.

function findMember(predicate: (member: Member) => Promise<boolean>, scope?: SearchScope): Promise<undefined | Member>

Parameters

predicate

(member: Member) => Promise<boolean>

find calls predicate once for each member of the installation, until it finds one where predicate returns true. If such a member is found, find immediately returns that member. Otherwise, find returns undefined.

scope
SearchScope

the scope to find members from the installations (personal chat, group chat, Teams channel).

Returns

Promise<undefined | Member>

the first Member where predicate is true, and undefined otherwise.

installations()

Get all targets where the bot is installed.

function installations(): Promise<TeamsBotInstallation[]>

Returns

Remarks

The result is retrieving from the persisted storage.