MessageHandlerExtensions.OnMessage Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
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
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.