This is my Code. On first run everything worked correctly. But when the program is closed and reopened again than UpdateHandler not get called anymore. client.IsUserAuthorized() gives true. When i delete Session.dat i can reenter my code and it will work. After 5 runs of the programm i have to wait 24 hours because of flood error.
public class Program
{
static void Main(string[] args)
{
Program program = new Program();
Task.Run(async () => await program.Run()).Wait();
}
public async Task Run()
{
TelegramClient client = new TelegramClient(new FileSessionStore(), 129340, "...", new DeviceInfo("Telegram Test", "Telegram Test", "Telegram Test", "en"));
client.UpdateMessage += UpdateHandler;
await client.Start();
if (!client.IsUserAuthorized())
{
var codeRequest = await client.SendCode("+...", VerificationCodeDeliveryType.NumericCodeViaTelegram);
string input = "";
await client.SignIn("+...", codeRequest.phoneCodeHash, input);
}
}
private void UpdateHandler(object sender, Updates updates)
{
if (updates.constructor == Constructor.UpdateShortMessage)
{
var updateShortMessageConstructor = updates as UpdateShortMessageConstructor;
}
}
}
This is my Code. On first run everything worked correctly. But when the program is closed and reopened again than UpdateHandler not get called anymore. client.IsUserAuthorized() gives true. When i delete Session.dat i can reenter my code and it will work. After 5 runs of the programm i have to wait 24 hours because of flood error.