{"id":20982262,"url":"https://github.com/immmdreza/moderntelegrambot","last_synced_at":"2026-05-19T09:04:51.828Z","repository":{"id":55076207,"uuid":"327111448","full_name":"immmdreza/ModernTelegramBot","owner":"immmdreza","description":"An updated Telegram.Bot package","archived":false,"fork":false,"pushed_at":"2021-01-13T10:08:05.000Z","size":207,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T01:37:55.444Z","etag":null,"topics":["bot","csharp","dotnet","telegram","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":"mit","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-01-05T20:27:42.000Z","updated_at":"2021-01-13T10:08:08.000Z","dependencies_parsed_at":"2022-08-14T11:20:21.185Z","dependency_job_id":null,"html_url":"https://github.com/immmdreza/ModernTelegramBot","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/immmdreza/ModernTelegramBot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FModernTelegramBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FModernTelegramBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FModernTelegramBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FModernTelegramBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/immmdreza","download_url":"https://codeload.github.com/immmdreza/ModernTelegramBot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2FModernTelegramBot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33209437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T07:54:09.561Z","status":"ssl_error","status_checked_at":"2026-05-19T07:54:08.508Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bot","csharp","dotnet","telegram","telegram-bot-api"],"created_at":"2024-11-19T05:45:01.740Z","updated_at":"2026-05-19T09:04:51.811Z","avatar_url":"https://github.com/immmdreza.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModernTelegramBot \n\n![.NET](https://github.com/immmdreza/ModernTelegramBot/workflows/.NET/badge.svg)\n\nAn updated Telegram.Bot package\nFirst of all: the base of these codes is a Copy of [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot)\n\nthe package is for c# and **.Net Core 3.1 and higher **\n\n## Installation \n\nUse Nuget : https://www.nuget.org/packages/ModernTelegramBot/\n\n## Usage\nRead more in [Wiki](https://github.com/immmdreza/ModernTelegramBot/wiki)\n\nThis package keeps everything that is in [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) project, so for basic stuff take a look at it.\n\n### Extra features \nHere is a list of currently add features :\n  - Handlers\n    - MessageHandler\n    - CallBackQueryHandler\n    - InlineQueryHandler (not quite)\n  - Filters\n    - RegexFilter\n    - CommandFilter\n    - Group \u0026 Private Filter\n    - ReplyFilter\n    - ...\n  - Bound Methods (_This methods use a shared static instance of client! So they are not safe to use in multi client apps._)\n    - For Message: `ReplyText`\n    - For CallBackQuery: `Answer`, `EditMessage`, `ChangeKeys`\n    \n## Getting Startted Example\n\n```cs\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing Telegram.Bot;\nusing Telegram.Bot.Types;\nusing Telegram.Bot.Types.Enums;\nusing Telegram.Filters;\nusing Telegram.Handlers;\n\nnamespace TestMTB\n{\n    class Program\n    {\n        static async Task Main(string[] args)\n        {\n            // Create a instance of TelegramBotClient and pass the token you got from @BotFather\n            var TelegramBotClient = new TelegramBotClient(\"YOUR_API_TOKEN\");\n\n\n            // Makin' a MessageHandler\n            // First parameter shoud be a callback function like helloFunc here\n            // Second parameter is a Filter class to filter incomming updates for this handler\n            // Here we filter the results using regex to caputre only messages starting with Hello.\n            var myHandler = new MessageHandler(\n                helloFunc, \n                Filter.Regex(new Regex(@\"^hello\", RegexOptions.IgnoreCase))\n            );\n\n\n            // Making another handler for command /start in private chat only.\n            // See how you can combine Filters using +\n            // And ~ will reverse the Filter so here we don't handle any messages from '1234577'\n            var myOtherHandler = new MessageHandler(\n                startFunc,\n                Filter.Command(\"start\") + Filter.Private + ~new FromUsersFilter(1234577)\n            );\n\n\n            // Pass handlers we just made to the BotClinet.\n            TelegramBotClient.AddHandler(myHandler);\n            TelegramBotClient.AddHandler(myOtherHandler);\n\n\n            // Use Dispatcher to start receiving updates and handle them\n            // Note that this method blocks the code here!\n            await TelegramBotClient.Dispatcher(new UpdateType[] { UpdateType.Message });\n        }\n\n\n        // Callback function for myOtherHandler\n        private static async Task startFunc(TelegramBotClient client, Message message, Dictionary\u003cstring, dynamic\u003e data)\n        {\n            // data parameter is a dynamic Dictionary that containes data depending on your filters\n            var args = (string[])data[\"args\"]; // When you use CommandFilter you have args in data Dictionary\n\n            // see ReplyText is a extension method to the Message obj.\n            _ = await message.ReplyText(\"Just Started!\");\n        }\n\n\n        // Callback function for myHandler\n        private static async Task helloFunc(TelegramBotClient client, Message message, Dictionary\u003cstring, dynamic\u003e data)\n        {\n            _ = await message.ReplyText(\"Hi there!\");\n        }\n    }\n}\n```\n\n## Using Attributes\n*And yes*, you can setup your handlers easy and fast using attributes.\n\nYou can add EVERY `public` and `static` `method` in your entry assembly as callback for your handler.\n\n### Here is an example\n\nYou should always add a handler attribute then add your filters\n\nEvery Filter attribute has a Reverse property that do the same as ~, and reverses the filter\n\nAnd just that easy you can handle __/start__ Command which is not replied and sent in private chat\n\n```cs\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing Telegram.Attributes;\nusing Telegram.Attributes.Filters;\nusing Telegram.Bot;\nusing Telegram.Bot.Types;\nusing Telegram.Filters;\nusing Telegram.Handlers;\n\nnamespace TestPackage\n{\n    class Program\n    {\n        static async Task Main()\n        {\n            TelegramBotClient bot = new TelegramBotClient(\"BOT_TOKEN\");\n\n            await bot.Dispatcher();\n        }\n\n\n        [MessageHandler]\n        [CommandFilter(\"start\")]\n        [ReplyFilter(Reverse = true)]\n        [PrivateFilter]\n        public static async Task CallBack(TelegramBotClient client, Message message, Dictionary\u003cstring, dynamic\u003e data)\n        {\n            await message.ReplyText(\"OK\");\n        }\n    }\n}\n```\n\n\nCurrent features are almost tested.\n\nThis project has many things left to do yet!\n\n    \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmmdreza%2Fmoderntelegrambot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimmmdreza%2Fmoderntelegrambot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmmdreza%2Fmoderntelegrambot/lists"}