I’m new on telegram Bot programmer and want to write a simple console application to send a message on telegram.
After some research I developed this codes with no error but it doesn’t works and does not send my message.
When i traced my code i found that status on result object is “waiting for activation” , what;s this mean?
I registered my bot and have a API access Token and used it on this codes.
Please guide me 🙂
static void Main(string[] args)
{
Task<Message> result;
result= DoSomethingAsync();
Console.WriteLine();
}
static async Task<Message> DoSomethingAsync()
{
var Bot = new Telegram.Bot.Api("my API access Token");
return await Bot.SendTextMessage("@blablavla", "test message");
}
3
Answers
You can build you own
async main
-method like this:this should do what you want. But please note that it is untested!
first create your bot
and then write a code like this in any method that you want. when this method runs it whould send your message to the user after each message to be sent. and will notify u in the console.
try it
You Can Use This Example To And Receive Send Message,Location,Inline KeyBoard,In Text KeyBoard ,Photo and…
In this Example You can See GetUpdate And Webhook Code that Created by Your Library
this Example Base on Telegram Bot API MrRoundRobin