Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 62 lines (40 sloc) 2.42 KB

❗️ This library is no longer maintained ❗️

Unfortunately, I'm not working with C# anymore and unable to maintain this library. The sources from 2016 are left for research purposes only, the number of more great alternatives is surely available in NuGet, like Telegram.Bot.

Telesharp Build status

Telesharp is a C# library which helps you to create primitive bots for Telegram.

Creating bots

Use a token given by @BotFather

To create a bot, that does nothing but pulls updates, do the following:

var Bot = new Bot(INSERT_YOUR_TOKEN_HERE);
Bot.Run();
Bot.WaitToDie();

Or a bot, that sends random zombie sounds, because whynot:

var zombieSounds = new []{"aggrh", "zzz", "grrrr", "arrr", "ogrrrh"};
var Bot = new Bot(INSERT_YOUR_TOKEN_HERE);
Bot.OnParseMessage += (o,e) =>
{
	Bot.Methods.SendMessage(e.Message.Chat,
		zombieSounds[(new Random(DateTime.Now.Millisecond))
			.Next(0, zombieSounds.Length)]);
};
Bot.Run();
Bot.WaitToDie();

More examples available:

  1. Message listener
  2. Sticker-Sender bot
  3. LIKE5 wallpapers bot

API

Not all API methods are included in this library.

Excluded:

setWebhook([Optional] String url, [Optional] InputFile certificate)

Is it needed? Vote here

Yet not included:


You can’t perform that action at this time.