I think I need to use some addhandler, but don't know how and which - pretty new to these things.
trying to get messages from telegram bot using vb.net not working

Paul Falleyn
1
Reputation point
Hi, I'm trying to get messages, ID, ... out of telegram using the new telegram v18 bot.
As the bot.startreceiving has subs with arguments that are not in the startreceiving it is not going good. Tried to translate it from C# - but got errors I don't know how to solve.
Can anyone tell me what I need to change for this to get it running good?
I'm pretty new to this and don't know how to solve this.
This is what I got:
Imports Telegram.Bot
Imports Telegram.Bot.Exceptions
Imports Telegram.Bot.Polling
Imports Telegram.Bot.Args
Imports Telegram.Bot.Extensions.Polling
Imports Telegram.Bot.Types
Imports Telegram.Bot.Types.Enums
Imports Telegram.Bot.Types.ReplyMarkups
Public Class Form1
Public TelegramBotToken As String = "YOUR TELEGRAM TOKEN HERE"
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim bot1 = New TelegramBotClient(TelegramBotToken)
Dim receiverOptions1 = New ReceiverOptions
bot.startreceiving(UpdateHandler, ErrorHandler, receiverOptions1)
End Sub
Private Sub ErrorHandler(arg1 As ITelegramBotClient, arg2 As Exception, arg3 As CancellationToken)
Throw New NotImplementedException()
End Sub
Private Async Sub UpdateHandler(bot As ITelegramBotClient, update As Update, arg3 As CancellationToken)
If (update.Type = UpdateType.Message) Then
If (update.Message.Type = MessageType.Text) Then
Dim Text As String = update.Message.Text
Dim ID1 As String = update.Message.Chat.Id
Dim username As String = update.Message.Chat.Username
End If
End If
End Sub
End Class
if you know how to solve or how I can read telegram messages using vb.net, please let me know!!!!