Skip to content

Instantly share code, notes, and snippets.

@immmdreza
Created January 14, 2021 07:38
Show Gist options
  • Save immmdreza/a4ab3a868abd95131ca844be87370973 to your computer and use it in GitHub Desktop.
Save immmdreza/a4ab3a868abd95131ca844be87370973 to your computer and use it in GitHub Desktop.
Modern Telegram.Bot Usage example
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