Send messages to telegram using TLSharp C #

0

Hi, I'm doing a small program to send messages to a telegram but the problem is that I do not receive the messages. The code is as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TeleSharp.TL;
using TLSharp;
using TLSharp.Core;
using System.IO;

namespace telegram
{
    class Program
    {
       const int apiId = 85381;
       const string apiHash = "3e368f6bc7a6b30844b9e88cc940c151";
       const string number = "12067177907";
       const int groupId = 376934156;
        static void Main(string[] args)
        {
            var client = new TelegramClient(apiId, apiHash);
            client.ConnectAsync();

            var hash = client.SendCodeRequestAsync(number);
            var code = "55xxx"; // you can change code in debugger
            var user = client.MakeAuthAsync(number, apiHash, code);
            client.SendMessageAsync(new TLInputPeerUser() { user_id = groupId }, "TEST");
            Console.ReadKey();
        }
    }
}

Here is a capture of my data so you can verify that the data is correct:

Second:

Third:

At least I would have to get a message to my account by entering "Test" but I do not receive anything. In my case, my application would be a simple extension.

Reference: TLSharp

    
asked by Sergio Ramos 18.03.2017 в 16:05
source

1 answer

0

I think you're missing something in the api token, generally the api token of the bots have this expression: 304017237:AAHpKXZBaw_wOF3H-ryhWl3F3wqIVP_Zqf8 . Try placing the full expression since I see that you only have 3e368f6bc7a6b30844b9e88cc940c151 . Search the api token and edit it, if you do not have it you can ask the Bot Father to remind you.

    
answered by 20.07.2018 в 20:14