Skip to content

themehrdad/NetTelebot

Repository files navigation

logo

NetTelebot StackShare NuGet version license

Telegram bot API implementation on .NET framework

Repository Net-Telebot-2.0 (master) Net-Telebot (master)
Build Build status Build status
Coverage Coverage Status Coverage Status
Quality Codacy Badge BCH compliance Codacy Badge BCH compliance

Net-Telebot-2.0 is development repository.
Net-Telebot is release repository.
More about this on the wiki page stages of development

About

Do you want to create a smart automated bot on Telegram App? If you plan to write the logic using .NET framework, this tool might help you.

To support devices with Windows XP, the library version is developed under the .NET Framework 4

Usage

After creating your own bot on Telegram, you need to add a reference to "nettelebot" library.

All you need to do is to create an instance of TelegramBotClient class.

var botClient = new TelegramBotClient() { Token = "[YOUR_BOT_TOKEN]" };

Now you may send messages or even photos using methods in this class:

botClient.SendMessage(Chat_Id, "Hello!");

Or even you may listen for incoming messages from uses:

botClient.UpdatesReceived += botClient_UpdatesReceived;
private void botClient_UpdatesReceived(object sender, TelegramUpdateEventArgs e)
{
   var botClient = (TelegramBotClient)sender;
   foreach (var item in e.Updates)
   {
     if (item.Message.Text != null)
       tbc.SendMessage(item.Message.Chat.Id, item.Message.Text);
   }
}

See more examples in the project wiki

Plans

On the nearest release (1.0.13)

  • Remove obsolete methods
  • Add all sticker methods and types
  • Add new method sendMediaGroup and two kinds of InputMedia objects to support the new albums feature
  • Add support for pinning messages in channels. pinChatMessage and unpinChatMessage accept channels
  • Add the new field provider_data to sendInvoice for sharing information about the invoice with the payment provider

For the project

  • Full support API Telegrams

More details here

Thanks

The logo is provided by the site icons8.com