Language

MessageHandlerExtensions.OnMessage Method

Definition

Overloads

Name Description
OnMessage(TeamsBotApplication, MessageHandler)

Registers a handler for message activities.

OnMessage(TeamsBotApplication, String, MessageHandler)

Registers a handler for message activities matching the specified pattern.

OnMessage(TeamsBotApplication, Regex, MessageHandler)

Registers a handler for message activities matching the specified regex.

OnMessage(TeamsBotApplication, MessageHandler)

Registers a handler for message activities.

public static Microsoft.Teams.Apps.TeamsBotApplication OnMessage(this Microsoft.Teams.Apps.TeamsBotApplication app, Microsoft.Teams.Apps.MessageHandler handler);
static member OnMessage : Microsoft.Teams.Apps.TeamsBotApplication * Microsoft.Teams.Apps.MessageHandler -> Microsoft.Teams.Apps.TeamsBotApplication
<Extension()>
Public Function OnMessage (app As TeamsBotApplication, handler As MessageHandler) As TeamsBotApplication

Parameters

app
TeamsBotApplication

The Teams bot application.

handler
MessageHandler

The handler to register.

Returns

The updated Teams bot application.

Remarks

Breaking change: previously only the first matching handler was invoked. All matching handlers are now invoked sequentially.

Applies to

OnMessage(TeamsBotApplication, String, MessageHandler)

Registers a handler for message activities matching the specified pattern.

public static Microsoft.Teams.Apps.TeamsBotApplication OnMessage(this Microsoft.Teams.Apps.TeamsBotApplication app, string pattern, Microsoft.Teams.Apps.MessageHandler handler);
static member OnMessage : Microsoft.Teams.Apps.TeamsBotApplication * string * Microsoft.Teams.Apps.MessageHandler -> Microsoft.Teams.Apps.TeamsBotApplication
<Extension()>
Public Function OnMessage (app As TeamsBotApplication, pattern As String, handler As MessageHandler) As TeamsBotApplication

Parameters

app
TeamsBotApplication

The Teams bot application.

pattern
String

The regex pattern to match against the message text.

handler
MessageHandler

The handler to register.

Returns

The updated Teams bot application.

Remarks

Breaking change: previously only the first matching handler was invoked. All matching handlers are now invoked sequentially.

Applies to

OnMessage(TeamsBotApplication, Regex, MessageHandler)

Registers a handler for message activities matching the specified regex.

public static Microsoft.Teams.Apps.TeamsBotApplication OnMessage(this Microsoft.Teams.Apps.TeamsBotApplication app, System.Text.RegularExpressions.Regex regex, Microsoft.Teams.Apps.MessageHandler handler);
static member OnMessage : Microsoft.Teams.Apps.TeamsBotApplication * System.Text.RegularExpressions.Regex * Microsoft.Teams.Apps.MessageHandler -> Microsoft.Teams.Apps.TeamsBotApplication
<Extension()>
Public Function OnMessage (app As TeamsBotApplication, regex As Regex, handler As MessageHandler) As TeamsBotApplication

Parameters

app
TeamsBotApplication

The Teams bot application.

regex
Regex

The regex to match against the message text.

handler
MessageHandler

The handler to register.

Returns

The updated Teams bot application.

Remarks

Breaking change: previously only the first matching handler was invoked. All matching handlers are now invoked sequentially.

Applies to