Skip to content

Commit 232c353

Browse files
committed
Add QueryController for handling specific text queries
Introduced a new `QueryController` class in the `TelegramBot.ConsoleTest.Controllers` namespace. This class inherits from `BotControllerBase` and includes two methods, `HandleHelloAsync` and `HandleByeAsync`, which handle text queries matching "hello" and "bye" patterns, respectively. The class uses attributes from the `TelegramBot` namespace to define these text query patterns and provides appropriate responses.
1 parent 4ad80dc commit 232c353

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using TelegramBot.Attributes;
2+
using TelegramBot.Controllers;
3+
using TelegramBot.Abstractions;
4+
5+
namespace TelegramBot.ConsoleTest.Controllers
6+
{
7+
internal class QueryController : BotControllerBase
8+
{
9+
[TextQuery(pattern: ".+hello.+")]
10+
public IActionResult HandleHelloAsync()
11+
{
12+
return Text("Hello!");
13+
}
14+
15+
[TextQuery(pattern: "bye")]
16+
public IActionResult HandleByeAsync()
17+
{
18+
return Text("Goodbye!");
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)