-
Notifications
You must be signed in to change notification settings - Fork 13
Sending messages
Alexey Nesterov edited this page Aug 3, 2017
·
4 revisions
This method sends a text message to a user or group. You can use this message to reply a message from a user.
Minimum required arguments for this method are: chatId (chat_id) and text.
chatId: Unique identifier for the target chat or username of the target channel (in the format @channelusername).
Can be long or string.
text: your message text.
The sample code below, will receive all messages sent to your bot and will send them a "Hello" message:
static void Main(string[] args)
{
var client = new TelegramBotClient()
{
Token = "",
CheckInterval = 1000
};
client.UpdatesReceived += client_UpdatesReceived;
client.StartCheckingUpdates();
// IMPORTANT: If your program ends here, you won't get updates! You need a message loop to keep your program running.
}
static void client_UpdatesReceived(object sender, TelegramUpdateEventArgs e)
{
var client = (TelegramBotClient)sender;
foreach (var update in e.Updates)
{
client.SendMessage(update.Message.Chat.Id, "Hello");
}
}
- How to use
-
Installation
Basics
Receiving messages
Sending messages
Sending photos
Custom keyboards
How use proxy - About development