Created
January 14, 2021 07:38
-
-
Save immmdreza/a4ab3a868abd95131ca844be87370973 to your computer and use it in GitHub Desktop.
Modern Telegram.Bot Usage example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Telegram.Attributes; | |
using Telegram.Attributes.Filters; | |
using Telegram.Bot; | |
using Telegram.Bot.Types; | |
using Telegram.Filters; | |
using Telegram.Handlers; | |
namespace TestPackage | |
{ | |
class Program | |
{ | |
static async Task Main() | |
{ | |
TelegramBotClient bot = new TelegramBotClient("BOT_TOKEN"); | |
await bot.Dispatcher(); | |
} | |
[MessageHandler] | |
[CommandFilter("start")] | |
[ReplyFilter(Reverse = true)] | |
[PrivateFilter] | |
public static async Task CallBack(TelegramBotClient client, Message message, Dictionary<string, dynamic> data) | |
{ | |
await message.ReplyText("OK"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment