0
我想通過一個簡單的C#控制檯應用程序使用TLsharp庫發送一個電報。我的程序運行但我收不到消息。我已經通過創建電報網站上的應用程序的過程,並獲得必要的哈希ID和code.Please協助TLsharp控制檯發送消息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TeleSharp.TL;
using TLSharp;
using TLSharp.Core;
namespace TLsharpTest
{
class Program
{
const int apiId = 55xxx;
const int groupId = -167xxxxx;
const string apiHash = "220xxxxxxxx";
const string number = "27xxxxxxx";
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();
}
}
}