This repository was archived by the owner on Dec 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Denis edited this page Aug 18, 2021
·
6 revisions
Welcome to the TeleBotCSharp wiki!
Importing necessary
using TeleBotCSharp;
Creating bot object in head of class
public static TeleBotCs bot;
Initializing bot object
string token = "YOUR TOKEN HERE";
bot = new TeleBotCs(token);
For handling messages adding this
var botService = new TeleBotService(bot);
botService.StartBotAsync();
Adding handler for /start
[CommandHandler("start")]
public async void Start(Result result)
{
await bot.SendMessage(result.message.chat.id, "Hello World!");
}
namespace TelegramTestBot
{
class Program
{
public static TeleBotCs bot;
static void Main(string[] args)
{
string token = "YOUR TOKEN HERE";
bot = new TeleBotCs(token);
var botService = new TeleBotService(bot);
botService.StartBotAsync();
}
[CommandHandler("start")]
public async void Start(Result result)
{
await bot.SendMessage(result.message.chat.id, "Hello World!";
}
}
}