Send Text via Telegram

Solved
Sam_Placi Posted messages 6 Registration date   Status Membre Last intervention   -  
Sam_Placi Posted messages 6 Registration date   Status Membre Last intervention   -

Hello,

Does anyone have a simple example of programming in VB for sending and receiving texts with Telegram?

I have downloaded the TELEGRAM-BOT API, but I don't understand which methods to use or in what order.

Thank you in advance,

Sam


2 réponses

Anonymous user
 

Here is a simple example of code in Visual Basic (VB) that shows how to use the TELEGRAM-BOT API to send and receive messages via Telegram:

Imports Telegram.Bot Imports Telegram.Bot.Types Module Module1 Sub Main() ' Create a "BotClient" object with your bot token Dim botClient As New BotClient("TOKEN") ' Send a message to a chat Dim chatId As Long = 123456 botClient.SendTextMessageAsync(chatId, "Hello! I am a Telegram bot.") ' Retrieve the latest update Dim updates As Update() = botClient.GetUpdatesAsync().Result Dim lastUpdate As Update = updates.LastOrDefault() If lastUpdate IsNot Nothing Then ' Display the content of the last received message Console.WriteLine(lastUpdate.Message.Text) End If End Sub End Module
1
Sam_Placi Posted messages 6 Registration date   Status Membre Last intervention  
 

This is exactly what I wanted.

Thank you SuperAvataar.

Happy New Year to you!

Sam.

0