https://github.com/deploy-f/botf
🦾Make beautiful and clear telegram bots with the asp.net-like architecture!
https://github.com/deploy-f/botf
bot-framework telegram telegram-bot telegram-bot-api
Last synced: 5 months ago
JSON representation
🦾Make beautiful and clear telegram bots with the asp.net-like architecture!
- Host: GitHub
- URL: https://github.com/deploy-f/botf
- Owner: deploy-f
- License: mit
- Created: 2021-11-01T20:04:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-15T20:50:40.000Z (almost 2 years ago)
- Last Synced: 2025-10-28T05:23:32.441Z (8 months ago)
- Topics: bot-framework, telegram, telegram-bot, telegram-bot-api
- Language: C#
- Homepage: https://t.me/botf_community
- Size: 218 KB
- Stars: 51
- Watchers: 3
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# BotF
[](https://www.nuget.org/packages/Deployf.Botf) [](https://github.com/deploy-f/botf/blob/master/LICENSE) [](https://github.com/deploy-f/botf/actions/workflows/dotnet.yml) [](https://t.me/botf_community)
Make beautiful and clear telegram bots with the asp.net-like architecture!
BotF has next features:
🤘 long pooling and webhook mode without any changes in the code
😎 very convinient way to work with commands and reply buttons
👆 integrated pagination with buttons
🆔 authentication and role-based authorization
🔥 statemachine for complicated dialogs with users
🕸️ asp.net-like approach to develop bots
⚒️ automatic creating of command menu
🗓️ integrated DateTime picker
📤 auto sending
📲 webapp native support
🚤 good performance
## Documentaion
🔜 Documentation is under developement. We will push it here in the readme file soon. Feel free to ask us your questions in community chat in telegram [](https://t.me/botf_community)
▶️ There is a good video on youtube https://www.youtube.com/watch?v=hieLnm9wO6s
## Install
```bash
dotnet add package Deployf.Botf
```
## Example
Put next code into `Program.cs` file
```csharp
using Deployf.Botf;
class Program : BotfProgram
{
// It's boilerplate program entrypoint.
// We just simplified all usual code into static method StartBot.
// But in this case of starting of the bot, you should add a config section under "bot" key to appsettings.json
public static void Main(string[] args) => StartBot(args);
// Action attribute mean that you mark async method `Start`
// as handler for user's text in message which equal to '/start' string.
// You can name method as you want
// And also, second argument of Action's attribute is a description for telegram's menu for this action
[Action("/start", "start the bot")]
public void Start()
{
// Just sending a reply message to user. Very simple, isn't?
Push($"Send `{nameof(Hello)}` to me, please!");
}
[Action(nameof(Hello))]
public void Hello()
{
Push("Hey! Thank you! That's it.");
}
// Here we handle all unknown command or just text sent from user
[On(Handle.Unknown)]
public async Task Unknown()
{
// Here, we use the so-called "buffering of sending message"
// It means you dont need to construct all message in the string and send it once
// You can use Push to just add the text to result message, or PushL - the same but with new line after the string.
PushL("You know.. it's very hard to recognize your command!");
PushL("Please, write a correct text. Or use /start command");
// And finally send buffered message
await Send();
}
}
```
And replace content of `appsettings.json` with your bot username and token:
```
{
"botf": "123456778990:YourToken"
}
```
And that's it! Veeery easy, isn't?
Just run the program :)
Other examples you can find in `/Examples` folder.
## Hosting
After you develop your bot, you can deploy it to our hosting: [deploy-f.com](https://deploy-f.com)