Click here to Skip to main content
16,020,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to help here please.

I want to send message from my VB.net to Telegram and I have my Token and my Chat Id.

I using VB.net Visual Studio 2015 and Telegram.Bot Version 17

What I have tried:

botclient = New TelegramBotClient("My Token")
Await botclient.SendTextMessageAsync(IDClient, "hello world")
Posted
Updated 30-Apr-22 17:46pm

1 solution

Hi William,

It seems their knowledgebase article has all the details here: Text - A guide to Telegram.Bot library[^]

For language, VB.NET to C# should be relatively easy for few lines of code. Either you can do it manually (looks pretty straight forward on what are the steps and API) OR you can choose to use a converter (like Code Converter C# to VB and VB to C# – Telerik[^] ) to get some basic conversion.

Sample:
//You can use this code snippet in the event handler from Example Bot page and use chatId 
//or put the chatId value if you know it.

// using Telegram.Bot.Types;
// using Telegram.Bot.Types.Enums;
// using Telegram.Bot.Types.ReplyMarkups;

Message message = await botClient.SendTextMessageAsync(
    chatId: chatId,
    text: "Trying *all the parameters* of `sendMessage` method",
    parseMode: ParseMode.MarkdownV2,
    disableNotification: true,
    replyToMessageId: update.Message.MessageId,
    replyMarkup: new InlineKeyboardMarkup(
        InlineKeyboardButton.WithUrl(
            "Check sendMessage method",
            "https://core.telegram.org/bots/api#sendmessage")),
    cancellationToken: cancellationToken);

Try out!
 
Share this answer
 
Comments
William Rodrigues 2021 1-May-22 5:28am    
I tried before but I couldn't

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900