{"id":20982271,"url":"https://github.com/immmdreza/flamingoframework","last_synced_at":"2025-12-26T21:18:17.811Z","repository":{"id":47729640,"uuid":"380984422","full_name":"immmdreza/FlamingoFramework","owner":"immmdreza","description":"Flamingo is a framework to build Telegram bots using .NET as easy as possible!","archived":false,"fork":false,"pushed_at":"2021-08-24T05:58:21.000Z","size":2209,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"Flamingo-Adult","last_synced_at":"2025-01-20T06:45:10.258Z","etag":null,"topics":["csharp","csharp-library","dotnet","telegram","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/immmdreza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-28T09:58:51.000Z","updated_at":"2024-01-17T18:07:05.000Z","dependencies_parsed_at":"2022-08-24T13:37:26.024Z","dependency_job_id":null,"html_url":"https://github.com/immmdreza/FlamingoFramework","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FFlamingoFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FFlamingoFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FFlamingoFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FFlamingoFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/immmdreza","download_url":"https://codeload.github.com/immmdreza/FlamingoFramework/tar.gz/refs/heads/Flamingo-Adult","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243384845,"owners_count":20282442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","csharp-library","dotnet","telegram","telegram-bot","telegram-bot-api"],"created_at":"2024-11-19T05:45:02.012Z","updated_at":"2025-12-26T21:18:12.757Z","avatar_url":"https://github.com/immmdreza.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Flamingo 🦩\n\nFlamingo is a framework to build Telegram bots using .NET as easy as possible!\n\n## To what purpose?\n\nAs you can see, Flamingo uses [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) and [Telegram.Bot.Extensions.Polling](https://github.com/TelegramBots/Telegram.Bot.Extensions.Polling) (Just in case) as dependencies. so by installing this package you have pure packages for telegram bots in .NET.\n\nBut this one serves as a Top layer created over **TelegramBot** library to help you setup your bot in most easiest and also pro way! The very first and important purpose of Flamingo is simplicity, save time and cleaner code when writing telegram bots with .NET\n\n**Remember that flamingo is just getting started**. it can grows with your support and help (help and support to an almost a large community)\n\nIn my turn, i tried to put all my experience here but there are a lot to go. lock into examples and you can examine the advantages of Flamingo ( at least in basic )\n\n## Install\n\n**Flamingo** is available in [Nuget](https://www.nuget.org/packages/Flamingo)\n\n_⚠ Please consider this as a beta version yet!_\n\n## How to use\n\nBelow there are some sources you can use\n\n### Features ⭐️\nRead more about some [features of Flamingo](https://github.com/immmdreza/FlamingoFramework/wiki/Features-%E2%AD%90%EF%B8%8F)\n\n### Contribute \nIf you're interested to contribute ( as i hope so ) you can take look at [Contribute](https://github.com/immmdreza/FlamingoFramework/wiki/Contribute)\n\n**Please read [WIKI](https://github.com/immmdreza/FlamingoFramework/wiki)**\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u003cb\u003eBasic usage\u003c/b\u003e \u003c/summary\u003e\n\n_After installing Flamingo through Nuget package manager, you can use it like example below:_\n\n#### 1- First of all Create an instance of `FlamingoCore` class into your program main method\n\n```cs\nstatic async Task Main()\n{\n    var flamingo = await new FlamingoCore()\n}\n```\n\n#### 2- Now is the time to initialize your bot. in order to do that you need a bot token\n(You can make a new bot and get api token for it from [@BotFather](https://t.me/BotFather))\n\n- bot token is something like: `123443536:Akhkhpoue_DLkhejbdkeaiDHJKFkjbjs_D`\n- Use method InitBot to initialize the bot like below:\n\n```cs\n// Pass your bot token to the method\nawait flamingo.InitBot(\"123443536:Akhkhpoue_DLkhejbdkeaiDHJKFkjbjs_D\")\n```\n\n_Remember, most of this library methods are `async`. meaning that you should `await` them and use them in an async function ( like `Main()` here )_\n\n\n#### 3- Let's make our first handler. handlers are what you handle and process inComing updates the way you like.\n\n- To quickly build a handler we Use `SimpleInComing\u003cT\u003e`. where T is update type like messages, callback queries, inline queries and etc.\n- To make handler for incoming messages, The `T` is `Message` ( like `SimpleInComing\u003cMessage\u003e` )\n\n#### 4- Every incoming handler has 2 important parts: **Filter** and **Callback function**\n\n- Filters job is obvious: filter incoming updates to receive exact update you want\n- Callback function: this function is where you decide how to process incoming update that passed filters.\n\n### Filters\n\nHere we use two filters:\n\n- ChatTypeFilter: to make sure the update is coming from private chat\n- CommandFilter: to handle specified bot command like `/start`\n- To Combine filters we bitwise operator `\u0026` Meaning `AND`!\n\nYour filters should be like below:\n\n```cs\nvar chatFilter = new ChatTypeFilter\u003cMessage\u003e(FlamingoChatType.Private);\n\nvar commandFilter new CommandFilter(\"start\");\n```\n\nLater we'll combine them!\n\n### Callback function\n\nCallback function should take an `ICondiment\u003cMessage\u003e` which contain everything you need to handle your updates, and should return a boolean as Task ( awaitable method )\n\nMethod structure should be like this:\n\n```cs\nprivate static async Task\u003cbool\u003e CallbackFunc(ICondiment\u003cMessage\u003e cdmt)\n{\n    await cdmt.ReplyText(\"Just started!\");\n    return true;\n}\n```\n\nWe decided to reply to use command with a text message: `\"Just started!\"`.\n\n`cdmt.ReplyText()` dose that for us. it's an extension method of `ICondiment\u003cMessage\u003e`\n\n#### 5- Now that our filters and callback function is ready, we should pass them to handler instance (3)\n\n```cs\nvar startHandler = new SimpleInComing\u003cMessage\u003e(CallbackFunc,\n    chatFilter \u0026 commandFilter);\n```\n\nAs you see we combined two filters with \u0026, meaning both of them should pass!\n\n#### 6- Now add your handler to the Flamingo\n\n```cs\nflamingo.AddInComing(startHandler);\n```\n\n#### 7- Start listening to updates\n\n```cs\nawait flamingo.Fly();\n```\n\nYour `Program.cs` file should be like below:\n\n```cs\nusing Flamingo;\nusing Flamingo.Condiments;\nusing Flamingo.Condiments.Extensions;\nusing Flamingo.Filters.MessageFilters;\nusing Flamingo.Filters.SharedFilters;\nusing Flamingo.Fishes.InComingFishes.SimpleInComings;\nusing Flamingo.Helpers.Types.Enums;\nusing System.Threading.Tasks;\nusing Telegram.Bot.Types;\n\nnamespace SimpleFlamingo\n{\n    class Program\n    {\n        static async Task Main()\n        {\n            var flamingo = new FlamingoCore();\n\n            await flamingo.InitBot(\"1820608649:AAF_rimZO_y_RlYnTX2WnifXldL1GiIcxt4\");\n\n            var chatFilter = new ChatTypeFilter\u003cMessage\u003e(FlamingoChatType.Private);\n\n            var commandFilter = new CommandFilter(\"start\");\n\n            var startHandler = new SimpleInComing\u003cMessage\u003e(CallbackFunc,\n                chatFilter \u0026 commandFilter);\n\n            flamingo.AddInComing(startHandler);\n\n            await flamingo.Fly();\n        }\n\n        private static async Task\u003cbool\u003e CallbackFunc(ICondiment\u003cMessage\u003e cdmt)\n        {\n            await cdmt.ReplyText(\"Just started!\");\n            return true;\n        }\n    }\n}\n```\n\n#### 8- Send command `/start` to your bot and see what happens\n\n#### You can write all of these using Attributes even more quicker\n\n- [See SimpleFlamingo](https://github.com/immmdreza/FlamingoFramework/blob/master/Examples/SimpleFlamingo/Program.cs)\n\n\u003c/details\u003e\n\n## Await-able InComing Handlers\n\nWait for user respond!\n[Read Wiki](https://github.com/immmdreza/FlamingoFramework/wiki/Await-able-InComing-handlers)\n\n## More to go\n\nThere are some example projects that may help you for now.\n\nFull explanation example with a lot of comments:\n[FlamingoProduction](https://github.com/immmdreza/FlamingoFramework/tree/master/FlamingoProduction)\n\n## Examples\n\n### Simple Flamingo\n\nAn example of how to create a simple Flamingo app + simple Attribute handlers usage:\n\n- [SimpleFlamingo](https://github.com/immmdreza/FlamingoFramework/tree/master/Examples/SimpleFlamingo)\n\n### FillForm Flamingo\n\nSee how to use await-able incoming handlers to wait for user answers and fill a sign up form\n\n- [FillFormFlamingo](https://github.com/immmdreza/FlamingoFramework/tree/master/Examples/FillFormFlamingo)\n\n**Extremely advise you to take a look at `FillFormHelper` example**\n\n_It has a lot of simplifiers that helps you ask form and validate them!_\n\n- [FillFormHelper Example](https://github.com/immmdreza/FlamingoFramework/blob/master/FlamingoProduction/InComings/Messages/MyAdvMessageInComing.cs)\n\n### DeepInside Flamingo\n\nIn this example we show you how to go deep inside flamingo and create your own handlers and condiments. so you can use any custom properties in your handlers and even control lifecycle of db objects and etc.\n\n- [DeepInsideFlamingo](https://github.com/immmdreza/FlamingoFramework/tree/master/Examples/DeepInsideFlamingo)\n\n### Fun Flamingo\n\nA fun example that only flamingo allows you to build!\n\n- [FunFlamingo](https://github.com/immmdreza/FlamingoFramework/tree/master/Examples/FunFlamingo)\n\n### DeepLinking Flamingo\n\nLearn how to setup deep linking in your bot\n\n- [DeepLinkingFlamingo](https://github.com/immmdreza/FlamingoFramework/tree/master/Examples/DeepLinkingFlamingo)\n\n### Keyboards Flamingo\n\nExample to work with keyboards\n\n- [KeyboardsFlamingo](https://github.com/immmdreza/FlamingoFramework/tree/master/Examples/KeyboardsFlamingo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmmdreza%2Fflamingoframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimmmdreza%2Fflamingoframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmmdreza%2Fflamingoframework/lists"}